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

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

Issue 1698503002: Remove last bit of privacy violation for GrAtlasTextBlob (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase + nits 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/batches/GrAtlasTextBatch.cpp ('k') | src/gpu/text/GrAtlasTextBlob_regenInBatch.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 GrAtlasTextBlob_DEFINED 8 #ifndef GrAtlasTextBlob_DEFINED
9 #define GrAtlasTextBlob_DEFINED 9 #define GrAtlasTextBlob_DEFINED
10 10
11 #include "GrBatchAtlas.h" 11 #include "GrBatchAtlas.h"
12 #include "GrBatchFontCache.h" 12 #include "GrBatchFontCache.h"
13 #include "GrColor.h" 13 #include "GrColor.h"
14 #include "GrMemoryPool.h" 14 #include "GrMemoryPool.h"
15 #include "SkDescriptor.h" 15 #include "SkDescriptor.h"
16 #include "SkMaskFilter.h" 16 #include "SkMaskFilter.h"
17 #include "SkSurfaceProps.h" 17 #include "SkSurfaceProps.h"
18 #include "SkTInternalLList.h" 18 #include "SkTInternalLList.h"
19 19
20 class GrBlobRegenHelper;
20 struct GrDistanceFieldAdjustTable; 21 struct GrDistanceFieldAdjustTable;
21 class GrMemoryPool; 22 class GrMemoryPool;
22 class GrTextContext; 23 class GrTextContext;
23 class SkDrawFilter; 24 class SkDrawFilter;
24 class SkTextBlob; 25 class SkTextBlob;
25 class SkTextBlobRunIterator; 26 class SkTextBlobRunIterator;
26 27
27 // With this flag enabled, the GrAtlasTextContext will, as a sanity check, regen erate every blob 28 // With this flag enabled, the GrAtlasTextContext will, as a sanity check, regen erate every blob
28 // that comes in to verify the integrity of its cache 29 // that comes in to verify the integrity of its cache
29 #define CACHE_SANITY_CHECK 0 30 #define CACHE_SANITY_CHECK 0
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 void* operator new(size_t, void* p) { return p; } 102 void* operator new(size_t, void* p) { return p; }
102 void operator delete(void* target, void* placement) { 103 void operator delete(void* target, void* placement) {
103 ::operator delete(target, placement); 104 ::operator delete(target, placement);
104 } 105 }
105 106
106 bool hasDistanceField() const { return SkToBool(fTextType & kHasDistanceFiel d_TextType); } 107 bool hasDistanceField() const { return SkToBool(fTextType & kHasDistanceFiel d_TextType); }
107 bool hasBitmap() const { return SkToBool(fTextType & kHasBitmap_TextType); } 108 bool hasBitmap() const { return SkToBool(fTextType & kHasBitmap_TextType); }
108 void setHasDistanceField() { fTextType |= kHasDistanceField_TextType; } 109 void setHasDistanceField() { fTextType |= kHasDistanceField_TextType; }
109 void setHasBitmap() { fTextType |= kHasBitmap_TextType; } 110 void setHasBitmap() { fTextType |= kHasBitmap_TextType; }
110 111
112 int runCount() const { return fRunCount; }
113
111 void push_back_run(int currRun) { 114 void push_back_run(int currRun) {
112 SkASSERT(currRun < fRunCount); 115 SkASSERT(currRun < fRunCount);
113 if (currRun > 0) { 116 if (currRun > 0) {
114 Run::SubRunInfo& newRun = fRuns[currRun].fSubRunInfo.back(); 117 Run::SubRunInfo& newRun = fRuns[currRun].fSubRunInfo.back();
115 Run::SubRunInfo& lastRun = fRuns[currRun - 1].fSubRunInfo.back(); 118 Run::SubRunInfo& lastRun = fRuns[currRun - 1].fSubRunInfo.back();
116 newRun.setAsSuccessor(lastRun); 119 newRun.setAsSuccessor(lastRun);
117 } 120 }
118 } 121 }
119 122
120 // sets the last subrun of runIndex to use distance field text 123 // sets the last subrun of runIndex to use distance field text
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 // We use this color vs the SkPaint color because it has the colorfilter app lied. 251 // We use this color vs the SkPaint color because it has the colorfilter app lied.
249 void initReusableBlob(GrColor color, const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { 252 void initReusableBlob(GrColor color, const SkMatrix& viewMatrix, SkScalar x, SkScalar y) {
250 fPaintColor = color; 253 fPaintColor = color;
251 this->setupViewMatrix(viewMatrix, x, y); 254 this->setupViewMatrix(viewMatrix, x, y);
252 } 255 }
253 256
254 void initThrowawayBlob(const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { 257 void initThrowawayBlob(const SkMatrix& viewMatrix, SkScalar x, SkScalar y) {
255 this->setupViewMatrix(viewMatrix, x, y); 258 this->setupViewMatrix(viewMatrix, x, y);
256 } 259 }
257 260
261 void regenInBatch(GrDrawBatch::Target* target, GrBatchFontCache* fontCache,
262 GrBlobRegenHelper *helper, int run, int subRun, SkGlyphCac he** cache,
263 SkTypeface** typeface, GrFontScaler** scaler,
264 const SkDescriptor** desc, size_t vertexStride,
265 GrColor color, SkScalar transX, SkScalar transY,
266 void** vertices, size_t* byteCount, int* glyphCount);
267
258 const Key& key() const { return fKey; } 268 const Key& key() const { return fKey; }
259 269
260 ~GrAtlasTextBlob() { 270 ~GrAtlasTextBlob() {
261 for (int i = 0; i < fRunCount; i++) { 271 for (int i = 0; i < fRunCount; i++) {
262 fRuns[i].~Run(); 272 fRuns[i].~Run();
263 } 273 }
264 } 274 }
265 275
266 //////////////////////////////////////////////////////////////////////////// //////////////////// 276 //////////////////////////////////////////////////////////////////////////// ////////////////////
267 // Internal test methods 277 // Internal test methods
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 456
447 // Distance field text cannot draw coloremoji, and so has to fall back. However, 457 // Distance field text cannot draw coloremoji, and so has to fall back. However,
448 // though the distance field text and the coloremoji may share the same run, they 458 // though the distance field text and the coloremoji may share the same run, they
449 // will have different descriptors. If fOverrideDescriptor is non-nullp tr, then it 459 // will have different descriptors. If fOverrideDescriptor is non-nullp tr, then it
450 // will be used in place of the run's descriptor to regen texture coords 460 // will be used in place of the run's descriptor to regen texture coords
451 SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; // df properties 461 SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; // df properties
452 bool fInitialized; 462 bool fInitialized;
453 bool fDrawAsPaths; 463 bool fDrawAsPaths;
454 }; 464 };
455 465
466 template <bool regenPos, bool regenCol, bool regenTexCoords, bool regenGlyph s>
467 void regenInBatch(GrDrawBatch::Target* target,
468 GrBatchFontCache* fontCache,
469 GrBlobRegenHelper* helper,
470 Run* run, Run::SubRunInfo* info, SkGlyphCache** cache,
471 SkTypeface** typeface, GrFontScaler** scaler,
472 const SkDescriptor** desc,
473 int glyphCount, size_t vertexStride,
474 GrColor color, SkScalar transX,
475 SkScalar transY) const;
476
456 inline GrDrawBatch* createBatch(const Run::SubRunInfo& info, 477 inline GrDrawBatch* createBatch(const Run::SubRunInfo& info,
457 int glyphCount, int run, int subRun, 478 int glyphCount, int run, int subRun,
458 GrColor color, SkScalar transX, SkScalar tra nsY, 479 GrColor color, SkScalar transX, SkScalar tra nsY,
459 const SkPaint& skPaint, const SkSurfaceProps & props, 480 const SkPaint& skPaint, const SkSurfaceProps & props,
460 const GrDistanceFieldAdjustTable* distanceAd justTable, 481 const GrDistanceFieldAdjustTable* distanceAd justTable,
461 GrBatchFontCache* cache); 482 GrBatchFontCache* cache);
462 483
463 struct BigGlyph { 484 struct BigGlyph {
464 BigGlyph(const SkPath& path, SkScalar vx, SkScalar vy, SkScalar scale, b ool applyVM) 485 BigGlyph(const SkPath& path, SkScalar vx, SkScalar vy, SkScalar scale, b ool applyVM)
465 : fPath(path) 486 : fPath(path)
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 SkScalar fX; 524 SkScalar fX;
504 SkScalar fY; 525 SkScalar fY;
505 526
506 // We can reuse distance field text, but only if the new viewmatrix would no t result in 527 // We can reuse distance field text, but only if the new viewmatrix would no t result in
507 // a mip change. Because there can be multiple runs in a blob, we track the overall 528 // a mip change. Because there can be multiple runs in a blob, we track the overall
508 // maximum minimum scale, and minimum maximum scale, we can support before w e need to regen 529 // maximum minimum scale, and minimum maximum scale, we can support before w e need to regen
509 SkScalar fMaxMinScale; 530 SkScalar fMaxMinScale;
510 SkScalar fMinMaxScale; 531 SkScalar fMinMaxScale;
511 int fRunCount; 532 int fRunCount;
512 uint8_t fTextType; 533 uint8_t fTextType;
513
514 friend class GrAtlasTextBatch; // We might be able to get rid of this friend ing
515 }; 534 };
516 535
517 #endif 536 #endif
OLDNEW
« no previous file with comments | « src/gpu/batches/GrAtlasTextBatch.cpp ('k') | src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698