OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 #include "GrAtlasTextBlob.h" | 8 #include "GrAtlasTextBlob.h" |
9 | 9 |
10 #include "GrBatchFlushState.h" | 10 #include "GrBatchFlushState.h" |
| 11 #include "GrTextUtils.h" |
11 | 12 |
12 #include "SkDistanceFieldGen.h" | 13 #include "SkDistanceFieldGen.h" |
13 #include "SkGlyphCache.h" | 14 #include "SkGlyphCache.h" |
14 | 15 |
15 #include "batches/GrAtlasTextBatch.h" | 16 #include "batches/GrAtlasTextBatch.h" |
16 | 17 |
17 ////////////////////////////////////////////////////////////////////////////////
//////////////////// | 18 ////////////////////////////////////////////////////////////////////////////////
//////////////////// |
18 // A large template to handle regenerating the vertices of a textblob with as fe
w branches as | 19 // A large template to handle regenerating the vertices of a textblob with as fe
w branches as |
19 // possible | 20 // possible |
20 template <bool regenPos, bool regenCol, bool regenTexCoords> | 21 template <bool regenPos, bool regenCol, bool regenTexCoords> |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 const SkDescriptor* newDesc = (run->fOverrideDescriptor && !info->drawAs
DistanceFields()) ? | 140 const SkDescriptor* newDesc = (run->fOverrideDescriptor && !info->drawAs
DistanceFields()) ? |
140 run->fOverrideDescriptor->getDesc() : | 141 run->fOverrideDescriptor->getDesc() : |
141 run->fDescriptor.getDesc(); | 142 run->fDescriptor.getDesc(); |
142 if (!*cache || !SkTypeface::Equal(*typeface, run->fTypeface) || | 143 if (!*cache || !SkTypeface::Equal(*typeface, run->fTypeface) || |
143 !((*desc)->equals(*newDesc))) { | 144 !((*desc)->equals(*newDesc))) { |
144 if (*cache) { | 145 if (*cache) { |
145 SkGlyphCache::AttachCache(*cache); | 146 SkGlyphCache::AttachCache(*cache); |
146 } | 147 } |
147 *desc = newDesc; | 148 *desc = newDesc; |
148 *cache = SkGlyphCache::DetachCache(run->fTypeface, *desc); | 149 *cache = SkGlyphCache::DetachCache(run->fTypeface, *desc); |
149 *scaler = GrTextContext::GetGrFontScaler(*cache); | 150 *scaler = GrTextUtils::GetGrFontScaler(*cache); |
150 *typeface = run->fTypeface; | 151 *typeface = run->fTypeface; |
151 } | 152 } |
152 | 153 |
153 if (regenGlyphs) { | 154 if (regenGlyphs) { |
154 strike = fontCache->getStrike(*scaler); | 155 strike = fontCache->getStrike(*scaler); |
155 } else { | 156 } else { |
156 strike = info->strike(); | 157 strike = info->strike(); |
157 } | 158 } |
158 } | 159 } |
159 | 160 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 // set use tokens for all of the glyphs in our subrun. This is only
valid if we | 286 // set use tokens for all of the glyphs in our subrun. This is only
valid if we |
286 // have a valid atlas generation | 287 // have a valid atlas generation |
287 fontCache->setUseTokenBulk(*info.bulkUseToken(), target->currentToke
n(), | 288 fontCache->setUseTokenBulk(*info.bulkUseToken(), target->currentToke
n(), |
288 info.maskFormat()); | 289 info.maskFormat()); |
289 break; | 290 break; |
290 } | 291 } |
291 | 292 |
292 *byteCount = info.byteCount(); | 293 *byteCount = info.byteCount(); |
293 *vertices = fVertices + info.vertexStartIndex(); | 294 *vertices = fVertices + info.vertexStartIndex(); |
294 } | 295 } |
OLD | NEW |