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

Side by Side Diff: src/gpu/GrAtlasTextContext.h

Issue 1062863002: Avoid regenerating cached textblobs on integer scrolls (Closed) Base URL: https://skia.googlesource.com/skia.git@atlastextcache
Patch Set: feedback inc Created 5 years, 8 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 | « no previous file | src/gpu/GrAtlasTextContext.cpp » ('j') | src/gpu/GrAtlasTextContext.cpp » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 GrAtlasTextContext_DEFINED 8 #ifndef GrAtlasTextContext_DEFINED
9 #define GrAtlasTextContext_DEFINED 9 #define GrAtlasTextContext_DEFINED
10 10
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 }; 118 };
119 119
120 struct BigGlyph { 120 struct BigGlyph {
121 BigGlyph(const SkPath& path, int vx, int vy) : fPath(path), fVx(vx), fVy(vy) {} 121 BigGlyph(const SkPath& path, int vx, int vy) : fPath(path), fVx(vx), fVy(vy) {}
122 SkPath fPath; 122 SkPath fPath;
123 int fVx; 123 int fVx;
124 int fVy; 124 int fVy;
125 }; 125 };
126 126
127 SkTArray<BigGlyph> fBigGlyphs; 127 SkTArray<BigGlyph> fBigGlyphs;
128 GrColor fColor; // the original color on the paint
128 SkMatrix fViewMatrix; 129 SkMatrix fViewMatrix;
129 SkScalar fX; 130 SkScalar fX;
130 SkScalar fY; 131 SkScalar fY;
131 SkPaint::Style fStyle; 132 SkPaint::Style fStyle;
132 int fRunCount; 133 int fRunCount;
133 uint32_t fUniqueID; 134 uint32_t fUniqueID;
134 GrMemoryPool* fPool; 135 GrMemoryPool* fPool;
135 136
136 // all glyph / vertex offsets are into these pools. 137 // all glyph / vertex offsets are into these pools.
137 unsigned char* fVertices; 138 unsigned char* fVertices;
(...skipping 26 matching lines...) Expand all
164 typedef BitmapTextBlob::Run Run; 165 typedef BitmapTextBlob::Run Run;
165 typedef Run::SubRunInfo PerSubRunInfo; 166 typedef Run::SubRunInfo PerSubRunInfo;
166 167
167 void appendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, int left, int top, 168 void appendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, int left, int top,
168 GrColor color, GrFontScaler*, const SkIRect& clipRect); 169 GrColor color, GrFontScaler*, const SkIRect& clipRect);
169 170
170 inline void flushRunAsPaths(const SkTextBlob::RunIterator&, const SkPaint&, SkDrawFilter*, 171 inline void flushRunAsPaths(const SkTextBlob::RunIterator&, const SkPaint&, SkDrawFilter*,
171 const SkMatrix& viewMatrix, const SkIRect& clipB ounds, SkScalar x, 172 const SkMatrix& viewMatrix, const SkIRect& clipB ounds, SkScalar x,
172 SkScalar y); 173 SkScalar y);
173 inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int run, GrColor, 174 inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int run, GrColor,
174 uint8_t paintAlpha); 175 uint8_t paintAlpha, SkScalar transX, SkScalar transY);
175 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt, 176 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt,
176 const GrPaint& grPaint, const GrClip& clip); 177 const GrPaint& grPaint, const GrClip& clip,
178 SkScalar transX, SkScalar transY);
177 179
178 // We have to flush SkTextBlobs differently from drawText / drawPosText 180 // We have to flush SkTextBlobs differently from drawText / drawPosText
179 void flush(GrDrawTarget*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarget *, const SkPaint&, 181 void flush(GrDrawTarget*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarget *, const SkPaint&,
180 const GrPaint&, SkDrawFilter*, const GrClip&, const SkMatrix& vie wMatrix, 182 const GrPaint&, SkDrawFilter*, const GrClip&, const SkMatrix& vie wMatrix,
181 const SkIRect& clipBounds, SkScalar x, SkScalar y); 183 const SkIRect& clipBounds, SkScalar x, SkScalar y, SkScalar trans X, SkScalar transY);
182 void flush(GrDrawTarget*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&, 184 void flush(GrDrawTarget*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&,
183 const GrPaint&, const GrClip&, const SkMatrix& viewMatrix); 185 const GrPaint&, const GrClip&, const SkMatrix& viewMatrix);
184 186
185 void internalDrawText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const Sk Paint&, 187 void internalDrawText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const Sk Paint&,
186 const SkMatrix& viewMatrix, const char text[], size_t byteLength, 188 const SkMatrix& viewMatrix, const char text[], size_t byteLength,
187 SkScalar x, SkScalar y, const SkIRect& clipRect); 189 SkScalar x, SkScalar y, const SkIRect& clipRect);
188 void internalDrawPosText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const SkPaint&, 190 void internalDrawPosText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const SkPaint&,
189 const SkMatrix& viewMatrix, 191 const SkMatrix& viewMatrix,
190 const char text[], size_t byteLength, 192 const char text[], size_t byteLength,
191 const SkScalar pos[], int scalarsPerPosition, 193 const SkScalar pos[], int scalarsPerPosition,
192 const SkPoint& offset, const SkIRect& clipRect); 194 const SkPoint& offset, const SkIRect& clipRect);
193 195
194 // sets up the descriptor on the blob and returns a detached cache. Client must attach 196 // sets up the descriptor on the blob and returns a detached cache. Client must attach
195 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix& viewMa trix); 197 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix& viewMa trix);
196 static inline bool MustRegenerateBlob(const BitmapTextBlob&, const SkPaint&, 198 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY,
199 const BitmapTextBlob&, const SkPaint&,
197 const SkMatrix& viewMatrix, SkScalar x , SkScalar y); 200 const SkMatrix& viewMatrix, SkScalar x , SkScalar y);
198 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, const S kMatrix& viewMatrix, 201 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, const S kMatrix& viewMatrix,
199 const SkTextBlob* blob, SkScalar x, SkScalar y, 202 const SkTextBlob* blob, SkScalar x, SkScalar y,
200 SkDrawFilter* drawFilter, const SkIRect& clipRect); 203 SkDrawFilter* drawFilter, const SkIRect& clipRect);
201 204
202 GrBatchTextStrike* fCurrStrike; 205 GrBatchTextStrike* fCurrStrike;
203 GrTextBlobCache* fCache; 206 GrTextBlobCache* fCache;
204 207
205 friend class GrTextBlobCache; 208 friend class GrTextBlobCache;
206 friend class BitmapTextBatch; 209 friend class BitmapTextBatch;
207 210
208 typedef GrTextContext INHERITED; 211 typedef GrTextContext INHERITED;
209 }; 212 };
210 213
211 #endif 214 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrAtlasTextContext.cpp » ('j') | src/gpu/GrAtlasTextContext.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698