diff options
author | joshualitt <joshualitt@chromium.org> | 2015-12-11 06:11:21 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-11 06:11:21 -0800 |
commit | e804292e805917002cc3d7baa7f967fb20d2c7cb (patch) | |
tree | 5470bacbebdec462e03929dd07d1955249b31230 /src/gpu/text/GrTextUtils.h | |
parent | 296779832fd6175547d991ca67c735a824cadb66 (diff) |
Move all text stuff to its own folder
BUG=skia:
Review URL: https://codereview.chromium.org/1521453002
Diffstat (limited to 'src/gpu/text/GrTextUtils.h')
-rw-r--r-- | src/gpu/text/GrTextUtils.h | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/src/gpu/text/GrTextUtils.h b/src/gpu/text/GrTextUtils.h new file mode 100644 index 0000000000..8f673afbed --- /dev/null +++ b/src/gpu/text/GrTextUtils.h @@ -0,0 +1,70 @@ +/* + * Copyright 2015 Google Inc. + * + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +#ifndef GrTextUtils_DEFINED +#define GrTextUtils_DEFINED + +#include "GrColor.h" +#include "SkScalar.h" + +class GrAtlasTextBlob; +class GrBatchFontCache; +class GrBatchTextStrike; +class GrClip; +class GrContext; +class GrDrawContext; +class GrFontScaler; +class SkGlyph; +class SkMatrix; +struct SkIRect; +class SkPaint; +struct SkPoint; +class SkGlyphCache; +class SkSurfaceProps; + +/* + * A class to house a bunch of common text utilities. This class should *ONLY* have static + * functions. It is not a namespace only because we wish to friend SkPaint + * + */ +class GrTextUtils { +public: + // Functions for appending BMP text to GrAtlasTextBlob + static void DrawBmpText(GrAtlasTextBlob*, int runIndex, + GrBatchFontCache*, SkGlyphCache*, const SkPaint&, + GrColor, const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + SkScalar x, SkScalar y); + + static void DrawBmpPosText(GrAtlasTextBlob*, int runIndex, + GrBatchFontCache*, SkGlyphCache*, const SkPaint&, + GrColor, 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, + const char text[], size_t byteLength, SkScalar x, SkScalar y, + const SkIRect& clipBounds); + + static void DrawPosTextAsPath(GrContext* context, + GrDrawContext* dc, + const SkSurfaceProps& props, + const GrClip& clip, + const SkPaint& origPaint, const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + const SkScalar pos[], int scalarsPerPosition, + const SkPoint& offset, const SkIRect& clipBounds); +private: + static void BmpAppendGlyph(GrAtlasTextBlob*, int runIndex, GrBatchFontCache*, + GrBatchTextStrike**, const SkGlyph&, int left, int top, + GrColor color, GrFontScaler*); +}; + +#endif |