summaryrefslogtreecommitdiff
path: root/chromium/third_party/skia/include/utils
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/skia/include/utils')
-rw-r--r--chromium/third_party/skia/include/utils/SkCamera.h82
-rw-r--r--chromium/third_party/skia/include/utils/SkCustomTypeface.h7
-rw-r--r--chromium/third_party/skia/include/utils/SkRandom.h2
3 files changed, 18 insertions, 73 deletions
diff --git a/chromium/third_party/skia/include/utils/SkCamera.h b/chromium/third_party/skia/include/utils/SkCamera.h
index 1d018fb29a2..51a7d4d6b07 100644
--- a/chromium/third_party/skia/include/utils/SkCamera.h
+++ b/chromium/third_party/skia/include/utils/SkCamera.h
@@ -10,6 +10,7 @@
#ifndef SkCamera_DEFINED
#define SkCamera_DEFINED
+#include "include/core/SkM44.h"
#include "include/core/SkMatrix.h"
#include "include/private/SkNoncopyable.h"
@@ -21,76 +22,17 @@
class SkCanvas;
// DEPRECATED
-struct SkUnit3D {
- SkScalar fX, fY, fZ;
-
- void set(SkScalar x, SkScalar y, SkScalar z) {
- fX = x; fY = y; fZ = z;
- }
- static SkScalar Dot(const SkUnit3D&, const SkUnit3D&);
- static void Cross(const SkUnit3D&, const SkUnit3D&, SkUnit3D* cross);
-};
-
-// DEPRECATED
-struct SkPoint3D {
- SkScalar fX, fY, fZ;
-
- void set(SkScalar x, SkScalar y, SkScalar z) {
- fX = x; fY = y; fZ = z;
- }
- SkScalar normalize(SkUnit3D*) const;
-};
-typedef SkPoint3D SkVector3D;
-
-// DEPRECATED
-struct SkMatrix3D {
- SkScalar fMat[3][4];
-
- void reset();
-
- void setRow(int row, SkScalar a, SkScalar b, SkScalar c, SkScalar d = 0) {
- SkASSERT((unsigned)row < 3);
- fMat[row][0] = a;
- fMat[row][1] = b;
- fMat[row][2] = c;
- fMat[row][3] = d;
- }
-
- void setRotateX(SkScalar deg);
- void setRotateY(SkScalar deg);
- void setRotateZ(SkScalar deg);
- void setTranslate(SkScalar x, SkScalar y, SkScalar z);
-
- void preRotateX(SkScalar deg);
- void preRotateY(SkScalar deg);
- void preRotateZ(SkScalar deg);
- void preTranslate(SkScalar x, SkScalar y, SkScalar z);
-
- void setConcat(const SkMatrix3D& a, const SkMatrix3D& b);
- void mapPoint(const SkPoint3D& src, SkPoint3D* dst) const;
- void mapVector(const SkVector3D& src, SkVector3D* dst) const;
-
- void mapPoint(SkPoint3D* v) const {
- this->mapPoint(*v, v);
- }
-
- void mapVector(SkVector3D* v) const {
- this->mapVector(*v, v);
- }
-};
-
-// DEPRECATED
class SkPatch3D {
public:
SkPatch3D();
void reset();
- void transform(const SkMatrix3D&, SkPatch3D* dst = nullptr) const;
+ void transform(const SkM44&, SkPatch3D* dst = nullptr) const;
// dot a unit vector with the patch's normal
SkScalar dotWith(SkScalar dx, SkScalar dy, SkScalar dz) const;
- SkScalar dotWith(const SkVector3D& v) const {
- return this->dotWith(v.fX, v.fY, v.fZ);
+ SkScalar dotWith(const SkV3& v) const {
+ return this->dotWith(v.x, v.y, v.z);
}
// deprecated, but still here for animator (for now)
@@ -99,8 +41,8 @@ public:
private:
public: // make public for SkDraw3D for now
- SkVector3D fU, fV;
- SkPoint3D fOrigin;
+ SkV3 fU, fV;
+ SkV3 fOrigin;
friend class SkCamera3D;
};
@@ -114,10 +56,10 @@ public:
void update();
void patchToMatrix(const SkPatch3D&, SkMatrix* matrix) const;
- SkPoint3D fLocation; // origin of the camera's space
- SkPoint3D fAxis; // view direction
- SkPoint3D fZenith; // up direction
- SkPoint3D fObserver; // eye position (may not be the same as the origin)
+ SkV3 fLocation; // origin of the camera's space
+ SkV3 fAxis; // view direction
+ SkV3 fZenith; // up direction
+ SkV3 fObserver; // eye position (may not be the same as the origin)
private:
mutable SkMatrix fOrientation;
@@ -154,8 +96,8 @@ public:
private:
struct Rec {
- Rec* fNext;
- SkMatrix3D fMatrix;
+ Rec* fNext;
+ SkM44 fMatrix;
};
Rec* fRec;
Rec fInitialRec;
diff --git a/chromium/third_party/skia/include/utils/SkCustomTypeface.h b/chromium/third_party/skia/include/utils/SkCustomTypeface.h
index 36640999898..61f32afed5e 100644
--- a/chromium/third_party/skia/include/utils/SkCustomTypeface.h
+++ b/chromium/third_party/skia/include/utils/SkCustomTypeface.h
@@ -8,6 +8,7 @@
#ifndef SkCustomTypeface_DEFINED
#define SkCustomTypeface_DEFINED
+#include "include/core/SkFontMetrics.h"
#include "include/core/SkImage.h"
#include "include/core/SkPaint.h"
#include "include/core/SkPath.h"
@@ -20,19 +21,21 @@ class SkStream;
class SkCustomTypefaceBuilder {
public:
- SkCustomTypefaceBuilder(int numGlyphs);
+ SkCustomTypefaceBuilder();
void setGlyph(SkGlyphID, float advance, const SkPath&);
void setGlyph(SkGlyphID, float advance, const SkPath&, const SkPaint&);
void setGlyph(SkGlyphID, float advance, sk_sp<SkImage>, float scale);
void setGlyph(SkGlyphID, float advance, sk_sp<SkPicture>);
+ void setMetrics(const SkFontMetrics& fm, float scale = 1);
+
sk_sp<SkTypeface> detach();
private:
- int fGlyphCount;
std::vector<SkPath> fPaths;
std::vector<float> fAdvances;
+ SkFontMetrics fMetrics;
static sk_sp<SkTypeface> Deserialize(SkStream*);
diff --git a/chromium/third_party/skia/include/utils/SkRandom.h b/chromium/third_party/skia/include/utils/SkRandom.h
index 0678010362a..ba40732b9cf 100644
--- a/chromium/third_party/skia/include/utils/SkRandom.h
+++ b/chromium/third_party/skia/include/utils/SkRandom.h
@@ -49,7 +49,7 @@ public:
* Returns value [0...1) as an IEEE float
*/
float nextF() {
- unsigned int floatint = 0x3f800000 | (this->nextU() >> 9);
+ int floatint = 0x3f800000 | (int)(this->nextU() >> 9);
float f = SkBits2Float(floatint) - 1.0f;
return f;
}