diff options
author | 2015-05-11 08:58:08 -0700 | |
---|---|---|
committer | 2015-05-11 08:58:08 -0700 | |
commit | 79dfb2b6b6db7b2e703810d26dbdc90cf3ea40f9 (patch) | |
tree | bf1ec134f83ef17f770b2114f54b5b407a70a640 /src/gpu/GrAtlasTextContext.h | |
parent | e590266294c4c92e4e4c2f06f267ac5751d07562 (diff) |
Add unit tests to text context
TBR=bsalomon@google.com
BUG=skia:
Review URL: https://codereview.chromium.org/1128153005
Diffstat (limited to 'src/gpu/GrAtlasTextContext.h')
-rw-r--r-- | src/gpu/GrAtlasTextContext.h | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h index c6e1d2f0b2..55597cfccc 100644 --- a/src/gpu/GrAtlasTextContext.h +++ b/src/gpu/GrAtlasTextContext.h @@ -19,6 +19,11 @@ #include "SkTextBlob.h" #include "SkTInternalLList.h" +#ifdef GR_TEST_UTILS +#include "GrBatchTest.h" +#endif + +class BitmapTextBatch; class GrPipelineBuilder; class GrTextBlobCache; @@ -265,6 +270,10 @@ private: inline void flushRunAsPaths(const SkTextBlob::RunIterator&, const SkPaint&, SkDrawFilter*, const SkMatrix& viewMatrix, const SkIRect& clipBounds, SkScalar x, SkScalar y); + inline BitmapTextBatch* createBatch(BitmapTextBlob*, const PerSubRunInfo&, + int glyphCount, int run, int subRun, + GrColor, SkScalar transX, SkScalar transY, + const SkPaint&); inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int run, GrColor, SkScalar transX, SkScalar transY, const SkPaint&); inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt, @@ -332,6 +341,20 @@ private: inline void initDistanceFieldPaint(BitmapTextBlob*, SkPaint*, SkScalar* textRatio, const SkMatrix&); + // Test methods + // TODO this is really ugly. It'd be much nicer if positioning could be moved to batch + inline BitmapTextBlob* createDrawTextBlob(GrRenderTarget*, const GrClip&, const GrPaint&, + const SkPaint&, const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + SkScalar x, SkScalar y, + const SkIRect& regionClipBounds); + inline BitmapTextBlob* createDrawPosTextBlob(GrRenderTarget*, const GrClip&, const GrPaint&, + const SkPaint&, const SkMatrix& viewMatrix, + const char text[], size_t byteLength, + const SkScalar pos[], int scalarsPerPosition, + const SkPoint& offset, + const SkIRect& regionClipBounds); + // Distance field text needs this table to compute a value for use in the fragment shader. // Because the GrAtlasTextContext can go out of scope before the final flush, this needs to be // refcnted and malloced @@ -360,6 +383,10 @@ private: friend class GrTextBlobCache; friend class BitmapTextBatch; +#ifdef GR_TEST_UTILS + BATCH_TEST_FRIEND(TextBlob); +#endif + typedef GrTextContext INHERITED; }; |