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

Unified Diff: src/gpu/GrAtlasTextContext.cpp

Issue 1257253005: Move strike to subrun in GrAtlasTextContext (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrAtlasTextBlob.h ('k') | src/gpu/GrBatchAtlas.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAtlasTextContext.cpp
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index f5976392cc64107fae2dbfa41cbaddb67e77c75d..6f8d1196368ca992242abcb993b15ba4003ee3df 100644
--- a/src/gpu/GrAtlasTextContext.cpp
+++ b/src/gpu/GrAtlasTextContext.cpp
@@ -1221,7 +1221,6 @@ void GrAtlasTextContext::bmpAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
Run& run = blob->fRuns[runIndex];
if (!fCurrStrike) {
fCurrStrike = fContext->getBatchFontCache()->getStrike(scaler);
- run.fStrike.reset(SkRef(fCurrStrike));
}
GrGlyph::PackedID id = GrGlyph::Pack(skGlyph.getGlyphID(),
@@ -1263,6 +1262,9 @@ void GrAtlasTextContext::bmpAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
PerSubRunInfo* subRun = &run.fSubRunInfo.back();
if (run.fInitialized && subRun->fMaskFormat != format) {
subRun = &run.push_back();
+ subRun->fStrike.reset(SkRef(fCurrStrike));
+ } else if (!run.fInitialized) {
+ subRun->fStrike.reset(SkRef(fCurrStrike));
}
run.fInitialized = true;
@@ -1288,7 +1290,6 @@ bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
Run& run = blob->fRuns[runIndex];
if (!fCurrStrike) {
fCurrStrike = fContext->getBatchFontCache()->getStrike(scaler);
- run.fStrike.reset(SkRef(fCurrStrike));
}
GrGlyph::PackedID id = GrGlyph::Pack(skGlyph.getGlyphID(),
@@ -1339,6 +1340,10 @@ bool GrAtlasTextContext::dfAppendGlyph(GrAtlasTextBlob* blob, int runIndex,
}
PerSubRunInfo* subRun = &run.fSubRunInfo.back();
+ if (!run.fInitialized) {
+ subRun->fStrike.reset(SkRef(fCurrStrike));
+ }
+ run.fInitialized = true;
SkASSERT(glyph->fMaskFormat == kA8_GrMaskFormat);
subRun->fMaskFormat = kA8_GrMaskFormat;
@@ -1603,7 +1608,7 @@ public:
uint64_t currentAtlasGen = fFontCache->atlasGeneration(maskFormat);
bool regenerateTextureCoords = info.fAtlasGeneration != currentAtlasGen ||
- run.fStrike->isAbandoned();
+ info.fStrike->isAbandoned();
bool regenerateColors;
if (usesDistanceFields) {
regenerateColors = !isLCD && run.fColor != args.fColor;
@@ -1651,15 +1656,15 @@ public:
desc = newDesc;
cache = SkGlyphCache::DetachCache(run.fTypeface, desc);
scaler = GrTextContext::GetGrFontScaler(cache);
- strike = run.fStrike;
+ strike = info.fStrike;
typeface = run.fTypeface;
}
- if (run.fStrike->isAbandoned()) {
+ if (info.fStrike->isAbandoned()) {
regenerateGlyphs = true;
strike = fFontCache->getStrike(scaler);
} else {
- strike = run.fStrike;
+ strike = info.fStrike;
}
}
@@ -1732,7 +1737,7 @@ public:
run.fColor = args.fColor;
if (regenerateTextureCoords) {
if (regenerateGlyphs) {
- run.fStrike.reset(SkRef(strike));
+ info.fStrike.reset(SkRef(strike));
}
info.fAtlasGeneration = brokenRun ? GrBatchAtlas::kInvalidAtlasGeneration :
fFontCache->atlasGeneration(maskFormat);
« no previous file with comments | « src/gpu/GrAtlasTextBlob.h ('k') | src/gpu/GrBatchAtlas.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698