aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gpu/GrAtlasTextBlob.h15
-rw-r--r--src/gpu/GrAtlasTextContext.cpp19
-rw-r--r--src/gpu/GrBatchAtlas.h5
3 files changed, 31 insertions, 8 deletions
diff --git a/src/gpu/GrAtlasTextBlob.h b/src/gpu/GrAtlasTextBlob.h
index 502177d0d2..390f1bbc51 100644
--- a/src/gpu/GrAtlasTextBlob.h
+++ b/src/gpu/GrAtlasTextBlob.h
@@ -78,6 +78,19 @@ struct GrAtlasTextBlob : public SkRefCnt {
, fGlyphStartIndex(0)
, fGlyphEndIndex(0)
, fDrawAsDistanceFields(false) {}
+ SubRunInfo(const SubRunInfo& that)
+ : fBulkUseToken(that.fBulkUseToken)
+ , fStrike(SkRef(that.fStrike.get()))
+ , fAtlasGeneration(that.fAtlasGeneration)
+ , fVertexStartIndex(that.fVertexStartIndex)
+ , fVertexEndIndex(that.fVertexEndIndex)
+ , fGlyphStartIndex(that.fGlyphStartIndex)
+ , fGlyphEndIndex(that.fGlyphEndIndex)
+ , fTextRatio(that.fTextRatio)
+ , fMaskFormat(that.fMaskFormat)
+ , fDrawAsDistanceFields(that.fDrawAsDistanceFields)
+ , fUseLCDText(that.fUseLCDText) {
+ }
// Distance field text cannot draw coloremoji, and so has to fall back. However,
// though the distance field text and the coloremoji may share the same run, they
// will have different descriptors. If fOverrideDescriptor is non-NULL, then it
@@ -86,6 +99,7 @@ struct GrAtlasTextBlob : public SkRefCnt {
// significantly, and then the subrun could just have a refed pointer to the
// correct descriptor.
GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken;
+ SkAutoTUnref<GrBatchTextStrike> fStrike;
uint64_t fAtlasGeneration;
size_t fVertexStartIndex;
size_t fVertexEndIndex;
@@ -110,7 +124,6 @@ struct GrAtlasTextBlob : public SkRefCnt {
return newSubRun;
}
static const int kMinSubRuns = 1;
- SkAutoTUnref<GrBatchTextStrike> fStrike;
SkAutoTUnref<SkTypeface> fTypeface;
SkRect fVertexBounds;
SkSTArray<kMinSubRuns, SubRunInfo> fSubRunInfo;
diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp
index f5976392cc..6f8d119636 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);
diff --git a/src/gpu/GrBatchAtlas.h b/src/gpu/GrBatchAtlas.h
index ce3e40aec4..96d229810b 100644
--- a/src/gpu/GrBatchAtlas.h
+++ b/src/gpu/GrBatchAtlas.h
@@ -67,6 +67,11 @@ public:
class BulkUseTokenUpdater {
public:
BulkUseTokenUpdater() : fPlotAlreadyUpdated(0) {}
+ BulkUseTokenUpdater(const BulkUseTokenUpdater& that)
+ : fPlotsToUpdate(that.fPlotsToUpdate)
+ , fPlotAlreadyUpdated(that.fPlotAlreadyUpdated) {
+ }
+
void add(AtlasID id) {
int index = GrBatchAtlas::GetIndexFromID(id);
if (!this->find(index)) {