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

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

Issue 1685653004: Move surface props off of GrTextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@tc-cleanup-3
Patch Set: rebase 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
« no previous file with comments | « src/gpu/text/GrAtlasTextContext.cpp ('k') | src/gpu/text/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 10 matching lines...) Expand all
21 class GrPath; 21 class GrPath;
22 class SkSurfaceProps; 22 class SkSurfaceProps;
23 23
24 /* 24 /*
25 * This class implements text rendering using stencil and cover path rendering 25 * This class implements text rendering using stencil and cover path rendering
26 * (by the means of GrDrawTarget::drawPath). 26 * (by the means of GrDrawTarget::drawPath).
27 * This class exposes the functionality through GrTextContext interface. 27 * This class exposes the functionality through GrTextContext interface.
28 */ 28 */
29 class GrStencilAndCoverTextContext : public GrTextContext { 29 class GrStencilAndCoverTextContext : public GrTextContext {
30 public: 30 public:
31 static GrStencilAndCoverTextContext* Create(GrContext*, const SkSurfaceProps &); 31 static GrStencilAndCoverTextContext* Create(GrContext*);
32 32
33 void drawText(GrDrawContext* dc, 33 void drawText(GrDrawContext* dc,
34 const GrClip&, const GrPaint&, const SkPaint&, 34 const GrClip&, const GrPaint&, const SkPaint&,
35 const SkMatrix& viewMatrix, const char text[], size_t byteLeng th, SkScalar x, 35 const SkMatrix& viewMatrix, const SkSurfaceProps&, const char text[],
36 size_t byteLength, SkScalar x,
36 SkScalar y, const SkIRect& clipBounds) override; 37 SkScalar y, const SkIRect& clipBounds) override;
37 void drawPosText(GrDrawContext*, 38 void drawPosText(GrDrawContext*,
38 const GrClip&, const GrPaint&, const SkPaint&, 39 const GrClip&, const GrPaint&, const SkPaint&,
39 const SkMatrix& viewMatrix, 40 const SkMatrix& viewMatrix, const SkSurfaceProps&,
40 const char text[], size_t byteLength, 41 const char text[], size_t byteLength,
41 const SkScalar pos[], int scalarsPerPosition, 42 const SkScalar pos[], int scalarsPerPosition,
42 const SkPoint& offset, const SkIRect& clipBounds) override; 43 const SkPoint& offset, const SkIRect& clipBounds) override;
43 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&, 44 void drawTextBlob(GrDrawContext*, const GrClip&, const SkPaint&,
44 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x, SkScalar y, 45 const SkMatrix& viewMatrix, const SkSurfaceProps&, const S kTextBlob*,
46 SkScalar x, SkScalar y,
45 SkDrawFilter*, const SkIRect& clipBounds) override; 47 SkDrawFilter*, const SkIRect& clipBounds) override;
46 48
47 virtual ~GrStencilAndCoverTextContext(); 49 virtual ~GrStencilAndCoverTextContext();
48 50
49 private: 51 private:
50 GrStencilAndCoverTextContext(GrContext*, const SkSurfaceProps&); 52 GrStencilAndCoverTextContext(GrContext*);
51 53
52 bool canDraw(const SkPaint& skPaint, const SkMatrix&) { 54 bool canDraw(const SkPaint& skPaint, const SkMatrix&) {
53 return this->internalCanDraw(skPaint); 55 return this->internalCanDraw(skPaint);
54 } 56 }
55 57
56 bool internalCanDraw(const SkPaint&); 58 bool internalCanDraw(const SkPaint&);
57 59
58 void uncachedDrawTextBlob(GrDrawContext* dc, 60 void uncachedDrawTextBlob(GrDrawContext* dc,
59 const GrClip& clip, const SkPaint& skPaint, 61 const GrClip& clip, const SkPaint& skPaint,
60 const SkMatrix& viewMatrix, 62 const SkMatrix& viewMatrix,
63 const SkSurfaceProps&,
61 const SkTextBlob* blob, 64 const SkTextBlob* blob,
62 SkScalar x, SkScalar y, 65 SkScalar x, SkScalar y,
63 SkDrawFilter* drawFilter, 66 SkDrawFilter* drawFilter,
64 const SkIRect& clipBounds); 67 const SkIRect& clipBounds);
65 68
66 class FallbackBlobBuilder; 69 class FallbackBlobBuilder;
67 70
68 class TextRun { 71 class TextRun {
69 public: 72 public:
70 TextRun(const SkPaint& fontAndStroke); 73 TextRun(const SkPaint& fontAndStroke);
71 ~TextRun(); 74 ~TextRun();
72 75
73 void setText(const char text[], size_t byteLength, SkScalar x, SkScalar y); 76 void setText(const char text[], size_t byteLength, SkScalar x, SkScalar y);
74 77
75 void setPosText(const char text[], size_t byteLength, const SkScalar pos [], 78 void setPosText(const char text[], size_t byteLength, const SkScalar pos [],
76 int scalarsPerPosition, const SkPoint& offset); 79 int scalarsPerPosition, const SkPoint& offset);
77 80
78 void draw(GrContext*, GrDrawContext*, GrPipelineBuilder*, GrColor, const SkMatrix&, 81 void draw(GrContext*, GrDrawContext*, GrPipelineBuilder*, GrColor, const SkMatrix&,
82 const SkSurfaceProps&,
79 SkScalar x, SkScalar y, const SkIRect& clipBounds, 83 SkScalar x, SkScalar y, const SkIRect& clipBounds,
80 GrTextContext* fallbackTextContext, const SkPaint& originalSkP aint) const; 84 GrTextContext* fallbackTextContext, const SkPaint& originalSkP aint) const;
81 85
82 void releaseGlyphCache() const; 86 void releaseGlyphCache() const;
83 87
84 size_t computeSizeInCache() const; 88 size_t computeSizeInCache() const;
85 89
86 private: 90 private:
87 typedef GrDrawPathRangeBatch::InstanceData InstanceData; 91 typedef GrDrawPathRangeBatch::InstanceData InstanceData;
88 92
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 GrAtlasTextContext* fFallbackTextConte xt; 150 GrAtlasTextContext* fFallbackTextConte xt;
147 SkTHashMap<uint32_t, TextBlob*> fBlobIdCache; 151 SkTHashMap<uint32_t, TextBlob*> fBlobIdCache;
148 SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob> fBlobKeyCache; 152 SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob> fBlobKeyCache;
149 SkTInternalLList<TextBlob> fLRUList; 153 SkTInternalLList<TextBlob> fLRUList;
150 size_t fCacheSize; 154 size_t fCacheSize;
151 155
152 typedef GrTextContext INHERITED; 156 typedef GrTextContext INHERITED;
153 }; 157 };
154 158
155 #endif 159 #endif
OLDNEW
« no previous file with comments | « src/gpu/text/GrAtlasTextContext.cpp ('k') | src/gpu/text/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698