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

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: tweak 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') | 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 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 bool fInitialized; 116 bool fInitialized;
117 bool fDrawAsPaths; 117 bool fDrawAsPaths;
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 #ifdef SK_DEBUG
127 mutable SkScalar fTotalXError;
128 mutable SkScalar fTotalYError;
129 #endif
127 SkTArray<BigGlyph> fBigGlyphs; 130 SkTArray<BigGlyph> fBigGlyphs;
131 GrColor fColor; // the original color on the paint
128 SkMatrix fViewMatrix; 132 SkMatrix fViewMatrix;
129 SkScalar fX; 133 SkScalar fX;
130 SkScalar fY; 134 SkScalar fY;
131 SkPaint::Style fStyle; 135 SkPaint::Style fStyle;
132 int fRunCount; 136 int fRunCount;
133 uint32_t fUniqueID; 137 uint32_t fUniqueID;
134 GrMemoryPool* fPool; 138 GrMemoryPool* fPool;
135 139
136 // all glyph / vertex offsets are into these pools. 140 // all glyph / vertex offsets are into these pools.
137 unsigned char* fVertices; 141 unsigned char* fVertices;
(...skipping 26 matching lines...) Expand all
164 typedef BitmapTextBlob::Run Run; 168 typedef BitmapTextBlob::Run Run;
165 typedef Run::SubRunInfo PerSubRunInfo; 169 typedef Run::SubRunInfo PerSubRunInfo;
166 170
167 void appendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, int left, int top, 171 void appendGlyph(BitmapTextBlob*, int runIndex, GrGlyph::PackedID, int left, int top,
168 GrColor color, GrFontScaler*, const SkIRect& clipRect); 172 GrColor color, GrFontScaler*, const SkIRect& clipRect);
169 173
170 inline void flushRunAsPaths(const SkTextBlob::RunIterator&, const SkPaint&, SkDrawFilter*, 174 inline void flushRunAsPaths(const SkTextBlob::RunIterator&, const SkPaint&, SkDrawFilter*,
171 const SkMatrix& viewMatrix, const SkIRect& clipB ounds, SkScalar x, 175 const SkMatrix& viewMatrix, const SkIRect& clipB ounds, SkScalar x,
172 SkScalar y); 176 SkScalar y);
173 inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int run, GrColor, 177 inline void flushRun(GrDrawTarget*, GrPipelineBuilder*, BitmapTextBlob*, int run, GrColor,
174 uint8_t paintAlpha); 178 uint8_t paintAlpha, SkScalar transX, SkScalar transY);
175 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt, 179 inline void flushBigGlyphs(BitmapTextBlob* cacheBlob, GrRenderTarget* rt,
176 const GrPaint& grPaint, const GrClip& clip); 180 const GrPaint& grPaint, const GrClip& clip,
181 SkScalar transX, SkScalar transY);
177 182
178 // We have to flush SkTextBlobs differently from drawText / drawPosText 183 // We have to flush SkTextBlobs differently from drawText / drawPosText
179 void flush(GrDrawTarget*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarget *, const SkPaint&, 184 void flush(GrDrawTarget*, const SkTextBlob*, BitmapTextBlob*, GrRenderTarget *, const SkPaint&,
180 const GrPaint&, SkDrawFilter*, const GrClip&, const SkMatrix& vie wMatrix, 185 const GrPaint&, SkDrawFilter*, const GrClip&, const SkMatrix& vie wMatrix,
181 const SkIRect& clipBounds, SkScalar x, SkScalar y); 186 const SkIRect& clipBounds, SkScalar x, SkScalar y, SkScalar trans X, SkScalar transY);
182 void flush(GrDrawTarget*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&, 187 void flush(GrDrawTarget*, BitmapTextBlob*, GrRenderTarget*, const SkPaint&,
183 const GrPaint&, const GrClip&, const SkMatrix& viewMatrix); 188 const GrPaint&, const GrClip&, const SkMatrix& viewMatrix);
184 189
185 void internalDrawText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const Sk Paint&, 190 void internalDrawText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const Sk Paint&,
186 const SkMatrix& viewMatrix, const char text[], size_t byteLength, 191 const SkMatrix& viewMatrix, const char text[], size_t byteLength,
187 SkScalar x, SkScalar y, const SkIRect& clipRect); 192 SkScalar x, SkScalar y, const SkIRect& clipRect);
188 void internalDrawPosText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const SkPaint&, 193 void internalDrawPosText(BitmapTextBlob*, int runIndex, SkGlyphCache*, const SkPaint&,
189 const SkMatrix& viewMatrix, 194 const SkMatrix& viewMatrix,
190 const char text[], size_t byteLength, 195 const char text[], size_t byteLength,
191 const SkScalar pos[], int scalarsPerPosition, 196 const SkScalar pos[], int scalarsPerPosition,
192 const SkPoint& offset, const SkIRect& clipRect); 197 const SkPoint& offset, const SkIRect& clipRect);
193 198
194 // sets up the descriptor on the blob and returns a detached cache. Client must attach 199 // 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); 200 inline SkGlyphCache* setupCache(Run*, const SkPaint&, const SkMatrix& viewMa trix);
196 static inline bool MustRegenerateBlob(const BitmapTextBlob&, const SkPaint&, 201 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY,
202 const BitmapTextBlob&, const SkPaint&,
197 const SkMatrix& viewMatrix, SkScalar x , SkScalar y); 203 const SkMatrix& viewMatrix, SkScalar x , SkScalar y);
198 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, const S kMatrix& viewMatrix, 204 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, const S kMatrix& viewMatrix,
199 const SkTextBlob* blob, SkScalar x, SkScalar y, 205 const SkTextBlob* blob, SkScalar x, SkScalar y,
200 SkDrawFilter* drawFilter, const SkIRect& clipRect); 206 SkDrawFilter* drawFilter, const SkIRect& clipRect);
201 207
202 GrBatchTextStrike* fCurrStrike; 208 GrBatchTextStrike* fCurrStrike;
203 GrTextBlobCache* fCache; 209 GrTextBlobCache* fCache;
204 210
205 friend class GrTextBlobCache; 211 friend class GrTextBlobCache;
206 friend class BitmapTextBatch; 212 friend class BitmapTextBatch;
207 213
208 typedef GrTextContext INHERITED; 214 typedef GrTextContext INHERITED;
209 }; 215 };
210 216
211 #endif 217 #endif
OLDNEW
« no previous file with comments | « no previous file | src/gpu/GrAtlasTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698