diff options
author | Mike Reed <reed@google.com> | 2010-02-05 12:13:33 -0500 |
---|---|---|
committer | Mike Reed <reed@google.com> | 2010-02-05 12:13:33 -0500 |
commit | 75c8af293816b94cd8fd9a3d9b3a4d6e052dedfe (patch) | |
tree | 44abc2fbbe48e10dc01ac531d14e0d39c0069bfa /include | |
parent | f43ecde805dd6f15f555afcc523c1f36df0f4897 (diff) | |
download | external_skia-75c8af293816b94cd8fd9a3d9b3a4d6e052dedfe.zip external_skia-75c8af293816b94cd8fd9a3d9b3a4d6e052dedfe.tar.gz external_skia-75c8af293816b94cd8fd9a3d9b3a4d6e052dedfe.tar.bz2 |
update from skia/trunk
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkPaint.h | 9 | ||||
-rw-r--r-- | include/core/SkPoint.h | 19 |
2 files changed, 27 insertions, 1 deletions
diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 86f174a..5fef527 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -708,6 +708,15 @@ public: int textToGlyphs(const void* text, size_t byteLength, uint16_t glyphs[]) const; + /** Return true if all of the specified text has a corresponding non-zero + glyph ID. If any of the code-points in the text are not supported in + the typeface (i.e. the glyph ID would be zero), then return false. + + If the text encoding for the paint is kGlyph_TextEncoding, then this + returns true if all of the specified glyph IDs are non-zero. + */ + bool containsText(const void* text, size_t byteLength) const; + /** Convert the glyph array into Unichars. Unconvertable glyphs are mapped to zero. Note: this does not look at the text-encoding setting in the paint, only at the typeface. diff --git a/include/core/SkPoint.h b/include/core/SkPoint.h index d23f696..bdb30d9 100644 --- a/include/core/SkPoint.h +++ b/include/core/SkPoint.h @@ -26,6 +26,12 @@ */ struct SkIPoint { int32_t fX, fY; + + static SkIPoint Make(int32_t x, int32_t y) { + SkIPoint pt; + pt.set(x, y); + return pt; + } /** Set the x and y values of the point. */ void set(int32_t x, int32_t y) { fX = x; fY = y; } @@ -122,6 +128,12 @@ struct SkIPoint { struct SkPoint { SkScalar fX, fY; + static SkPoint Make(SkScalar x, SkScalar y) { + SkPoint pt; + pt.set(x, y); + return pt; + } + /** Set the point's X and Y coordinates */ void set(SkScalar x, SkScalar y) { fX = x; fY = y; } @@ -262,7 +274,12 @@ struct SkPoint { /** Returns the euclidian distance from (0,0) to (x,y) */ static SkScalar Length(SkScalar x, SkScalar y); - + + /** Normalize pt, returning its previous length. If the prev length is too + small (degenerate), return 0 and leave pt unchanged. + */ + static SkScalar Normalize(SkPoint* pt); + /** Returns the euclidian distance between a and b */ static SkScalar Distance(const SkPoint& a, const SkPoint& b) { |