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

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

Issue 1257253005: Move strike to subrun in GrAtlasTextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak Created 5 years, 4 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 GrAtlasTextBlob_DEFINED 8 #ifndef GrAtlasTextBlob_DEFINED
9 #define GrAtlasTextBlob_DEFINED 9 #define GrAtlasTextBlob_DEFINED
10 10
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 fSubRunInfo.push_back(); 71 fSubRunInfo.push_back();
72 } 72 }
73 struct SubRunInfo { 73 struct SubRunInfo {
74 SubRunInfo() 74 SubRunInfo()
75 : fAtlasGeneration(GrBatchAtlas::kInvalidAtlasGeneration) 75 : fAtlasGeneration(GrBatchAtlas::kInvalidAtlasGeneration)
76 , fVertexStartIndex(0) 76 , fVertexStartIndex(0)
77 , fVertexEndIndex(0) 77 , fVertexEndIndex(0)
78 , fGlyphStartIndex(0) 78 , fGlyphStartIndex(0)
79 , fGlyphEndIndex(0) 79 , fGlyphEndIndex(0)
80 , fDrawAsDistanceFields(false) {} 80 , fDrawAsDistanceFields(false) {}
81 SubRunInfo(const SubRunInfo& that)
82 : fBulkUseToken(that.fBulkUseToken)
83 , fStrike(SkSafeRef(that.fStrike.get()))
84 , fAtlasGeneration(that.fAtlasGeneration)
85 , fVertexStartIndex(that.fVertexStartIndex)
86 , fVertexEndIndex(that.fVertexEndIndex)
87 , fGlyphStartIndex(that.fGlyphStartIndex)
88 , fGlyphEndIndex(that.fGlyphEndIndex)
89 , fTextRatio(that.fTextRatio)
90 , fMaskFormat(that.fMaskFormat)
91 , fDrawAsDistanceFields(that.fDrawAsDistanceFields)
92 , fUseLCDText(that.fUseLCDText) {
93 }
81 // Distance field text cannot draw coloremoji, and so has to fall ba ck. However, 94 // Distance field text cannot draw coloremoji, and so has to fall ba ck. However,
82 // though the distance field text and the coloremoji may share the s ame run, they 95 // though the distance field text and the coloremoji may share the s ame run, they
83 // will have different descriptors. If fOverrideDescriptor is non-N ULL, then it 96 // will have different descriptors. If fOverrideDescriptor is non-N ULL, then it
84 // will be used in place of the run's descriptor to regen texture co ords 97 // will be used in place of the run's descriptor to regen texture co ords
85 // TODO we could have a descriptor cache, it would reduce the size o f these blobs 98 // TODO we could have a descriptor cache, it would reduce the size o f these blobs
86 // significantly, and then the subrun could just have a refed pointe r to the 99 // significantly, and then the subrun could just have a refed pointe r to the
87 // correct descriptor. 100 // correct descriptor.
88 GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken; 101 GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken;
102 SkAutoTUnref<GrBatchTextStrike> fStrike;
89 uint64_t fAtlasGeneration; 103 uint64_t fAtlasGeneration;
90 size_t fVertexStartIndex; 104 size_t fVertexStartIndex;
91 size_t fVertexEndIndex; 105 size_t fVertexEndIndex;
92 uint32_t fGlyphStartIndex; 106 uint32_t fGlyphStartIndex;
93 uint32_t fGlyphEndIndex; 107 uint32_t fGlyphEndIndex;
94 SkScalar fTextRatio; // df property 108 SkScalar fTextRatio; // df property
95 GrMaskFormat fMaskFormat; 109 GrMaskFormat fMaskFormat;
96 bool fDrawAsDistanceFields; // df property 110 bool fDrawAsDistanceFields; // df property
97 bool fUseLCDText; // df property 111 bool fUseLCDText; // df property
98 }; 112 };
99 113
100 SubRunInfo& push_back() { 114 SubRunInfo& push_back() {
101 // Forward glyph / vertex information to seed the new sub run 115 // Forward glyph / vertex information to seed the new sub run
102 SubRunInfo& newSubRun = fSubRunInfo.push_back(); 116 SubRunInfo& newSubRun = fSubRunInfo.push_back();
103 SubRunInfo& prevSubRun = fSubRunInfo.fromBack(1); 117 SubRunInfo& prevSubRun = fSubRunInfo.fromBack(1);
104 118
105 newSubRun.fGlyphStartIndex = prevSubRun.fGlyphEndIndex; 119 newSubRun.fGlyphStartIndex = prevSubRun.fGlyphEndIndex;
106 newSubRun.fGlyphEndIndex = prevSubRun.fGlyphEndIndex; 120 newSubRun.fGlyphEndIndex = prevSubRun.fGlyphEndIndex;
107 121
108 newSubRun.fVertexStartIndex = prevSubRun.fVertexEndIndex; 122 newSubRun.fVertexStartIndex = prevSubRun.fVertexEndIndex;
109 newSubRun.fVertexEndIndex = prevSubRun.fVertexEndIndex; 123 newSubRun.fVertexEndIndex = prevSubRun.fVertexEndIndex;
110 return newSubRun; 124 return newSubRun;
111 } 125 }
112 static const int kMinSubRuns = 1; 126 static const int kMinSubRuns = 1;
113 SkAutoTUnref<GrBatchTextStrike> fStrike;
114 SkAutoTUnref<SkTypeface> fTypeface; 127 SkAutoTUnref<SkTypeface> fTypeface;
115 SkRect fVertexBounds; 128 SkRect fVertexBounds;
116 SkSTArray<kMinSubRuns, SubRunInfo> fSubRunInfo; 129 SkSTArray<kMinSubRuns, SubRunInfo> fSubRunInfo;
117 SkAutoDescriptor fDescriptor; 130 SkAutoDescriptor fDescriptor;
118 SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; // df properties 131 SkAutoTDelete<SkAutoDescriptor> fOverrideDescriptor; // df properties
119 GrColor fColor; 132 GrColor fColor;
120 bool fInitialized; 133 bool fInitialized;
121 bool fDrawAsPaths; 134 bool fDrawAsPaths;
122 }; 135 };
123 136
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 void setHasDistanceField() { fTextType |= kHasDistanceField_TextType; } 234 void setHasDistanceField() { fTextType |= kHasDistanceField_TextType; }
222 void setHasBitmap() { fTextType |= kHasBitmap_TextType; } 235 void setHasBitmap() { fTextType |= kHasBitmap_TextType; }
223 236
224 #ifdef CACHE_SANITY_CHECK 237 #ifdef CACHE_SANITY_CHECK
225 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); 238 static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&);
226 size_t fSize; 239 size_t fSize;
227 #endif 240 #endif
228 }; 241 };
229 242
230 #endif 243 #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