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