diff options
Diffstat (limited to 'src/gpu/text')
-rw-r--r-- | src/gpu/text/GrAtlasGlyphCache.cpp | 10 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasGlyphCache.h | 31 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob.h | 24 | ||||
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp | 4 |
4 files changed, 34 insertions, 35 deletions
diff --git a/src/gpu/text/GrAtlasGlyphCache.cpp b/src/gpu/text/GrAtlasGlyphCache.cpp index 6884c91a1d..803dbb48e1 100644 --- a/src/gpu/text/GrAtlasGlyphCache.cpp +++ b/src/gpu/text/GrAtlasGlyphCache.cpp @@ -83,7 +83,7 @@ void GrAtlasGlyphCache::freeAll() { } } -void GrAtlasGlyphCache::HandleEviction(GrBatchAtlas::AtlasID id, void* ptr) { +void GrAtlasGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) { GrAtlasGlyphCache* fontCache = reinterpret_cast<GrAtlasGlyphCache*>(ptr); StrikeHash::Iter iter(&fontCache->fCache); @@ -183,7 +183,7 @@ void GrAtlasGlyphCache::dump() const { } #endif -void GrAtlasGlyphCache::setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs[3]) { +void GrAtlasGlyphCache::setAtlasSizes_ForTesting(const GrDrawOpAtlasConfig configs[3]) { // Delete any old atlases. // This should be safe to do as long as we are not in the middle of a flush. for (int i = 0; i < kMaskFormatCount; i++) { @@ -391,11 +391,11 @@ GrGlyph* GrAtlasTextStrike::generateGlyph(const SkGlyph& skGlyph, GrGlyph::Packe return glyph; } -void GrAtlasTextStrike::removeID(GrBatchAtlas::AtlasID id) { +void GrAtlasTextStrike::removeID(GrDrawOpAtlas::AtlasID id) { SkTDynamicHash<GrGlyph, GrGlyph::PackedID>::Iter iter(&fCache); while (!iter.done()) { if (id == (*iter).fID) { - (*iter).fID = GrBatchAtlas::kInvalidAtlasID; + (*iter).fID = GrDrawOpAtlas::kInvalidAtlasID; fAtlasedGlyphs--; SkASSERT(fAtlasedGlyphs >= 0); } @@ -434,7 +434,7 @@ bool GrAtlasTextStrike::addGlyphToAtlas(GrDrawOp::Target* target, glyph->width(), glyph->height(), storage.get(), &glyph->fAtlasLocation); if (success) { - SkASSERT(GrBatchAtlas::kInvalidAtlasID != glyph->fID); + SkASSERT(GrDrawOpAtlas::kInvalidAtlasID != glyph->fID); fAtlasedGlyphs++; } return success; diff --git a/src/gpu/text/GrAtlasGlyphCache.h b/src/gpu/text/GrAtlasGlyphCache.h index ce86e710b6..57b65baba2 100644 --- a/src/gpu/text/GrAtlasGlyphCache.h +++ b/src/gpu/text/GrAtlasGlyphCache.h @@ -8,8 +8,8 @@ #ifndef GrAtlasGlyphCache_DEFINED #define GrAtlasGlyphCache_DEFINED -#include "GrDrawOpAtlas.h" #include "GrCaps.h" +#include "GrDrawOpAtlas.h" #include "GrGlyph.h" #include "SkGlyphCache.h" #include "SkTDynamicHash.h" @@ -71,7 +71,7 @@ public: int countGlyphs() const { return fCache.count(); } // remove any references to this plot - void removeID(GrBatchAtlas::AtlasID); + void removeID(GrDrawOpAtlas::AtlasID); // If a TextStrike is abandoned by the cache, then the caller must get a new strike bool isAbandoned() const { return fIsAbandoned; } @@ -102,9 +102,9 @@ private: friend class GrAtlasGlyphCache; }; -/* +/** * GrAtlasGlyphCache manages strikes which are indexed by a SkGlyphCache. These strikes can then be - * used to generate individual Glyph Masks. The GrAtlasGlyphCache also manages GrBatchAtlases, + * used to generate individual Glyph Masks. The GrAtlasGlyphCache also manages GrDrawOpAtlases, * though this is more or less transparent to the client(aside from atlasGeneration, described * below). */ @@ -141,27 +141,26 @@ public: return this->getAtlas(glyph->fMaskFormat)->hasID(glyph->fID); } - // To ensure the GrBatchAtlas does not evict the Glyph Mask from its texture backing store, + // To ensure the GrDrawOpAtlas does not evict the Glyph Mask from its texture backing store, // the client must pass in the current op token along with the GrGlyph. // A BulkUseTokenUpdater is used to manage bulk last use token updating in the Atlas. // For convenience, this function will also set the use token for the current glyph if required // NOTE: the bulk uploader is only valid if the subrun has a valid atlasGeneration - void addGlyphToBulkAndSetUseToken(GrBatchAtlas::BulkUseTokenUpdater* updater, - GrGlyph* glyph, GrDrawOpUploadToken token) { + void addGlyphToBulkAndSetUseToken(GrDrawOpAtlas::BulkUseTokenUpdater* updater, GrGlyph* glyph, + GrDrawOpUploadToken token) { SkASSERT(glyph); updater->add(glyph->fID); this->getAtlas(glyph->fMaskFormat)->setLastUseToken(glyph->fID, token); } - void setUseTokenBulk(const GrBatchAtlas::BulkUseTokenUpdater& updater, + void setUseTokenBulk(const GrDrawOpAtlas::BulkUseTokenUpdater& updater, GrDrawOpUploadToken token, GrMaskFormat format) { this->getAtlas(format)->setLastUseTokenBulk(updater, token); } // add to texture atlas that matches this format - bool addToAtlas(GrAtlasTextStrike* strike, GrBatchAtlas::AtlasID* id, - GrDrawOp::Target* target, + bool addToAtlas(GrAtlasTextStrike* strike, GrDrawOpAtlas::AtlasID* id, GrDrawOp::Target* target, GrMaskFormat format, int width, int height, const void* image, SkIPoint16* loc) { fPreserveStrike = strike; @@ -169,7 +168,7 @@ public: } // Some clients may wish to verify the integrity of the texture backing store of the - // GrBatchAtlas. The atlasGeneration returned below is a monotonically increasing number which + // GrDrawOpAtlas. The atlasGeneration returned below is a monotonically increasing number which // changes every time something is removed from the texture backing store. uint64_t atlasGeneration(GrMaskFormat format) const { return this->getAtlas(format)->atlasGeneration(); @@ -184,7 +183,7 @@ public: void dump() const; #endif - void setAtlasSizes_ForTesting(const GrBatchAtlasConfig configs[3]); + void setAtlasSizes_ForTesting(const GrDrawOpAtlasConfig configs[3]); private: static GrPixelConfig MaskFormatToPixelConfig(GrMaskFormat format, const GrCaps& caps) { @@ -222,20 +221,20 @@ private: return strike; } - GrBatchAtlas* getAtlas(GrMaskFormat format) const { + GrDrawOpAtlas* getAtlas(GrMaskFormat format) const { int atlasIndex = MaskFormatToAtlasIndex(format); SkASSERT(fAtlases[atlasIndex]); return fAtlases[atlasIndex].get(); } - static void HandleEviction(GrBatchAtlas::AtlasID, void*); + static void HandleEviction(GrDrawOpAtlas::AtlasID, void*); using StrikeHash = SkTDynamicHash<GrAtlasTextStrike, SkDescriptor>; GrContext* fContext; StrikeHash fCache; - std::unique_ptr<GrBatchAtlas> fAtlases[kMaskFormatCount]; + std::unique_ptr<GrDrawOpAtlas> fAtlases[kMaskFormatCount]; GrAtlasTextStrike* fPreserveStrike; - GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; + GrDrawOpAtlasConfig fAtlasConfigs[kMaskFormatCount]; }; #endif diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h index e0b4a0573e..0028cc1f98 100644 --- a/src/gpu/text/GrAtlasTextBlob.h +++ b/src/gpu/text/GrAtlasTextBlob.h @@ -9,8 +9,8 @@ #define GrAtlasTextBlob_DEFINED #include "GrAtlasGlyphCache.h" -#include "GrDrawOpAtlas.h" #include "GrColor.h" +#include "GrDrawOpAtlas.h" #include "GrMemoryPool.h" #include "SkDescriptor.h" #include "SkMaskFilter.h" @@ -364,15 +364,15 @@ private: } struct SubRunInfo { SubRunInfo() - : fAtlasGeneration(GrBatchAtlas::kInvalidAtlasGeneration) - , fVertexStartIndex(0) - , fVertexEndIndex(0) - , fGlyphStartIndex(0) - , fGlyphEndIndex(0) - , fColor(GrColor_ILLEGAL) - , fMaskFormat(kA8_GrMaskFormat) - , fDrawAsDistanceFields(false) - , fUseLCDText(false) { + : fAtlasGeneration(GrDrawOpAtlas::kInvalidAtlasGeneration) + , fVertexStartIndex(0) + , fVertexEndIndex(0) + , fGlyphStartIndex(0) + , fGlyphEndIndex(0) + , fColor(GrColor_ILLEGAL) + , fMaskFormat(kA8_GrMaskFormat) + , fDrawAsDistanceFields(false) + , fUseLCDText(false) { fVertexBounds.setLargestInverted(); } SubRunInfo(const SubRunInfo& that) @@ -395,7 +395,7 @@ private: // TODO when this object is more internal, drop the privacy void resetBulkUseToken() { fBulkUseToken.reset(); } - GrBatchAtlas::BulkUseTokenUpdater* bulkUseToken() { return &fBulkUseToken; } + GrDrawOpAtlas::BulkUseTokenUpdater* bulkUseToken() { return &fBulkUseToken; } void setStrike(GrAtlasTextStrike* strike) { fStrike.reset(SkRef(strike)); } GrAtlasTextStrike* strike() const { return fStrike.get(); } @@ -451,7 +451,7 @@ private: bool drawAsDistanceFields() const { return fDrawAsDistanceFields; } private: - GrBatchAtlas::BulkUseTokenUpdater fBulkUseToken; + GrDrawOpAtlas::BulkUseTokenUpdater fBulkUseToken; sk_sp<GrAtlasTextStrike> fStrike; SkMatrix fCurrentViewMatrix; SkRect fVertexBounds; diff --git a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp index 7f22d92ddf..9a37e42bf9 100644 --- a/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp +++ b/src/gpu/text/GrAtlasTextBlob_regenInBatch.cpp @@ -216,8 +216,8 @@ void GrAtlasTextBlob::regenInOp(GrDrawOp::Target* target, GrAtlasGlyphCache* fon if (regenGlyphs) { info->setStrike(strike); } - info->setAtlasGeneration(brokenRun ? GrBatchAtlas::kInvalidAtlasGeneration : - fontCache->atlasGeneration(info->maskFormat())); + info->setAtlasGeneration(brokenRun ? GrDrawOpAtlas::kInvalidAtlasGeneration + : fontCache->atlasGeneration(info->maskFormat())); } } |