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

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') | 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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 GrMemoryPool* fPool; 228 GrMemoryPool* fPool;
229 SkMaskFilter::BlurRec fBlurRec; 229 SkMaskFilter::BlurRec fBlurRec;
230 StrokeInfo fStrokeInfo; 230 StrokeInfo fStrokeInfo;
231 SkTArray<BigGlyph> fBigGlyphs; 231 SkTArray<BigGlyph> fBigGlyphs;
232 Key fKey; 232 Key fKey;
233 SkMatrix fViewMatrix; 233 SkMatrix fViewMatrix;
234 #ifdef SK_DEBUG 234 #ifdef SK_DEBUG
235 mutable SkScalar fTotalXError; 235 mutable SkScalar fTotalXError;
236 mutable SkScalar fTotalYError; 236 mutable SkScalar fTotalYError;
237 #endif 237 #endif
238 SkColor fPaintColor;
238 SkScalar fX; 239 SkScalar fX;
239 SkScalar fY; 240 SkScalar fY;
240 SkColor fPaintColor; 241
242 // We can reuse distance field text, but only if the new viewmatrix woul d not result in
243 // a mip change. Because there can be multiple runs in a blob, we track the overall
244 // maximum minimum scale, and minimum maximum scale, we can support befo re we need to regen
245 SkScalar fMaxMinScale;
246 SkScalar fMinMaxScale;
241 int fRunCount; 247 int fRunCount;
242 uint8_t fTextType; 248 uint8_t fTextType;
243 249
244 BitmapTextBlob() : fTextType(0) {} 250 BitmapTextBlob()
251 : fMaxMinScale(SK_ScalarMax)
252 , fMinMaxScale(SK_ScalarMax)
253 , fTextType(0) {}
245 254
246 static const Key& GetKey(const BitmapTextBlob& blob) { 255 static const Key& GetKey(const BitmapTextBlob& blob) {
247 return blob.fKey; 256 return blob.fKey;
248 } 257 }
249 258
250 static uint32_t Hash(const Key& key) { 259 static uint32_t Hash(const Key& key) {
251 return SkChecksum::Murmur3(&key, sizeof(Key)); 260 return SkChecksum::Murmur3(&key, sizeof(Key));
252 } 261 }
253 262
254 void operator delete(void* p) { 263 void operator delete(void* p) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY, 359 static inline bool MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTran sY,
351 const BitmapTextBlob&, const SkPaint&, 360 const BitmapTextBlob&, const SkPaint&,
352 const SkMaskFilter::BlurRec&, 361 const SkMaskFilter::BlurRec&,
353 const SkMatrix& viewMatrix, SkScalar x , SkScalar y); 362 const SkMatrix& viewMatrix, SkScalar x , SkScalar y);
354 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, GrColor , 363 void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, GrColor ,
355 const SkMatrix& viewMatrix, 364 const SkMatrix& viewMatrix,
356 const SkTextBlob* blob, SkScalar x, SkScalar y, 365 const SkTextBlob* blob, SkScalar x, SkScalar y,
357 SkDrawFilter* drawFilter, const SkIRect& clipRect, G rRenderTarget*, 366 SkDrawFilter* drawFilter, const SkIRect& clipRect, G rRenderTarget*,
358 const GrClip&, const GrPaint&); 367 const GrClip&, const GrPaint&);
359 inline static bool HasLCD(const SkTextBlob*); 368 inline static bool HasLCD(const SkTextBlob*);
360 inline void initDistanceFieldPaint(SkPaint*, SkScalar* textRatio, const SkMa trix&); 369 inline void initDistanceFieldPaint(BitmapTextBlob*, SkPaint*, SkScalar* text Ratio,
370 const SkMatrix&);
361 371
362 // Distance field text needs this table to compute a value for use in the fr agment shader. 372 // Distance field text needs this table to compute a value for use in the fr agment shader.
363 // Because the GrAtlasTextContext can go out of scope before the final flush , this needs to be 373 // Because the GrAtlasTextContext can go out of scope before the final flush , this needs to be
364 // refcnted and malloced 374 // refcnted and malloced
365 struct DistanceAdjustTable : public SkNVRefCnt<DistanceAdjustTable> { 375 struct DistanceAdjustTable : public SkNVRefCnt<DistanceAdjustTable> {
366 DistanceAdjustTable(float gamma) { this->buildDistanceAdjustTable(gamma) ; } 376 DistanceAdjustTable(float gamma) { this->buildDistanceAdjustTable(gamma) ; }
367 ~DistanceAdjustTable() { SkDELETE_ARRAY(fTable); } 377 ~DistanceAdjustTable() { SkDELETE_ARRAY(fTable); }
368 378
369 void buildDistanceAdjustTable(float gamma); 379 void buildDistanceAdjustTable(float gamma);
370 380
(...skipping 13 matching lines...) Expand all
384 bool fEnableDFRendering; 394 bool fEnableDFRendering;
385 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable; 395 SkAutoTUnref<DistanceAdjustTable> fDistanceAdjustTable;
386 396
387 friend class GrTextBlobCache; 397 friend class GrTextBlobCache;
388 friend class BitmapTextBatch; 398 friend class BitmapTextBatch;
389 399
390 typedef GrTextContext INHERITED; 400 typedef GrTextContext INHERITED;
391 }; 401 };
392 402
393 #endif 403 #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