Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(394)

Side by Side Diff: src/gpu/text/GrStencilAndCoverTextContext.h

Issue 1684733005: Start whittling down GrTextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@tc-cleanup-2
Patch Set: a bit more tidying Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrStencilAndCoverTextContext_DEFINED 8 #ifndef GrStencilAndCoverTextContext_DEFINED
9 #define GrStencilAndCoverTextContext_DEFINED 9 #define GrStencilAndCoverTextContext_DEFINED
10 10
11 #include "GrTextContext.h" 11 #include "GrTextContext.h"
12 #include "GrDrawTarget.h" 12 #include "GrDrawTarget.h"
13 #include "GrStrokeInfo.h" 13 #include "GrStrokeInfo.h"
14 #include "SkTHash.h" 14 #include "SkTHash.h"
15 #include "SkTInternalLList.h" 15 #include "SkTInternalLList.h"
16 #include "SkTLList.h" 16 #include "SkTLList.h"
17 #include "batches/GrDrawPathBatch.h" 17 #include "batches/GrDrawPathBatch.h"
18 18
19 class GrAtlasTextContext;
19 class GrTextStrike; 20 class GrTextStrike;
20 class GrPath; 21 class GrPath;
21 class SkSurfaceProps; 22 class SkSurfaceProps;
22 23
23 /* 24 /*
24 * This class implements text rendering using stencil and cover path rendering 25 * This class implements text rendering using stencil and cover path rendering
25 * (by the means of GrDrawTarget::drawPath). 26 * (by the means of GrDrawTarget::drawPath).
26 * This class exposes the functionality through GrTextContext interface. 27 * This class exposes the functionality through GrTextContext interface.
27 */ 28 */
28 class GrStencilAndCoverTextContext : public GrTextContext { 29 class GrStencilAndCoverTextContext : public GrTextContext {
29 public: 30 public:
30 static GrStencilAndCoverTextContext* Create(GrContext*, const SkSurfaceProps &); 31 static GrStencilAndCoverTextContext* Create(GrContext*, const SkSurfaceProps &);
31 32
33 void drawText(GrDrawContext* dc,
34 const GrClip&, const GrPaint&, const SkPaint&,
35 const SkMatrix& viewMatrix, const char text[], size_t byteLeng th, SkScalar x,
36 SkScalar y, const SkIRect& clipBounds) override;
37 void drawPosText(GrDrawContext*,
38 const GrClip&, const GrPaint&, const SkPaint&,
39 const SkMatrix& viewMatrix,
40 const char text[], size_t byteLength,
41 const SkScalar pos[], int scalarsPerPosition,
42 const SkPoint& offset, const SkIRect& clipBounds) override;
43 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&,
44 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y,
45 SkDrawFilter*, const SkIRect& clipBounds) override;
46
32 virtual ~GrStencilAndCoverTextContext(); 47 virtual ~GrStencilAndCoverTextContext();
33 48
34 private: 49 private:
35 GrStencilAndCoverTextContext(GrContext*, const SkSurfaceProps&); 50 GrStencilAndCoverTextContext(GrContext*, const SkSurfaceProps&);
36 51
37 bool canDraw(const SkPaint& skPaint, const SkMatrix&) override { 52 bool canDraw(const SkPaint& skPaint, const SkMatrix&) {
38 return this->internalCanDraw(skPaint); 53 return this->internalCanDraw(skPaint);
39 } 54 }
40 55
41 bool internalCanDraw(const SkPaint&); 56 bool internalCanDraw(const SkPaint&);
42 57
43 void onDrawText(GrDrawContext*, const GrClip&, const GrPaint&, const SkPaint &,
44 const SkMatrix& viewMatrix,
45 const char text[], size_t byteLength,
46 SkScalar x, SkScalar y, const SkIRect& clipBounds) override;
47 void onDrawPosText(GrDrawContext*,
48 const GrClip&, const GrPaint&, const SkPaint&,
49 const SkMatrix& viewMatrix,
50 const char text[], size_t byteLength,
51 const SkScalar pos[], int scalarsPerPosition,
52 const SkPoint& offset, const SkIRect& clipBounds) overrid e;
53 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&,
54 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y,
55 SkDrawFilter*, const SkIRect& clipBounds) override;
56
57 class FallbackBlobBuilder; 58 class FallbackBlobBuilder;
58 59
59 class TextRun { 60 class TextRun {
60 public: 61 public:
61 TextRun(const SkPaint& fontAndStroke); 62 TextRun(const SkPaint& fontAndStroke);
62 ~TextRun(); 63 ~TextRun();
63 64
64 void setText(const char text[], size_t byteLength, SkScalar x, SkScalar y); 65 void setText(const char text[], size_t byteLength, SkScalar x, SkScalar y);
65 66
66 void setPosText(const char text[], size_t byteLength, const SkScalar pos [], 67 void setPosText(const char text[], size_t byteLength, const SkScalar pos [],
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 128
128 const SkSTArray<1, uint32_t, true> fKey; 129 const SkSTArray<1, uint32_t, true> fKey;
129 size_t fCpuMemorySize; 130 size_t fCpuMemorySize;
130 131
131 SK_DECLARE_INTERNAL_LLIST_INTERFACE(TextBlob); 132 SK_DECLARE_INTERNAL_LLIST_INTERFACE(TextBlob);
132 }; 133 };
133 134
134 const TextBlob& findOrCreateTextBlob(const SkTextBlob*, const SkPaint&); 135 const TextBlob& findOrCreateTextBlob(const SkTextBlob*, const SkPaint&);
135 void purgeToFit(const TextBlob&); 136 void purgeToFit(const TextBlob&);
136 137
138 GrAtlasTextContext* fFallbackTextConte xt;
137 SkTHashMap<uint32_t, TextBlob*> fBlobIdCache; 139 SkTHashMap<uint32_t, TextBlob*> fBlobIdCache;
138 SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob> fBlobKeyCache; 140 SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob> fBlobKeyCache;
139 SkTInternalLList<TextBlob> fLRUList; 141 SkTInternalLList<TextBlob> fLRUList;
140 size_t fCacheSize; 142 size_t fCacheSize;
141 143
142 typedef GrTextContext INHERITED; 144 typedef GrTextContext INHERITED;
143 }; 145 };
144 146
145 #endif 147 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698