Rename GrGlyphCache -> GrStrikeCache
Change-Id: Ie6fdcc6ce1f2265783ebb4dcd1b1ce087a296ddf
Reviewed-on: https://skia-review.googlesource.com/c/184500
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/atlastext/SkInternalAtlasTextContext.cpp b/src/atlastext/SkInternalAtlasTextContext.cpp
index 2c9cddc..ec93dd7 100644
--- a/src/atlastext/SkInternalAtlasTextContext.cpp
+++ b/src/atlastext/SkInternalAtlasTextContext.cpp
@@ -10,7 +10,7 @@
#include "GrContextPriv.h"
#include "SkAtlasTextContext.h"
#include "SkAtlasTextRenderer.h"
-#include "text/GrGlyphCache.h"
+#include "text/GrStrikeCache.h"
SkAtlasTextRenderer* SkGetAtlasTextRendererFromInternalContext(
class SkInternalAtlasTextContext& internal) {
@@ -49,7 +49,7 @@
}
}
-GrGlyphCache* SkInternalAtlasTextContext::glyphCache() {
+GrStrikeCache* SkInternalAtlasTextContext::glyphCache() {
return fGrContext->contextPriv().getGlyphCache();
}
diff --git a/src/atlastext/SkInternalAtlasTextContext.h b/src/atlastext/SkInternalAtlasTextContext.h
index 22cda5c..a4e2e29 100644
--- a/src/atlastext/SkInternalAtlasTextContext.h
+++ b/src/atlastext/SkInternalAtlasTextContext.h
@@ -14,7 +14,7 @@
#include "SkRefCnt.h"
class GrContext;
-class GrGlyphCache;
+class GrStrikeCache;
class GrTextBlobCache;
class SkAtlasTextRenderer;
@@ -33,7 +33,7 @@
SkAtlasTextRenderer* renderer() const { return fRenderer.get(); }
GrContext* grContext() const { return fGrContext.get(); }
- GrGlyphCache* glyphCache();
+ GrStrikeCache* glyphCache();
GrTextBlobCache* textBlobCache();
const GrTokenTracker* tokenTracker() final { return &fTokenTracker; }
diff --git a/src/core/SkGlyphRunPainter.cpp b/src/core/SkGlyphRunPainter.cpp
index 7ebbbfd..4eb1bcc 100644
--- a/src/core/SkGlyphRunPainter.cpp
+++ b/src/core/SkGlyphRunPainter.cpp
@@ -683,7 +683,7 @@
}
}
-void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache,
+void GrTextBlob::generateFromGlyphRunList(GrStrikeCache* glyphCache,
const GrShaderCaps& shaderCaps,
const GrTextContext::Options& options,
const SkPaint& paint,
@@ -703,7 +703,7 @@
auto subRun = fRun->initARGBFallback();
SkExclusiveStrikePtr fallbackCache = SkStrikeCache::FindOrCreateStrikeExclusive(
fallbackFont, fallbackPaint, fProps, fScalerContextFlags, glyphCacheMatrix);
- sk_sp<GrTextStrike> strike = fGlyphCache->getStrike(fallbackCache.get());
+ sk_sp<GrTextStrike> strike = fGrStrikeCache->getStrike(fallbackCache.get());
fRun->setupFont(fallbackPaint, fallbackFont, fallbackCache->getDescriptor());
SkASSERT(strike != nullptr);
@@ -726,7 +726,7 @@
GrTextBlob::Run* fRun;
const SkSurfaceProps& fProps;
const SkScalerContextFlags fScalerContextFlags;
- GrGlyphCache* const fGlyphCache;
+ GrStrikeCache* const fGrStrikeCache;
};
SkPoint origin = glyphRunList.origin();
@@ -961,7 +961,7 @@
// Glyphs which are too large for the atlas still request images when computing the bounds
// for the glyph, which is why its necessary to send both. See related code in
- // get_packed_glyph_bounds in GrGlyphCache.cpp and crbug.com/510931.
+ // get_packed_glyph_bounds in GrStrikeCache.cpp and crbug.com/510931.
auto processPaths = [glyphCacheState]
(SkSpan<const SkGlyphRunListPainter::GlyphAndPos> paths) {
for (const auto& path : paths) {
diff --git a/src/gpu/GrContext.cpp b/src/gpu/GrContext.cpp
index d4f99b2..b0ff64b 100644
--- a/src/gpu/GrContext.cpp
+++ b/src/gpu/GrContext.cpp
@@ -139,7 +139,7 @@
options.fSortRenderTargets,
options.fReduceOpListSplitting));
- fGlyphCache = new GrGlyphCache(fCaps.get(), options.fGlyphCacheTextureMaximumBytes);
+ fGlyphCache = new GrStrikeCache(fCaps.get(), options.fGlyphCacheTextureMaximumBytes);
fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB,
this, this->uniqueID()));
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index 8480deb..468a599 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -197,7 +197,7 @@
GrGpu* getGpu() { return fContext->fGpu.get(); }
const GrGpu* getGpu() const { return fContext->fGpu.get(); }
- GrGlyphCache* getGlyphCache() { return fContext->fGlyphCache; }
+ GrStrikeCache* getGlyphCache() { return fContext->fGlyphCache; }
GrTextBlobCache* getTextBlobCache() { return fContext->fTextBlobCache.get(); }
// This accessor should only ever be called by the GrOpFlushState.
diff --git a/src/gpu/GrDirectContext.cpp b/src/gpu/GrDirectContext.cpp
index d25852f..c46d84e 100644
--- a/src/gpu/GrDirectContext.cpp
+++ b/src/gpu/GrDirectContext.cpp
@@ -14,7 +14,7 @@
#include "effects/GrSkSLFP.h"
#include "gl/GrGLGpu.h"
#include "mock/GrMockGpu.h"
-#include "text/GrGlyphCache.h"
+#include "text/GrStrikeCache.h"
#ifdef SK_METAL
#include "mtl/GrMtlTrampoline.h"
#endif
@@ -78,7 +78,7 @@
allowMultitexturing = GrDrawOpAtlas::AllowMultitexturing::kYes;
}
- GrGlyphCache* glyphCache = this->contextPriv().getGlyphCache();
+ GrStrikeCache* glyphCache = this->contextPriv().getGlyphCache();
GrProxyProvider* proxyProvider = this->contextPriv().proxyProvider();
fAtlasManager = new GrAtlasManager(proxyProvider, glyphCache,
diff --git a/src/gpu/GrOpFlushState.cpp b/src/gpu/GrOpFlushState.cpp
index 0b27827..55328a1 100644
--- a/src/gpu/GrOpFlushState.cpp
+++ b/src/gpu/GrOpFlushState.cpp
@@ -165,7 +165,7 @@
return fOpArgs->fAppliedClip ? std::move(*fOpArgs->fAppliedClip) : GrAppliedClip();
}
-GrGlyphCache* GrOpFlushState::glyphCache() const {
+GrStrikeCache* GrOpFlushState::glyphCache() const {
return fGpu->getContext()->contextPriv().getGlyphCache();
}
diff --git a/src/gpu/GrOpFlushState.h b/src/gpu/GrOpFlushState.h
index f963c69..65c8644 100644
--- a/src/gpu/GrOpFlushState.h
+++ b/src/gpu/GrOpFlushState.h
@@ -99,7 +99,7 @@
const GrCaps& caps() const final;
GrResourceProvider* resourceProvider() const final { return fResourceProvider; }
- GrGlyphCache* glyphCache() const final;
+ GrStrikeCache* glyphCache() const final;
// At this point we know we're flushing so full access to the GrAtlasManager is required (and
// permissible).
diff --git a/src/gpu/ops/GrAtlasTextOp.cpp b/src/gpu/ops/GrAtlasTextOp.cpp
index 368c625..976ab6f 100644
--- a/src/gpu/ops/GrAtlasTextOp.cpp
+++ b/src/gpu/ops/GrAtlasTextOp.cpp
@@ -20,7 +20,7 @@
#include "effects/GrBitmapTextGeoProc.h"
#include "effects/GrDistanceFieldGeoProc.h"
#include "text/GrAtlasManager.h"
-#include "text/GrGlyphCache.h"
+#include "text/GrStrikeCache.h"
///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -286,7 +286,7 @@
}
GrAtlasManager* atlasManager = target->atlasManager();
- GrGlyphCache* glyphCache = target->glyphCache();
+ GrStrikeCache* glyphCache = target->glyphCache();
GrMaskFormat maskFormat = this->maskFormat();
diff --git a/src/gpu/ops/GrAtlasTextOp.h b/src/gpu/ops/GrAtlasTextOp.h
index 7386321..6d31197 100644
--- a/src/gpu/ops/GrAtlasTextOp.h
+++ b/src/gpu/ops/GrAtlasTextOp.h
@@ -11,7 +11,6 @@
#include "ops/GrMeshDrawOp.h"
#include "text/GrTextBlob.h"
#include "text/GrDistanceFieldAdjustTable.h"
-#include "text/GrGlyphCache.h"
class SkAtlasTextTarget;
class GrContext;
diff --git a/src/gpu/ops/GrMeshDrawOp.h b/src/gpu/ops/GrMeshDrawOp.h
index 0619e79..d851fc0 100644
--- a/src/gpu/ops/GrMeshDrawOp.h
+++ b/src/gpu/ops/GrMeshDrawOp.h
@@ -16,7 +16,7 @@
class GrAtlasManager;
class GrCaps;
-class GrGlyphCache;
+class GrStrikeCache;
class GrOpFlushState;
/**
@@ -190,7 +190,7 @@
virtual GrResourceProvider* resourceProvider() const = 0;
uint32_t contextUniqueID() const { return this->resourceProvider()->contextUniqueID(); }
- virtual GrGlyphCache* glyphCache() const = 0;
+ virtual GrStrikeCache* glyphCache() const = 0;
virtual GrAtlasManager* atlasManager() const = 0;
virtual const GrCaps& caps() const = 0;
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index 33f906c..c1fbe3d 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -8,9 +8,9 @@
#include "GrAtlasManager.h"
#include "GrGlyph.h"
-#include "GrGlyphCache.h"
+#include "GrStrikeCache.h"
-GrAtlasManager::GrAtlasManager(GrProxyProvider* proxyProvider, GrGlyphCache* glyphCache,
+GrAtlasManager::GrAtlasManager(GrProxyProvider* proxyProvider, GrStrikeCache* glyphCache,
size_t maxTextureBytes,
GrDrawOpAtlas::AllowMultitexturing allowMultitexturing)
: fAllowMultitexturing{allowMultitexturing}
@@ -64,7 +64,7 @@
// add to texture atlas that matches this format
GrDrawOpAtlas::ErrorCode GrAtlasManager::addToAtlas(
GrResourceProvider* resourceProvider,
- GrGlyphCache* glyphCache,
+ GrStrikeCache* glyphCache,
GrTextStrike* strike, GrDrawOpAtlas::AtlasID* id,
GrDeferredUploadTarget* target, GrMaskFormat format,
int width, int height, const void* image, SkIPoint16* loc) {
@@ -186,7 +186,7 @@
fAtlases[index] = GrDrawOpAtlas::Make(
fProxyProvider, format, config, atlasDimensions.width(), atlasDimensions.height(),
plotDimensions.width(), plotDimensions.height(), fAllowMultitexturing,
- &GrGlyphCache::HandleEviction, fGlyphCache);
+ &GrStrikeCache::HandleEviction, fGlyphCache);
if (!fAtlases[index]) {
return false;
}
diff --git a/src/gpu/text/GrAtlasManager.h b/src/gpu/text/GrAtlasManager.h
index f8d4f3e..b5639a8 100644
--- a/src/gpu/text/GrAtlasManager.h
+++ b/src/gpu/text/GrAtlasManager.h
@@ -13,9 +13,8 @@
#include "GrOnFlushResourceProvider.h"
#include "GrProxyProvider.h"
-class GrAtlasGlypCache;
-class GrTextStrike;
struct GrGlyph;
+class GrTextStrike;
//////////////////////////////////////////////////////////////////////////////////////////////////
/** The GrAtlasManager manages the lifetime of and access to GrDrawOpAtlases.
@@ -26,13 +25,13 @@
*/
class GrAtlasManager : public GrOnFlushCallbackObject {
public:
- GrAtlasManager(GrProxyProvider*, GrGlyphCache*,
+ GrAtlasManager(GrProxyProvider*, GrStrikeCache*,
size_t maxTextureBytes, GrDrawOpAtlas::AllowMultitexturing);
~GrAtlasManager() override;
// Change an expected 565 mask format to 8888 if 565 is not supported (will happen when using
// Metal on macOS). The actual conversion of the data is handled in get_packed_glyph_image() in
- // GrGlyphCache.cpp
+ // GrStrikeCache.cpp
GrMaskFormat resolveMaskFormat(GrMaskFormat format) const {
if (kA565_GrMaskFormat == format &&
!fProxyProvider->caps()->isConfigTexturable(kRGB_565_GrPixelConfig)) {
@@ -42,7 +41,7 @@
}
// if getProxies returns nullptr, the client must not try to use other functions on the
- // GrGlyphCache which use the atlas. This function *must* be called first, before other
+ // GrStrikeCache which use the atlas. This function *must* be called first, before other
// functions which use the atlas. Note that we can have proxies available but none active
// (i.e., none instantiated).
const sk_sp<GrTextureProxy>* getProxies(GrMaskFormat format, unsigned int* numActiveProxies) {
@@ -75,7 +74,7 @@
// add to texture atlas that matches this format
GrDrawOpAtlas::ErrorCode addToAtlas(
- GrResourceProvider*, GrGlyphCache*, GrTextStrike*,
+ GrResourceProvider*, GrStrikeCache*, GrTextStrike*,
GrDrawOpAtlas::AtlasID*, GrDeferredUploadTarget*, GrMaskFormat,
int width, int height, const void* image, SkIPoint16* loc);
@@ -146,7 +145,7 @@
std::unique_ptr<GrDrawOpAtlas> fAtlases[kMaskFormatCount];
GrProxyProvider* fProxyProvider;
sk_sp<const GrCaps> fCaps;
- GrGlyphCache* fGlyphCache;
+ GrStrikeCache* fGlyphCache;
GrDrawOpAtlasConfig fAtlasConfig;
typedef GrOnFlushCallbackObject INHERITED;
diff --git a/src/gpu/text/GrGlyphCache.cpp b/src/gpu/text/GrStrikeCache.cpp
similarity index 95%
rename from src/gpu/text/GrGlyphCache.cpp
rename to src/gpu/text/GrStrikeCache.cpp
index 900a3e1..8edc977 100644
--- a/src/gpu/text/GrGlyphCache.cpp
+++ b/src/gpu/text/GrStrikeCache.cpp
@@ -5,7 +5,7 @@
* found in the LICENSE file.
*/
-#include "GrGlyphCache.h"
+#include "GrStrikeCache.h"
#include "GrAtlasManager.h"
#include "GrCaps.h"
#include "GrColor.h"
@@ -14,12 +14,12 @@
#include "SkAutoMalloc.h"
#include "SkDistanceFieldGen.h"
-GrGlyphCache::GrGlyphCache(const GrCaps* caps, size_t maxTextureBytes)
+GrStrikeCache::GrStrikeCache(const GrCaps* caps, size_t maxTextureBytes)
: fPreserveStrike(nullptr)
, f565Masks(SkMasks::CreateMasks({0xF800, 0x07E0, 0x001F, 0},
GrMaskFormatBytesPerPixel(kA565_GrMaskFormat) * 8)) { }
-GrGlyphCache::~GrGlyphCache() {
+GrStrikeCache::~GrStrikeCache() {
StrikeHash::Iter iter(&fCache);
while (!iter.done()) {
(*iter).fIsAbandoned = true;
@@ -28,7 +28,7 @@
}
}
-void GrGlyphCache::freeAll() {
+void GrStrikeCache::freeAll() {
StrikeHash::Iter iter(&fCache);
while (!iter.done()) {
(*iter).fIsAbandoned = true;
@@ -38,8 +38,8 @@
fCache.rewind();
}
-void GrGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
- GrGlyphCache* glyphCache = reinterpret_cast<GrGlyphCache*>(ptr);
+void GrStrikeCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
+ GrStrikeCache* glyphCache = reinterpret_cast<GrStrikeCache*>(ptr);
StrikeHash::Iter iter(&glyphCache->fCache);
for (; !iter.done(); ++iter) {
@@ -193,7 +193,7 @@
GrDrawOpAtlas::ErrorCode GrTextStrike::addGlyphToAtlas(
GrResourceProvider* resourceProvider,
GrDeferredUploadTarget* target,
- GrGlyphCache* glyphCache,
+ GrStrikeCache* glyphCache,
GrAtlasManager* fullAtlasManager,
GrGlyph* glyph,
SkStrike* cache,
diff --git a/src/gpu/text/GrGlyphCache.h b/src/gpu/text/GrStrikeCache.h
similarity index 86%
rename from src/gpu/text/GrGlyphCache.h
rename to src/gpu/text/GrStrikeCache.h
index 92d8910..0874ffc 100644
--- a/src/gpu/text/GrGlyphCache.h
+++ b/src/gpu/text/GrStrikeCache.h
@@ -5,8 +5,8 @@
* found in the LICENSE file.
*/
-#ifndef GrAtlasGlyphCache_DEFINED
-#define GrAtlasGlyphCache_DEFINED
+#ifndef GrStrikeCache_DEFINED
+#define GrStrikeCache_DEFINED
#include "GrDrawOpAtlas.h"
#include "GrGlyph.h"
@@ -15,16 +15,16 @@
#include "SkStrike.h"
#include "SkTDynamicHash.h"
-class GrGlyphCache;
class GrAtlasManager;
class GrGpu;
+class GrStrikeCache;
/**
* The GrTextStrike manages a pool of CPU backing memory for GrGlyphs. This backing memory
- * is indexed by a PackedID and SkGlyphCache. The SkGlyphCache is what actually creates the mask.
- * The GrTextStrike may outlive the generating SkGlyphCache. However, it retains a copy
- * of it's SkDescriptor as a key to access (or regenerate) the SkGlyphCache. GrTextStrikes are
- * created by and owned by a GrGlyphCache.
+ * is indexed by a PackedID and SkStrike. The SkStrike is what actually creates the mask.
+ * The GrTextStrike may outlive the generating SkStrike. However, it retains a copy
+ * of it's SkDescriptor as a key to access (or regenerate) the SkStrike. GrTextStrikes are
+ * created by and owned by a GrStrikeCache.
*/
class GrTextStrike : public SkNVRefCnt<GrTextStrike> {
public:
@@ -61,7 +61,7 @@
// TODO we can handle some of these cases if we really want to, but the long term solution is to
// get the actual glyph image itself when we get the glyph metrics.
GrDrawOpAtlas::ErrorCode addGlyphToAtlas(GrResourceProvider*, GrDeferredUploadTarget*,
- GrGlyphCache*, GrAtlasManager*, GrGlyph*,
+ GrStrikeCache*, GrAtlasManager*, GrGlyph*,
SkStrike*, GrMaskFormat expectedMaskFormat,
bool isScaledGlyph);
@@ -94,17 +94,17 @@
GrGlyph* generateGlyph(const SkGlyph&);
- friend class GrGlyphCache;
+ friend class GrStrikeCache;
};
/**
- * GrGlyphCache manages strikes which are indexed by a SkGlyphCache. These strikes can then be
+ * GrStrikeCache manages strikes which are indexed by a SkStrike. These strikes can then be
* used to generate individual Glyph Masks.
*/
-class GrGlyphCache {
+class GrStrikeCache {
public:
- GrGlyphCache(const GrCaps* caps, size_t maxTextureBytes);
- ~GrGlyphCache();
+ GrStrikeCache(const GrCaps* caps, size_t maxTextureBytes);
+ ~GrStrikeCache();
void setStrikeToPreserve(GrTextStrike* strike) { fPreserveStrike = strike; }
@@ -141,4 +141,4 @@
std::unique_ptr<const SkMasks> f565Masks;
};
-#endif
+#endif // GrStrikeCache_DEFINED
diff --git a/src/gpu/text/GrTextBlob.h b/src/gpu/text/GrTextBlob.h
index 6b85c5d..2f37dab 100644
--- a/src/gpu/text/GrTextBlob.h
+++ b/src/gpu/text/GrTextBlob.h
@@ -10,7 +10,7 @@
#include "GrColor.h"
#include "GrDrawOpAtlas.h"
-#include "GrGlyphCache.h"
+#include "GrStrikeCache.h"
#include "GrTextTarget.h"
#include "text/GrTextContext.h"
#include "SkDescriptor.h"
@@ -55,7 +55,7 @@
class VertexRegenerator;
- void generateFromGlyphRunList(GrGlyphCache* glyphCache,
+ void generateFromGlyphRunList(GrStrikeCache* glyphCache,
const GrShaderCaps& shaderCaps,
const GrTextContext::Options& options,
const SkPaint& paint,
@@ -571,7 +571,7 @@
*/
VertexRegenerator(GrResourceProvider*, GrTextBlob*, int runIdx, int subRunIdx,
const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color,
- GrDeferredUploadTarget*, GrGlyphCache*, GrAtlasManager*,
+ GrDeferredUploadTarget*, GrStrikeCache*, GrAtlasManager*,
SkExclusiveStrikePtr*);
struct Result {
@@ -602,7 +602,7 @@
const SkMatrix& fViewMatrix;
GrTextBlob* fBlob;
GrDeferredUploadTarget* fUploadTarget;
- GrGlyphCache* fGlyphCache;
+ GrStrikeCache* fGlyphCache;
GrAtlasManager* fFullAtlasManager;
SkExclusiveStrikePtr* fLazyCache;
Run* fRun;
diff --git a/src/gpu/text/GrTextBlobVertexRegenerator.cpp b/src/gpu/text/GrTextBlobVertexRegenerator.cpp
index ea60126..77d2b8d 100644
--- a/src/gpu/text/GrTextBlobVertexRegenerator.cpp
+++ b/src/gpu/text/GrTextBlobVertexRegenerator.cpp
@@ -121,7 +121,7 @@
const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
GrColor color,
GrDeferredUploadTarget* uploadTarget,
- GrGlyphCache* glyphCache,
+ GrStrikeCache* glyphCache,
GrAtlasManager* fullAtlasManager,
SkExclusiveStrikePtr* lazyCache)
: fResourceProvider(resourceProvider)
@@ -137,7 +137,7 @@
// Compute translation if any
fSubRun->computeTranslation(fViewMatrix, x, y, &fTransX, &fTransY);
- // Because the GrGlyphCache may evict the strike a blob depends on using for
+ // Because the GrStrikeCache may evict the strike a blob depends on using for
// generating its texture coords, we have to track whether or not the strike has
// been abandoned. If it hasn't been abandoned, then we can use the GrGlyph*s as is
// otherwise we have to get the new strike, and use that to get the correct glyphs.