Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 #include "GrAtlasTextContext.h" | 7 #include "GrAtlasTextContext.h" |
| 8 | 8 |
| 9 #include "GrAtlas.h" | 9 #include "GrAtlas.h" |
| 10 #include "GrBatch.h" | 10 #include "GrBatch.h" |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1158 } | 1158 } |
| 1159 pos += scalarsPerPosition; | 1159 pos += scalarsPerPosition; |
| 1160 } | 1160 } |
| 1161 } | 1161 } |
| 1162 } | 1162 } |
| 1163 | 1163 |
| 1164 void GrAtlasTextContext::bmpAppendGlyph(BitmapTextBlob* blob, int runIndex, | 1164 void GrAtlasTextContext::bmpAppendGlyph(BitmapTextBlob* blob, int runIndex, |
| 1165 GrGlyph::PackedID packed, | 1165 GrGlyph::PackedID packed, |
| 1166 int vx, int vy, GrColor color, GrFontSca ler* scaler, | 1166 int vx, int vy, GrColor color, GrFontSca ler* scaler, |
| 1167 const SkIRect& clipRect) { | 1167 const SkIRect& clipRect) { |
| 1168 Run& run = blob->fRuns[runIndex]; | |
| 1168 if (!fCurrStrike) { | 1169 if (!fCurrStrike) { |
| 1169 fCurrStrike = fContext->getBatchFontCache()->getStrike(scaler); | 1170 fCurrStrike = fContext->getBatchFontCache()->getStrike(scaler); |
| 1171 run.fStrike.reset(SkRef(fCurrStrike)); | |
| 1170 } | 1172 } |
| 1171 | 1173 |
| 1172 GrGlyph* glyph = fCurrStrike->getGlyph(packed, scaler); | 1174 GrGlyph* glyph = fCurrStrike->getGlyph(packed, scaler); |
| 1173 if (!glyph || glyph->fBounds.isEmpty()) { | 1175 if (!glyph || glyph->fBounds.isEmpty()) { |
| 1174 return; | 1176 return; |
| 1175 } | 1177 } |
| 1176 | 1178 |
| 1177 int x = vx + glyph->fBounds.fLeft; | 1179 int x = vx + glyph->fBounds.fLeft; |
| 1178 int y = vy + glyph->fBounds.fTop; | 1180 int y = vy + glyph->fBounds.fTop; |
| 1179 | 1181 |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1192 return; | 1194 return; |
| 1193 } | 1195 } |
| 1194 #endif | 1196 #endif |
| 1195 | 1197 |
| 1196 // If the glyph is too large we fall back to paths | 1198 // If the glyph is too large we fall back to paths |
| 1197 if (fCurrStrike->glyphTooLargeForAtlas(glyph)) { | 1199 if (fCurrStrike->glyphTooLargeForAtlas(glyph)) { |
| 1198 this->appendGlyphPath(blob, glyph, scaler, vx, vy); | 1200 this->appendGlyphPath(blob, glyph, scaler, vx, vy); |
| 1199 return; | 1201 return; |
| 1200 } | 1202 } |
| 1201 | 1203 |
| 1202 Run& run = blob->fRuns[runIndex]; | |
| 1203 | |
| 1204 GrMaskFormat format = glyph->fMaskFormat; | 1204 GrMaskFormat format = glyph->fMaskFormat; |
| 1205 | 1205 |
| 1206 PerSubRunInfo* subRun = &run.fSubRunInfo.back(); | 1206 PerSubRunInfo* subRun = &run.fSubRunInfo.back(); |
| 1207 if (run.fInitialized && subRun->fMaskFormat != format) { | 1207 if (run.fInitialized && subRun->fMaskFormat != format) { |
| 1208 subRun = &run.fSubRunInfo.push_back(); | 1208 subRun = &run.fSubRunInfo.push_back(); |
| 1209 } | 1209 } |
| 1210 | 1210 |
| 1211 run.fInitialized = true; | 1211 run.fInitialized = true; |
| 1212 | 1212 |
| 1213 size_t vertexStride = get_vertex_stride(format); | 1213 size_t vertexStride = get_vertex_stride(format); |
| 1214 | 1214 |
| 1215 SkRect r; | 1215 SkRect r; |
| 1216 r.fLeft = SkIntToScalar(x); | 1216 r.fLeft = SkIntToScalar(x); |
| 1217 r.fTop = SkIntToScalar(y); | 1217 r.fTop = SkIntToScalar(y); |
| 1218 r.fRight = r.fLeft + SkIntToScalar(width); | 1218 r.fRight = r.fLeft + SkIntToScalar(width); |
| 1219 r.fBottom = r.fTop + SkIntToScalar(height); | 1219 r.fBottom = r.fTop + SkIntToScalar(height); |
| 1220 subRun->fMaskFormat = format; | 1220 subRun->fMaskFormat = format; |
| 1221 this->appendGlyphCommon(blob, &run, subRun, r, color, vertexStride, kA8_GrMa skFormat == format, | 1221 this->appendGlyphCommon(blob, &run, subRun, r, color, vertexStride, kA8_GrMa skFormat == format, |
| 1222 packed); | 1222 glyph); |
| 1223 } | 1223 } |
| 1224 | 1224 |
| 1225 bool GrAtlasTextContext::dfAppendGlyph(BitmapTextBlob* blob, int runIndex, | 1225 bool GrAtlasTextContext::dfAppendGlyph(BitmapTextBlob* blob, int runIndex, |
| 1226 GrGlyph::PackedID packed, | 1226 GrGlyph::PackedID packed, |
| 1227 SkScalar sx, SkScalar sy, GrColor color, | 1227 SkScalar sx, SkScalar sy, GrColor color, |
| 1228 GrFontScaler* scaler, | 1228 GrFontScaler* scaler, |
| 1229 const SkIRect& clipRect, | 1229 const SkIRect& clipRect, |
| 1230 SkScalar textRatio, const SkMatrix& viewM atrix) { | 1230 SkScalar textRatio, const SkMatrix& viewM atrix) { |
| 1231 Run& run = blob->fRuns[runIndex]; | |
| 1231 if (!fCurrStrike) { | 1232 if (!fCurrStrike) { |
| 1232 fCurrStrike = fContext->getBatchFontCache()->getStrike(scaler); | 1233 fCurrStrike = fContext->getBatchFontCache()->getStrike(scaler); |
| 1234 run.fStrike.reset(SkRef(fCurrStrike)); | |
| 1233 } | 1235 } |
| 1234 | 1236 |
| 1235 GrGlyph* glyph = fCurrStrike->getGlyph(packed, scaler); | 1237 GrGlyph* glyph = fCurrStrike->getGlyph(packed, scaler); |
| 1236 if (!glyph || glyph->fBounds.isEmpty()) { | 1238 if (!glyph || glyph->fBounds.isEmpty()) { |
| 1237 return true; | 1239 return true; |
| 1238 } | 1240 } |
| 1239 | 1241 |
| 1240 // fallback to color glyph support | 1242 // fallback to color glyph support |
| 1241 if (kA8_GrMaskFormat != glyph->fMaskFormat) { | 1243 if (kA8_GrMaskFormat != glyph->fMaskFormat) { |
| 1242 return false; | 1244 return false; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 1269 #endif | 1271 #endif |
| 1270 | 1272 |
| 1271 // TODO combine with the above | 1273 // TODO combine with the above |
| 1272 // If the glyph is too large we fall back to paths | 1274 // If the glyph is too large we fall back to paths |
| 1273 if (fCurrStrike->glyphTooLargeForAtlas(glyph)) { | 1275 if (fCurrStrike->glyphTooLargeForAtlas(glyph)) { |
| 1274 this->appendGlyphPath(blob, glyph, scaler, SkScalarRoundToInt(sx - dx), | 1276 this->appendGlyphPath(blob, glyph, scaler, SkScalarRoundToInt(sx - dx), |
| 1275 SkScalarRoundToInt(sy - dy)); | 1277 SkScalarRoundToInt(sy - dy)); |
| 1276 return true; | 1278 return true; |
| 1277 } | 1279 } |
| 1278 | 1280 |
| 1279 Run& run = blob->fRuns[runIndex]; | |
| 1280 | |
| 1281 PerSubRunInfo* subRun = &run.fSubRunInfo.back(); | 1281 PerSubRunInfo* subRun = &run.fSubRunInfo.back(); |
| 1282 SkASSERT(glyph->fMaskFormat == kA8_GrMaskFormat); | 1282 SkASSERT(glyph->fMaskFormat == kA8_GrMaskFormat); |
| 1283 subRun->fMaskFormat = kA8_GrMaskFormat; | 1283 subRun->fMaskFormat = kA8_GrMaskFormat; |
| 1284 | 1284 |
| 1285 size_t vertexStride = get_vertex_stride_df(kA8_GrMaskFormat, subRun->fUseLCD Text); | 1285 size_t vertexStride = get_vertex_stride_df(kA8_GrMaskFormat, subRun->fUseLCD Text); |
| 1286 | 1286 |
| 1287 bool useColorVerts = !subRun->fUseLCDText; | 1287 bool useColorVerts = !subRun->fUseLCDText; |
| 1288 this->appendGlyphCommon(blob, &run, subRun, glyphRect, color, vertexStride, useColorVerts, | 1288 this->appendGlyphCommon(blob, &run, subRun, glyphRect, color, vertexStride, useColorVerts, |
| 1289 packed); | 1289 glyph); |
| 1290 return true; | 1290 return true; |
| 1291 } | 1291 } |
| 1292 | 1292 |
| 1293 inline void GrAtlasTextContext::appendGlyphPath(BitmapTextBlob* blob, GrGlyph* g lyph, | 1293 inline void GrAtlasTextContext::appendGlyphPath(BitmapTextBlob* blob, GrGlyph* g lyph, |
| 1294 GrFontScaler* scaler, int x, int y) { | 1294 GrFontScaler* scaler, int x, int y) { |
| 1295 if (NULL == glyph->fPath) { | 1295 if (NULL == glyph->fPath) { |
| 1296 SkPath* path = SkNEW(SkPath); | 1296 SkPath* path = SkNEW(SkPath); |
| 1297 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { | 1297 if (!scaler->getGlyphPath(glyph->glyphID(), path)) { |
| 1298 // flag the glyph as being dead? | 1298 // flag the glyph as being dead? |
| 1299 SkDELETE(path); | 1299 SkDELETE(path); |
| 1300 return; | 1300 return; |
| 1301 } | 1301 } |
| 1302 glyph->fPath = path; | 1302 glyph->fPath = path; |
| 1303 } | 1303 } |
| 1304 SkASSERT(glyph->fPath); | 1304 SkASSERT(glyph->fPath); |
| 1305 blob->fBigGlyphs.push_back(BitmapTextBlob::BigGlyph(*glyph->fPath, x, y)); | 1305 blob->fBigGlyphs.push_back(BitmapTextBlob::BigGlyph(*glyph->fPath, x, y)); |
| 1306 } | 1306 } |
| 1307 | 1307 |
| 1308 inline void GrAtlasTextContext::appendGlyphCommon(BitmapTextBlob* blob, Run* run , | 1308 inline void GrAtlasTextContext::appendGlyphCommon(BitmapTextBlob* blob, Run* run , |
| 1309 Run::SubRunInfo* subRun, | 1309 Run::SubRunInfo* subRun, |
| 1310 const SkRect& positions, GrCol or color, | 1310 const SkRect& positions, GrCol or color, |
| 1311 size_t vertexStride, bool useV ertexColor, | 1311 size_t vertexStride, bool useV ertexColor, |
| 1312 GrGlyph::PackedID packed) { | 1312 GrGlyph* glyph) { |
| 1313 blob->fGlyphIDs[subRun->fGlyphEndIndex] = packed; | 1313 blob->fGlyphs[subRun->fGlyphEndIndex] = glyph; |
| 1314 run->fVertexBounds.joinNonEmptyArg(positions); | 1314 run->fVertexBounds.joinNonEmptyArg(positions); |
| 1315 run->fColor = color; | 1315 run->fColor = color; |
| 1316 | 1316 |
| 1317 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVertices + subRun->fVert exEndIndex); | 1317 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVertices + subRun->fVert exEndIndex); |
| 1318 | 1318 |
| 1319 // V0 | 1319 // V0 |
| 1320 SkPoint* position = reinterpret_cast<SkPoint*>(vertex); | 1320 SkPoint* position = reinterpret_cast<SkPoint*>(vertex); |
| 1321 position->set(positions.fLeft, positions.fTop); | 1321 position->set(positions.fLeft, positions.fTop); |
| 1322 if (useVertexColor) { | 1322 if (useVertexColor) { |
| 1323 SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint)) ; | 1323 SkColor* colorPtr = reinterpret_cast<SkColor*>(vertex + sizeof(SkPoint)) ; |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1502 drawInfo.setIndicesPerInstance(kIndicesPerGlyph); | 1502 drawInfo.setIndicesPerInstance(kIndicesPerGlyph); |
| 1503 drawInfo.adjustStartVertex(firstVertex); | 1503 drawInfo.adjustStartVertex(firstVertex); |
| 1504 drawInfo.setVertexBuffer(vertexBuffer); | 1504 drawInfo.setVertexBuffer(vertexBuffer); |
| 1505 drawInfo.setIndexBuffer(quadIndexBuffer); | 1505 drawInfo.setIndexBuffer(quadIndexBuffer); |
| 1506 | 1506 |
| 1507 // We cache some values to avoid going to the glyphcache for the same fo ntScaler twice | 1507 // We cache some values to avoid going to the glyphcache for the same fo ntScaler twice |
| 1508 // in a row | 1508 // in a row |
| 1509 const SkDescriptor* desc = NULL; | 1509 const SkDescriptor* desc = NULL; |
| 1510 SkGlyphCache* cache = NULL; | 1510 SkGlyphCache* cache = NULL; |
| 1511 GrFontScaler* scaler = NULL; | 1511 GrFontScaler* scaler = NULL; |
| 1512 GrBatchTextStrike* strike = NULL; | |
| 1513 SkTypeface* typeface = NULL; | 1512 SkTypeface* typeface = NULL; |
| 1514 | 1513 |
| 1515 int instancesToFlush = 0; | 1514 int instancesToFlush = 0; |
| 1516 for (int i = 0; i < instanceCount; i++) { | 1515 for (int i = 0; i < instanceCount; i++) { |
| 1517 Geometry& args = fGeoData[i]; | 1516 Geometry& args = fGeoData[i]; |
| 1518 Blob* blob = args.fBlob; | 1517 Blob* blob = args.fBlob; |
| 1519 Run& run = blob->fRuns[args.fRun]; | 1518 Run& run = blob->fRuns[args.fRun]; |
| 1520 TextInfo& info = run.fSubRunInfo[args.fSubRun]; | 1519 TextInfo& info = run.fSubRunInfo[args.fSubRun]; |
| 1521 | 1520 |
| 1522 uint64_t currentAtlasGen = fFontCache->atlasGeneration(fMaskFormat); | 1521 uint64_t currentAtlasGen = fFontCache->atlasGeneration(fMaskFormat); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 1534 // atlas generation. If we don't end up purging any unused plots, w e can avoid | 1533 // atlas generation. If we don't end up purging any unused plots, w e can avoid |
| 1535 // regenerating the coords. We could take a finer grained approach to updating texture | 1534 // regenerating the coords. We could take a finer grained approach to updating texture |
| 1536 // coords but its not clear if the extra bookkeeping would offset an y gains. | 1535 // coords but its not clear if the extra bookkeeping would offset an y gains. |
| 1537 // To avoid looping over the glyphs twice, we do one loop and condit ionally update color | 1536 // To avoid looping over the glyphs twice, we do one loop and condit ionally update color |
| 1538 // or coords as needed. One final note, if we have to break a run f or an atlas eviction | 1537 // or coords as needed. One final note, if we have to break a run f or an atlas eviction |
| 1539 // then we can't really trust the atlas has all of the correct data. Atlas evictions | 1538 // then we can't really trust the atlas has all of the correct data. Atlas evictions |
| 1540 // should be pretty rare, so we just always regenerate in those case s | 1539 // should be pretty rare, so we just always regenerate in those case s |
| 1541 if (regenerateTextureCoords || regenerateColors || regeneratePositio ns) { | 1540 if (regenerateTextureCoords || regenerateColors || regeneratePositio ns) { |
| 1542 // first regenerate texture coordinates / colors if need be | 1541 // first regenerate texture coordinates / colors if need be |
| 1543 bool brokenRun = false; | 1542 bool brokenRun = false; |
| 1543 | |
|
bsalomon
2015/04/21 12:32:17
Probably should have a parallel (but shorter) comm
| |
| 1544 // Because the GrBatchFontCache may evict the strike a blob depe nds on using for | |
| 1545 // generating its texture coords, we have to track whether or no t the strike has | |
| 1546 // been abandoned. If it hasn't been abandoned, then we can use the GrGlyph*s as is | |
| 1547 // otherwise we have to get the new strike, and use that to get the correct glyphs. | |
| 1548 // Because we do not have the packed ids, and thus can't look up our glyphs in the | |
| 1549 // new strike, we instead keep our ref to the old strike and use the packed ids from | |
| 1550 // it. These ids will still be valid as long as we hold the ref . When we are done | |
| 1551 // updating our cache of the GrGlyph*s, we drop our ref on the o ld strike | |
| 1552 bool regenerateGlyphs = false; | |
| 1553 GrBatchTextStrike* strike = NULL; | |
| 1544 if (regenerateTextureCoords) { | 1554 if (regenerateTextureCoords) { |
| 1545 info.fBulkUseToken.reset(); | 1555 info.fBulkUseToken.reset(); |
| 1546 | 1556 |
| 1547 // We can reuse if we have a valid strike and our descriptor s / typeface are the | 1557 // We can reuse if we have a valid strike and our descriptor s / typeface are the |
| 1548 // same | 1558 // same |
| 1549 const SkDescriptor* newDesc = info.fOverrideDescriptor ? | 1559 const SkDescriptor* newDesc = info.fOverrideDescriptor ? |
| 1550 info.fOverrideDescriptor->getD esc() : | 1560 info.fOverrideDescriptor->getD esc() : |
| 1551 run.fDescriptor.getDesc(); | 1561 run.fDescriptor.getDesc(); |
| 1552 if (!cache || !SkTypeface::Equal(typeface, run.fTypeface) || | 1562 if (!cache || !SkTypeface::Equal(typeface, run.fTypeface) || |
| 1553 !(desc->equals(*newDesc))) { | 1563 !(desc->equals(*newDesc))) { |
| 1554 if (cache) { | 1564 if (cache) { |
| 1555 SkGlyphCache::AttachCache(cache); | 1565 SkGlyphCache::AttachCache(cache); |
| 1556 } | 1566 } |
| 1557 desc = newDesc; | 1567 desc = newDesc; |
| 1558 cache = SkGlyphCache::DetachCache(run.fTypeface, desc); | 1568 cache = SkGlyphCache::DetachCache(run.fTypeface, desc); |
| 1559 scaler = GrTextContext::GetGrFontScaler(cache); | 1569 scaler = GrTextContext::GetGrFontScaler(cache); |
| 1560 strike = fFontCache->getStrike(scaler); | 1570 strike = run.fStrike; |
| 1561 typeface = run.fTypeface; | 1571 typeface = run.fTypeface; |
| 1562 } | 1572 } |
| 1573 | |
| 1574 if (run.fStrike->isAbandoned()) { | |
| 1575 regenerateGlyphs = true; | |
| 1576 strike = fFontCache->getStrike(scaler); | |
| 1577 } else { | |
| 1578 strike = run.fStrike; | |
| 1579 } | |
| 1563 } | 1580 } |
| 1581 | |
| 1564 for (int glyphIdx = 0; glyphIdx < glyphCount; glyphIdx++) { | 1582 for (int glyphIdx = 0; glyphIdx < glyphCount; glyphIdx++) { |
| 1565 GrGlyph::PackedID glyphID = blob->fGlyphIDs[glyphIdx + info. fGlyphStartIndex]; | |
| 1566 | |
| 1567 if (regenerateTextureCoords) { | 1583 if (regenerateTextureCoords) { |
| 1568 // Upload the glyph only if needed | 1584 size_t glyphOffset = glyphIdx + info.fGlyphStartIndex; |
| 1569 GrGlyph* glyph = strike->getGlyph(glyphID, scaler); | 1585 GrGlyph* glyph; |
| 1586 if (regenerateGlyphs) { | |
| 1587 // Get the id from the old glyph, and use the new st rike to lookup | |
| 1588 // the glyph. | |
| 1589 glyph = blob->fGlyphs[glyphOffset]; | |
| 1590 blob->fGlyphs[glyphOffset] = strike->getGlyph(glyph- >fPackedID, | |
| 1591 scaler ); | |
| 1592 } | |
| 1593 glyph = blob->fGlyphs[glyphOffset]; | |
| 1570 SkASSERT(glyph); | 1594 SkASSERT(glyph); |
| 1571 | 1595 |
| 1572 if (!fFontCache->hasGlyph(glyph) && | 1596 if (!fFontCache->hasGlyph(glyph) && |
| 1573 !strike->addGlyphToAtlas(batchTarget, glyph, scaler) ) { | 1597 !strike->addGlyphToAtlas(batchTarget, glyph, scaler) ) { |
| 1574 this->flush(batchTarget, &drawInfo, instancesToFlush , | 1598 this->flush(batchTarget, &drawInfo, instancesToFlush , |
| 1575 maxInstancesPerDraw); | 1599 maxInstancesPerDraw); |
| 1576 this->initDraw(batchTarget, gp, pipeline); | 1600 this->initDraw(batchTarget, gp, pipeline); |
| 1577 instancesToFlush = 0; | 1601 instancesToFlush = 0; |
| 1578 brokenRun = glyphIdx > 0; | 1602 brokenRun = glyphIdx > 0; |
| 1579 | 1603 |
| 1580 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas( batchTarget, glyph, | 1604 SkDEBUGCODE(bool success =) strike->addGlyphToAtlas( batchTarget, |
| 1605 glyph, | |
| 1581 scaler); | 1606 scaler); |
| 1582 SkASSERT(success); | 1607 SkASSERT(success); |
| 1583 } | 1608 } |
| 1584 fFontCache->addGlyphToBulkAndSetUseToken(&info.fBulkUseT oken, glyph, | 1609 fFontCache->addGlyphToBulkAndSetUseToken(&info.fBulkUseT oken, glyph, |
| 1585 batchTarget->cu rrentToken()); | 1610 batchTarget->cu rrentToken()); |
| 1586 | 1611 |
| 1587 // Texture coords are the last vertex attribute so we ge t a pointer to the | 1612 // Texture coords are the last vertex attribute so we ge t a pointer to the |
| 1588 // first one and then map with stride in regenerateTextu reCoords | 1613 // first one and then map with stride in regenerateTextu reCoords |
| 1589 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVert ices); | 1614 intptr_t vertex = reinterpret_cast<intptr_t>(blob->fVert ices); |
| 1590 vertex += info.fVertexStartIndex; | 1615 vertex += info.fVertexStartIndex; |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 1608 SkScalar transX = args.fTransX; | 1633 SkScalar transX = args.fTransX; |
| 1609 SkScalar transY = args.fTransY; | 1634 SkScalar transY = args.fTransY; |
| 1610 this->regeneratePositions(vertex, vertexStride, transX, transY); | 1635 this->regeneratePositions(vertex, vertexStride, transX, transY); |
| 1611 } | 1636 } |
| 1612 instancesToFlush++; | 1637 instancesToFlush++; |
| 1613 } | 1638 } |
| 1614 | 1639 |
| 1615 // We my have changed the color so update it here | 1640 // We my have changed the color so update it here |
| 1616 run.fColor = args.fColor; | 1641 run.fColor = args.fColor; |
| 1617 if (regenerateTextureCoords) { | 1642 if (regenerateTextureCoords) { |
| 1643 if (regenerateGlyphs) { | |
| 1644 run.fStrike.reset(SkRef(strike)); | |
| 1645 } | |
| 1618 info.fAtlasGeneration = brokenRun ? GrBatchAtlas::kInvalidAt lasGeneration : | 1646 info.fAtlasGeneration = brokenRun ? GrBatchAtlas::kInvalidAt lasGeneration : |
| 1619 fFontCache->atlasGenerat ion(fMaskFormat); | 1647 fFontCache->atlasGenerat ion(fMaskFormat); |
| 1620 } | 1648 } |
| 1621 } else { | 1649 } else { |
| 1622 instancesToFlush += glyphCount; | 1650 instancesToFlush += glyphCount; |
| 1623 | 1651 |
| 1624 // set use tokens for all of the glyphs in our subrun. This is only valid if we | 1652 // set use tokens for all of the glyphs in our subrun. This is only valid if we |
| 1625 // have a valid atlas generation | 1653 // have a valid atlas generation |
| 1626 fFontCache->setUseTokenBulk(info.fBulkUseToken, | 1654 fFontCache->setUseTokenBulk(info.fBulkUseToken, |
| 1627 batchTarget->currentToken(), | 1655 batchTarget->currentToken(), |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2090 pipelineBuilder.setFromPaint(grPaint, rt, clip); | 2118 pipelineBuilder.setFromPaint(grPaint, rt, clip); |
| 2091 | 2119 |
| 2092 GrColor color = grPaint.getColor(); | 2120 GrColor color = grPaint.getColor(); |
| 2093 for (int run = 0; run < cacheBlob->fRunCount; run++) { | 2121 for (int run = 0; run < cacheBlob->fRunCount; run++) { |
| 2094 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk Paint); | 2122 this->flushRun(target, &pipelineBuilder, cacheBlob, run, color, 0, 0, sk Paint); |
| 2095 } | 2123 } |
| 2096 | 2124 |
| 2097 // Now flush big glyphs | 2125 // Now flush big glyphs |
| 2098 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); | 2126 this->flushBigGlyphs(cacheBlob, rt, grPaint, clip, 0, 0); |
| 2099 } | 2127 } |
| OLD | NEW |