diff options
author | joshualitt <joshualitt@chromium.org> | 2016-01-20 06:36:09 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-01-20 06:36:09 -0800 |
commit | 0d2199b3db21e1f22cf328ca090aa0c8abc9067f (patch) | |
tree | fbbd0559fad3a5227023c16ba9d4b087192a22b6 /src/gpu/text/GrTextUtils.h | |
parent | e179a9167f71dfc41668b05d40082aae76367fa6 (diff) |
Move distance field text positioning into GrTextUtils
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1521633002
Review URL: https://codereview.chromium.org/1521633002
Diffstat (limited to 'src/gpu/text/GrTextUtils.h')
-rw-r--r-- | src/gpu/text/GrTextUtils.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h index 0996f655a3..d6b7e94ea2 100644 --- a/src/gpu/text/GrTextUtils.h +++ b/src/gpu/text/GrTextUtils.h @@ -18,6 +18,7 @@ class GrClip; class GrContext; class GrDrawContext; class GrFontScaler; +class GrShaderCaps; class SkGlyph; class SkMatrix; struct SkIRect; @@ -48,6 +49,24 @@ public: const SkScalar pos[], int scalarsPerPosition, const SkPoint& offset); + // functions for appending distance field text + static bool CanDrawAsDistanceFields(const SkPaint& skPaint, const SkMatrix& viewMatrix, + const SkSurfaceProps& props, const GrShaderCaps& caps); + + static void DrawDFText(GrAtlasTextBlob* blob, int runIndex, + GrBatchFontCache*, const SkSurfaceProps&, + const SkPaint& skPaint, GrColor color, + const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + SkScalar x, SkScalar y); + + static void DrawDFPosText(GrAtlasTextBlob* blob, int runIndex, + GrBatchFontCache*, const SkSurfaceProps&, const SkPaint&, + GrColor color, const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + const SkScalar pos[], int scalarsPerPosition, + const SkPoint& offset); + // Functions for drawing text as paths static void DrawTextAsPath(GrContext*, GrDrawContext*, const GrClip& clip, const SkPaint& origPaint, const SkMatrix& viewMatrix, @@ -63,9 +82,20 @@ public: const SkScalar pos[], int scalarsPerPosition, const SkPoint& offset, const SkIRect& clipBounds); private: + static void InitDistanceFieldPaint(GrAtlasTextBlob* blob, + SkPaint* skPaint, + SkScalar* textRatio, + const SkMatrix& viewMatrix); + static void BmpAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache*, GrBatchTextStrike**, const SkGlyph&, int left, int top, GrColor color, GrFontScaler*); + + static bool DfAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache*, + GrBatchTextStrike**, const SkGlyph&, + SkScalar sx, SkScalar sy, GrColor color, + GrFontScaler* scaler, + SkScalar textRatio, const SkMatrix& viewMatrix); }; #endif |