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

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

Issue 1092283002: Add support for rotating / scaling / translating gpu cached distance field textblobs (Closed) Base URL: https://skia.googlesource.com/skia.git@atdfopt3
Patch Set: adding comment 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 GrMemoryPool* fPool; 223 GrMemoryPool* fPool;
224 SkMaskFilter::BlurRec fBlurRec; 224 SkMaskFilter::BlurRec fBlurRec;
225 StrokeInfo fStrokeInfo; 225 StrokeInfo fStrokeInfo;
226 SkTArray<BigGlyph> fBigGlyphs; 226 SkTArray<BigGlyph> fBigGlyphs;
227 Key fKey; 227 Key fKey;
228 SkMatrix fViewMatrix; 228 SkMatrix fViewMatrix;
229 #ifdef SK_DEBUG 229 #ifdef SK_DEBUG
230 mutable SkScalar fTotalXError; 230 mutable SkScalar fTotalXError;
231 mutable SkScalar fTotalYError; 231 mutable SkScalar fTotalYError;
232 #endif 232 #endif
233 SkColor fPaintColor;
233 SkScalar fX; 234 SkScalar fX;
234 SkScalar fY; 235 SkScalar fY;
235 SkColor fPaintColor; 236
237 // We can regenerate distance field text, but only if the new viewmatrix would not result in
jvanverth1 2015/04/21 15:29:47 s/regenerate/reuse/ ?
238 // a mip change. Because there can be multiple runs in a blob, we track the overall
239 // maximum minimum scale, and minimum maximum scale, we can support befo re we need to regen
240 SkScalar fMaxMinScale;
241 SkScalar fMinMaxScale;
236 int fRunCount; 242 int fRunCount;
237 bool fHasDistanceField; 243 bool fHasDistanceField;
238 bool fHasBitmap; 244 bool fHasBitmap;
239 245
240 BitmapTextBlob() : fHasDistanceField(false), fHasBitmap(false) {} 246 BitmapTextBlob()
247 : fMaxMinScale(SK_ScalarMax)
248 , fMinMaxScale(SK_ScalarMax)
249 , fHasDistanceField(false)
250 , fHasBitmap(false) {}
241 251
242 static const Key& GetKey(const BitmapTextBlob& blob) { 252 static const Key& GetKey(const BitmapTextBlob& blob) {
243 return blob.fKey; 253 return blob.fKey;
244 } 254 }
245 255
246 static uint32_t Hash(const Key& key) { 256 static uint32_t Hash(const Key& key) {
247 return SkChecksum::Murmur3(&key, sizeof(Key)); 257 return SkChecksum::Murmur3(&key, sizeof(Key));
248 } 258 }
249 259
250 void operator delete(void* p) { 260 void operator delete(void* p) {
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY, 351 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY,
342 const BitmapTextBlob&, const SkPaint&, 352 const BitmapTextBlob&, const SkPaint&,
343 const SkMaskFilter::BlurRec&, 353 const SkMaskFilter::BlurRec&,
344 const SkMatrix& viewMatrix, SkScalar x , SkScalar y); 354 const SkMatrix& viewMatrix, SkScalar x , SkScalar y);
345 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, GrColor , 355 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, GrColor ,
346 const SkMatrix& viewMatrix, 356 const SkMatrix& viewMatrix,
347 const SkTextBlob* blob, SkScalar x, SkScalar y, 357 const SkTextBlob* blob, SkScalar x, SkScalar y,
348 SkDrawFilter* drawFilter, const SkIRect& clipRect, G rRenderTarget*, 358 SkDrawFilter* drawFilter, const SkIRect& clipRect, G rRenderTarget*,
349 const GrClip&, const GrPaint&); 359 const GrClip&, const GrPaint&);
350 inline static bool HasLCD(const SkTextBlob*); 360 inline static bool HasLCD(const SkTextBlob*);
351 inline void initDistanceFieldPaint(SkPaint*, SkScalar* textRatio, const SkMa trix&); 361 inline void initDistanceFieldPaint(BitmapTextBlob*, SkPaint*, SkScalar* text Ratio,
362 const SkMatrix&);
352 363
353 // Distance field text needs this table to compute a value for use in the fr agment shader. 364 // Distance field text needs this table to compute a value for use in the fr agment shader.
354 // Because the GrAtlasTextContext can go out of scope before the final flush , this needs to be 365 // Because the GrAtlasTextContext can go out of scope before the final flush , this needs to be
355 // refcnted and malloced 366 // refcnted and malloced
356 struct DistanceAdjustTable : public SkNVRefCnt<DistanceAdjustTable> { 367 struct DistanceAdjustTable : public SkNVRefCnt<DistanceAdjustTable> {
357 DistanceAdjustTable(float gamma) { this->buildDistanceAdjustTable(gamma) ; } 368 DistanceAdjustTable(float gamma) { this->buildDistanceAdjustTable(gamma) ; }
358 ~DistanceAdjustTable() { SkDELETE_ARRAY(fTable); } 369 ~DistanceAdjustTable() { SkDELETE_ARRAY(fTable); }
359 370
360 void buildDistanceAdjustTable(float gamma); 371 void buildDistanceAdjustTable(float gamma);
361 372
(...skipping 13 matching lines...) Expand all
375 bool fEnableDFRendering; 386 bool fEnableDFRendering;
376 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; 387 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable;
377 388
378 friend class GrTextBlobCache; 389 friend class GrTextBlobCache;
379 friend class BitmapTextBatch; 390 friend class BitmapTextBatch;
380 391
381 typedef GrTextContext INHERITED; 392 typedef GrTextContext INHERITED;
382 }; 393 };
383 394
384 #endif 395 #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