diff options
author | Mike Reed <reed@google.com> | 2018-11-23 15:27:51 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-11-23 20:54:16 +0000 |
commit | 358fcad1b864f464d197fc2761110dac0267f5d7 (patch) | |
tree | b8fb8e03469d6b4f25b062da90bb0a04b9b1f64d /include | |
parent | 7593b34081f2de0a828c33236ebc4b0d96591e81 (diff) | |
download | skqp-358fcad1b864f464d197fc2761110dac0267f5d7.tar.gz |
start to hide textparams on SkPaint
Bug: skia:
Change-Id: Id73c983cc71d39fe587d355e690261627fa63aee
Reviewed-on: https://skia-review.googlesource.com/c/172643
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkCanvas.h | 5 | ||||
-rw-r--r-- | include/core/SkFont.h | 17 | ||||
-rw-r--r-- | include/core/SkPaint.h | 9 |
3 files changed, 31 insertions, 0 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 6177349044..c0d005fcdc 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -36,6 +36,7 @@ class SkData; class SkDraw; class SkDrawable; struct SkDrawShadowRec; +class SkFont; class SkGlyphRunBuilder; class SkImage; class SkImageFilter; @@ -1877,6 +1878,10 @@ public: void drawText(const void* text, size_t byteLength, SkScalar x, SkScalar y, const SkPaint& paint); + // Experimental + void drawSimpleText(const void* text, size_t byteLength, SkTextEncoding encoding, + SkScalar x, SkScalar y, const SkFont& font, const SkPaint& paint); + /** Draws null terminated string, with origin at (x, y), using clip, SkMatrix, and SkPaint paint. diff --git a/include/core/SkFont.h b/include/core/SkFont.h index ade29f3242..edf1699c9f 100644 --- a/include/core/SkFont.h +++ b/include/core/SkFont.h @@ -291,6 +291,23 @@ public: return this->textToGlyphs(text, byteLength, encoding, nullptr, 0); } + /** Returns true if all text corresponds to a non-zero glyph index. + Returns false if any characters in text are not supported in + SkTypeface. + + If SkTextEncoding is kGlyphID_SkTextEncoding, + returns true if all glyph indices in text are non-zero; + does not check to see if text contains valid glyph indices for SkTypeface. + + Returns true if byteLength is zero. + + @param text array of characters or glyphs + @param byteLength number of bytes in text array + @param encoding text encoding + @return true if all text corresponds to a non-zero glyph index + */ + bool containsText(const void* text, size_t byteLength, SkTextEncoding encoding) const; + /** Returns the advance width of text. The advance is the normal distance to move before drawing additional text. Returns the bounding box of text if bounds is not nullptr. diff --git a/include/core/SkPaint.h b/include/core/SkPaint.h index 71492d370c..f9faee89a9 100644 --- a/include/core/SkPaint.h +++ b/include/core/SkPaint.h @@ -54,6 +54,10 @@ class SkTextBlob; class SkTextBlobRunIterator; class SkTypeface; +#ifndef SK_SUPPORT_LEGACY_PAINT_TEXTMEASURE +#define SK_SUPPORT_LEGACY_PAINT_TEXTMEASURE +#endif + /** \class SkPaint SkPaint controls options applied when drawing and measuring. SkPaint collects all options outside of the SkCanvas clip and SkCanvas matrix. @@ -953,6 +957,8 @@ public: this->setTextEncoding((TextEncoding)encoding); } +#ifdef SK_SUPPORT_LEGACY_PAINT_TEXTMEASURE + #ifdef SK_SUPPORT_LEGACY_FONTMETRICS_IN_PAINT /** SkFontMetrics is filled out by getFontMetrics(). SkFontMetrics contents reflect the values @@ -1083,6 +1089,7 @@ public: SkScalar measureText(const void* text, size_t length) const { return this->measureText(text, length, nullptr); } +#endif /** Returns the bytes of text that fit within maxWidth. The text fragment fits if its advance width is less than or equal to maxWidth. @@ -1101,6 +1108,7 @@ public: size_t breakText(const void* text, size_t length, SkScalar maxWidth, SkScalar* measuredWidth = nullptr) const; +#ifdef SK_SUPPORT_LEGACY_PAINT_TEXTMEASURE /** Retrieves the advance and bounds for each glyph in text, and returns the glyph count in text. Both widths and bounds may be nullptr. @@ -1257,6 +1265,7 @@ public: @return union of bounds of all glyphs */ SkRect getFontBounds() const; +#endif /** Returns true if SkPaint prevents all drawing; otherwise, the SkPaint may or may not allow drawing. |