From da9ccf175430fd9337355334503aedb464676078 Mon Sep 17 00:00:00 2001 From: joshualitt Date: Fri, 31 Jul 2015 14:07:50 -0700 Subject: Revert of Move strike to subrun in GrAtlasTextContext (patchset #3 id:40001 of https://codereview.chromium.org/1257253005/) Reason for revert: breaking bots Original issue's description: > Move strike to subrun in GrAtlasTextContext > > BUG=skia: > > Committed: https://skia.googlesource.com/skia/+/77d89f7dd243a17452d3a5f16a98622993e6bdd9 TBR=bsalomon@google.com,robertphillips@google.com,jvanverth@google.com,joshualitt@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=skia: Review URL: https://codereview.chromium.org/1266253002 --- src/gpu/GrAtlasTextBlob.h | 15 +-------------- src/gpu/GrAtlasTextContext.cpp | 19 +++++++------------ src/gpu/GrBatchAtlas.h | 5 ----- 3 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/gpu/GrAtlasTextBlob.h b/src/gpu/GrAtlasTextBlob.h index 390f1bbc51..502177d0d2 100644 --- a/src/gpu/GrAtlasTextBlob.h +++ b/src/gpu/GrAtlasTextBlob.h @@ -78,19 +78,6 @@ 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 @@ -99,7 +86,6 @@ struct GrAtlasTextBlob : public SkRefCnt { // significantly, and then the subrun could just have a refed pointer to the // correct descriptor. GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken; - SkAutoTUnref fStrike; uint64_t fAtlasGeneration; size_t fVertexStartIndex; size_t fVertexEndIndex; @@ -124,6 +110,7 @@ struct GrAtlasTextBlob : public SkRefCnt { return newSubRun; } static const int kMinSubRuns = 1; + SkAutoTUnref fStrike; SkAutoTUnref fTypeface; SkRect fVertexBounds; SkSTArray fSubRunInfo; diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp index 6f8d119636..f5976392cc 100644 --- a/src/gpu/GrAtlasTextContext.cpp +++ b/src/gpu/GrAtlasTextContext.cpp @@ -1221,6 +1221,7 @@ 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(), @@ -1262,9 +1263,6 @@ 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; @@ -1290,6 +1288,7 @@ 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(), @@ -1340,10 +1339,6 @@ 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; @@ -1608,7 +1603,7 @@ public: uint64_t currentAtlasGen = fFontCache->atlasGeneration(maskFormat); bool regenerateTextureCoords = info.fAtlasGeneration != currentAtlasGen || - info.fStrike->isAbandoned(); + run.fStrike->isAbandoned(); bool regenerateColors; if (usesDistanceFields) { regenerateColors = !isLCD && run.fColor != args.fColor; @@ -1656,15 +1651,15 @@ public: desc = newDesc; cache = SkGlyphCache::DetachCache(run.fTypeface, desc); scaler = GrTextContext::GetGrFontScaler(cache); - strike = info.fStrike; + strike = run.fStrike; typeface = run.fTypeface; } - if (info.fStrike->isAbandoned()) { + if (run.fStrike->isAbandoned()) { regenerateGlyphs = true; strike = fFontCache->getStrike(scaler); } else { - strike = info.fStrike; + strike = run.fStrike; } } @@ -1737,7 +1732,7 @@ public: run.fColor = args.fColor; if (regenerateTextureCoords) { if (regenerateGlyphs) { - info.fStrike.reset(SkRef(strike)); + run.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 96d229810b..ce3e40aec4 100644 --- a/src/gpu/GrBatchAtlas.h +++ b/src/gpu/GrBatchAtlas.h @@ -67,11 +67,6 @@ 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)) { -- cgit v1.2.3