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>
This commit is contained in:
parent
765bdaa6ca
commit
081e6f3754
@ -387,10 +387,10 @@ skia_gpu_sources = [
|
|||||||
"$_src/gpu/text/GrAtlasManager.h",
|
"$_src/gpu/text/GrAtlasManager.h",
|
||||||
"$_src/gpu/text/GrDistanceFieldAdjustTable.cpp",
|
"$_src/gpu/text/GrDistanceFieldAdjustTable.cpp",
|
||||||
"$_src/gpu/text/GrDistanceFieldAdjustTable.h",
|
"$_src/gpu/text/GrDistanceFieldAdjustTable.h",
|
||||||
"$_src/gpu/text/GrGlyphCache.cpp",
|
|
||||||
"$_src/gpu/text/GrGlyphCache.h",
|
|
||||||
"$_src/gpu/text/GrSDFMaskFilter.cpp",
|
"$_src/gpu/text/GrSDFMaskFilter.cpp",
|
||||||
"$_src/gpu/text/GrSDFMaskFilter.h",
|
"$_src/gpu/text/GrSDFMaskFilter.h",
|
||||||
|
"$_src/gpu/text/GrStrikeCache.cpp",
|
||||||
|
"$_src/gpu/text/GrStrikeCache.h",
|
||||||
"$_src/gpu/text/GrTextBlob.cpp",
|
"$_src/gpu/text/GrTextBlob.cpp",
|
||||||
"$_src/gpu/text/GrTextBlob.h",
|
"$_src/gpu/text/GrTextBlob.h",
|
||||||
"$_src/gpu/text/GrTextBlobCache.cpp",
|
"$_src/gpu/text/GrTextBlobCache.cpp",
|
||||||
|
@ -29,7 +29,7 @@ class GrContextThreadSafeProxyPriv;
|
|||||||
class GrDrawingManager;
|
class GrDrawingManager;
|
||||||
class GrFragmentProcessor;
|
class GrFragmentProcessor;
|
||||||
struct GrGLInterface;
|
struct GrGLInterface;
|
||||||
class GrGlyphCache;
|
class GrStrikeCache;
|
||||||
class GrGpu;
|
class GrGpu;
|
||||||
struct GrMockOptions;
|
struct GrMockOptions;
|
||||||
class GrOpMemoryPool;
|
class GrOpMemoryPool;
|
||||||
@ -312,7 +312,7 @@ private:
|
|||||||
// All the GrOp-derived classes use this pool.
|
// All the GrOp-derived classes use this pool.
|
||||||
sk_sp<GrOpMemoryPool> fOpMemoryPool;
|
sk_sp<GrOpMemoryPool> fOpMemoryPool;
|
||||||
|
|
||||||
GrGlyphCache* fGlyphCache;
|
GrStrikeCache* fGlyphCache;
|
||||||
std::unique_ptr<GrTextBlobCache> fTextBlobCache;
|
std::unique_ptr<GrTextBlobCache> fTextBlobCache;
|
||||||
|
|
||||||
bool fDisableGpuYUVConversion;
|
bool fDisableGpuYUVConversion;
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
#include "GrContextPriv.h"
|
#include "GrContextPriv.h"
|
||||||
#include "SkAtlasTextContext.h"
|
#include "SkAtlasTextContext.h"
|
||||||
#include "SkAtlasTextRenderer.h"
|
#include "SkAtlasTextRenderer.h"
|
||||||
#include "text/GrGlyphCache.h"
|
#include "text/GrStrikeCache.h"
|
||||||
|
|
||||||
SkAtlasTextRenderer* SkGetAtlasTextRendererFromInternalContext(
|
SkAtlasTextRenderer* SkGetAtlasTextRendererFromInternalContext(
|
||||||
class SkInternalAtlasTextContext& internal) {
|
class SkInternalAtlasTextContext& internal) {
|
||||||
@ -49,7 +49,7 @@ SkInternalAtlasTextContext::~SkInternalAtlasTextContext() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GrGlyphCache* SkInternalAtlasTextContext::glyphCache() {
|
GrStrikeCache* SkInternalAtlasTextContext::glyphCache() {
|
||||||
return fGrContext->contextPriv().getGlyphCache();
|
return fGrContext->contextPriv().getGlyphCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "SkRefCnt.h"
|
#include "SkRefCnt.h"
|
||||||
|
|
||||||
class GrContext;
|
class GrContext;
|
||||||
class GrGlyphCache;
|
class GrStrikeCache;
|
||||||
class GrTextBlobCache;
|
class GrTextBlobCache;
|
||||||
|
|
||||||
class SkAtlasTextRenderer;
|
class SkAtlasTextRenderer;
|
||||||
@ -33,7 +33,7 @@ public:
|
|||||||
SkAtlasTextRenderer* renderer() const { return fRenderer.get(); }
|
SkAtlasTextRenderer* renderer() const { return fRenderer.get(); }
|
||||||
|
|
||||||
GrContext* grContext() const { return fGrContext.get(); }
|
GrContext* grContext() const { return fGrContext.get(); }
|
||||||
GrGlyphCache* glyphCache();
|
GrStrikeCache* glyphCache();
|
||||||
GrTextBlobCache* textBlobCache();
|
GrTextBlobCache* textBlobCache();
|
||||||
|
|
||||||
const GrTokenTracker* tokenTracker() final { return &fTokenTracker; }
|
const GrTokenTracker* tokenTracker() final { return &fTokenTracker; }
|
||||||
|
@ -683,7 +683,7 @@ void GrTextBlob::Run::appendSourceSpaceGlyph(const sk_sp<GrTextStrike>& strike,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache,
|
void GrTextBlob::generateFromGlyphRunList(GrStrikeCache* glyphCache,
|
||||||
const GrShaderCaps& shaderCaps,
|
const GrShaderCaps& shaderCaps,
|
||||||
const GrTextContext::Options& options,
|
const GrTextContext::Options& options,
|
||||||
const SkPaint& paint,
|
const SkPaint& paint,
|
||||||
@ -703,7 +703,7 @@ void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache,
|
|||||||
auto subRun = fRun->initARGBFallback();
|
auto subRun = fRun->initARGBFallback();
|
||||||
SkExclusiveStrikePtr fallbackCache = SkStrikeCache::FindOrCreateStrikeExclusive(
|
SkExclusiveStrikePtr fallbackCache = SkStrikeCache::FindOrCreateStrikeExclusive(
|
||||||
fallbackFont, fallbackPaint, fProps, fScalerContextFlags, glyphCacheMatrix);
|
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());
|
fRun->setupFont(fallbackPaint, fallbackFont, fallbackCache->getDescriptor());
|
||||||
|
|
||||||
SkASSERT(strike != nullptr);
|
SkASSERT(strike != nullptr);
|
||||||
@ -726,7 +726,7 @@ void GrTextBlob::generateFromGlyphRunList(GrGlyphCache* glyphCache,
|
|||||||
GrTextBlob::Run* fRun;
|
GrTextBlob::Run* fRun;
|
||||||
const SkSurfaceProps& fProps;
|
const SkSurfaceProps& fProps;
|
||||||
const SkScalerContextFlags fScalerContextFlags;
|
const SkScalerContextFlags fScalerContextFlags;
|
||||||
GrGlyphCache* const fGlyphCache;
|
GrStrikeCache* const fGrStrikeCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
SkPoint origin = glyphRunList.origin();
|
SkPoint origin = glyphRunList.origin();
|
||||||
@ -961,7 +961,7 @@ void SkTextBlobCacheDiffCanvas::TrackLayerDevice::processGlyphRunForMask(
|
|||||||
|
|
||||||
// Glyphs which are too large for the atlas still request images when computing the bounds
|
// 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
|
// 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]
|
auto processPaths = [glyphCacheState]
|
||||||
(SkSpan<const SkGlyphRunListPainter::GlyphAndPos> paths) {
|
(SkSpan<const SkGlyphRunListPainter::GlyphAndPos> paths) {
|
||||||
for (const auto& path : paths) {
|
for (const auto& path : paths) {
|
||||||
|
@ -139,7 +139,7 @@ bool GrContext::initCommon(const GrContextOptions& options) {
|
|||||||
options.fSortRenderTargets,
|
options.fSortRenderTargets,
|
||||||
options.fReduceOpListSplitting));
|
options.fReduceOpListSplitting));
|
||||||
|
|
||||||
fGlyphCache = new GrGlyphCache(fCaps.get(), options.fGlyphCacheTextureMaximumBytes);
|
fGlyphCache = new GrStrikeCache(fCaps.get(), options.fGlyphCacheTextureMaximumBytes);
|
||||||
|
|
||||||
fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB,
|
fTextBlobCache.reset(new GrTextBlobCache(TextBlobCacheOverBudgetCB,
|
||||||
this, this->uniqueID()));
|
this, this->uniqueID()));
|
||||||
|
@ -197,7 +197,7 @@ public:
|
|||||||
GrGpu* getGpu() { return fContext->fGpu.get(); }
|
GrGpu* getGpu() { return fContext->fGpu.get(); }
|
||||||
const GrGpu* getGpu() const { 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(); }
|
GrTextBlobCache* getTextBlobCache() { return fContext->fTextBlobCache.get(); }
|
||||||
|
|
||||||
// This accessor should only ever be called by the GrOpFlushState.
|
// This accessor should only ever be called by the GrOpFlushState.
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
#include "effects/GrSkSLFP.h"
|
#include "effects/GrSkSLFP.h"
|
||||||
#include "gl/GrGLGpu.h"
|
#include "gl/GrGLGpu.h"
|
||||||
#include "mock/GrMockGpu.h"
|
#include "mock/GrMockGpu.h"
|
||||||
#include "text/GrGlyphCache.h"
|
#include "text/GrStrikeCache.h"
|
||||||
#ifdef SK_METAL
|
#ifdef SK_METAL
|
||||||
#include "mtl/GrMtlTrampoline.h"
|
#include "mtl/GrMtlTrampoline.h"
|
||||||
#endif
|
#endif
|
||||||
@ -78,7 +78,7 @@ protected:
|
|||||||
allowMultitexturing = GrDrawOpAtlas::AllowMultitexturing::kYes;
|
allowMultitexturing = GrDrawOpAtlas::AllowMultitexturing::kYes;
|
||||||
}
|
}
|
||||||
|
|
||||||
GrGlyphCache* glyphCache = this->contextPriv().getGlyphCache();
|
GrStrikeCache* glyphCache = this->contextPriv().getGlyphCache();
|
||||||
GrProxyProvider* proxyProvider = this->contextPriv().proxyProvider();
|
GrProxyProvider* proxyProvider = this->contextPriv().proxyProvider();
|
||||||
|
|
||||||
fAtlasManager = new GrAtlasManager(proxyProvider, glyphCache,
|
fAtlasManager = new GrAtlasManager(proxyProvider, glyphCache,
|
||||||
|
@ -165,7 +165,7 @@ GrAppliedClip GrOpFlushState::detachAppliedClip() {
|
|||||||
return fOpArgs->fAppliedClip ? std::move(*fOpArgs->fAppliedClip) : GrAppliedClip();
|
return fOpArgs->fAppliedClip ? std::move(*fOpArgs->fAppliedClip) : GrAppliedClip();
|
||||||
}
|
}
|
||||||
|
|
||||||
GrGlyphCache* GrOpFlushState::glyphCache() const {
|
GrStrikeCache* GrOpFlushState::glyphCache() const {
|
||||||
return fGpu->getContext()->contextPriv().getGlyphCache();
|
return fGpu->getContext()->contextPriv().getGlyphCache();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ public:
|
|||||||
const GrCaps& caps() const final;
|
const GrCaps& caps() const final;
|
||||||
GrResourceProvider* resourceProvider() const final { return fResourceProvider; }
|
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
|
// At this point we know we're flushing so full access to the GrAtlasManager is required (and
|
||||||
// permissible).
|
// permissible).
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include "effects/GrBitmapTextGeoProc.h"
|
#include "effects/GrBitmapTextGeoProc.h"
|
||||||
#include "effects/GrDistanceFieldGeoProc.h"
|
#include "effects/GrDistanceFieldGeoProc.h"
|
||||||
#include "text/GrAtlasManager.h"
|
#include "text/GrAtlasManager.h"
|
||||||
#include "text/GrGlyphCache.h"
|
#include "text/GrStrikeCache.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ void GrAtlasTextOp::onPrepareDraws(Target* target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
GrAtlasManager* atlasManager = target->atlasManager();
|
GrAtlasManager* atlasManager = target->atlasManager();
|
||||||
GrGlyphCache* glyphCache = target->glyphCache();
|
GrStrikeCache* glyphCache = target->glyphCache();
|
||||||
|
|
||||||
GrMaskFormat maskFormat = this->maskFormat();
|
GrMaskFormat maskFormat = this->maskFormat();
|
||||||
|
|
||||||
|
@ -11,7 +11,6 @@
|
|||||||
#include "ops/GrMeshDrawOp.h"
|
#include "ops/GrMeshDrawOp.h"
|
||||||
#include "text/GrTextBlob.h"
|
#include "text/GrTextBlob.h"
|
||||||
#include "text/GrDistanceFieldAdjustTable.h"
|
#include "text/GrDistanceFieldAdjustTable.h"
|
||||||
#include "text/GrGlyphCache.h"
|
|
||||||
|
|
||||||
class SkAtlasTextTarget;
|
class SkAtlasTextTarget;
|
||||||
class GrContext;
|
class GrContext;
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
class GrAtlasManager;
|
class GrAtlasManager;
|
||||||
class GrCaps;
|
class GrCaps;
|
||||||
class GrGlyphCache;
|
class GrStrikeCache;
|
||||||
class GrOpFlushState;
|
class GrOpFlushState;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -190,7 +190,7 @@ public:
|
|||||||
virtual GrResourceProvider* resourceProvider() const = 0;
|
virtual GrResourceProvider* resourceProvider() const = 0;
|
||||||
uint32_t contextUniqueID() const { return this->resourceProvider()->contextUniqueID(); }
|
uint32_t contextUniqueID() const { return this->resourceProvider()->contextUniqueID(); }
|
||||||
|
|
||||||
virtual GrGlyphCache* glyphCache() const = 0;
|
virtual GrStrikeCache* glyphCache() const = 0;
|
||||||
virtual GrAtlasManager* atlasManager() const = 0;
|
virtual GrAtlasManager* atlasManager() const = 0;
|
||||||
|
|
||||||
virtual const GrCaps& caps() const = 0;
|
virtual const GrCaps& caps() const = 0;
|
||||||
|
@ -8,9 +8,9 @@
|
|||||||
#include "GrAtlasManager.h"
|
#include "GrAtlasManager.h"
|
||||||
|
|
||||||
#include "GrGlyph.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,
|
size_t maxTextureBytes,
|
||||||
GrDrawOpAtlas::AllowMultitexturing allowMultitexturing)
|
GrDrawOpAtlas::AllowMultitexturing allowMultitexturing)
|
||||||
: fAllowMultitexturing{allowMultitexturing}
|
: fAllowMultitexturing{allowMultitexturing}
|
||||||
@ -64,7 +64,7 @@ bool GrAtlasManager::hasGlyph(GrGlyph* glyph) {
|
|||||||
// add to texture atlas that matches this format
|
// add to texture atlas that matches this format
|
||||||
GrDrawOpAtlas::ErrorCode GrAtlasManager::addToAtlas(
|
GrDrawOpAtlas::ErrorCode GrAtlasManager::addToAtlas(
|
||||||
GrResourceProvider* resourceProvider,
|
GrResourceProvider* resourceProvider,
|
||||||
GrGlyphCache* glyphCache,
|
GrStrikeCache* glyphCache,
|
||||||
GrTextStrike* strike, GrDrawOpAtlas::AtlasID* id,
|
GrTextStrike* strike, GrDrawOpAtlas::AtlasID* id,
|
||||||
GrDeferredUploadTarget* target, GrMaskFormat format,
|
GrDeferredUploadTarget* target, GrMaskFormat format,
|
||||||
int width, int height, const void* image, SkIPoint16* loc) {
|
int width, int height, const void* image, SkIPoint16* loc) {
|
||||||
@ -186,7 +186,7 @@ bool GrAtlasManager::initAtlas(GrMaskFormat format) {
|
|||||||
fAtlases[index] = GrDrawOpAtlas::Make(
|
fAtlases[index] = GrDrawOpAtlas::Make(
|
||||||
fProxyProvider, format, config, atlasDimensions.width(), atlasDimensions.height(),
|
fProxyProvider, format, config, atlasDimensions.width(), atlasDimensions.height(),
|
||||||
plotDimensions.width(), plotDimensions.height(), fAllowMultitexturing,
|
plotDimensions.width(), plotDimensions.height(), fAllowMultitexturing,
|
||||||
&GrGlyphCache::HandleEviction, fGlyphCache);
|
&GrStrikeCache::HandleEviction, fGlyphCache);
|
||||||
if (!fAtlases[index]) {
|
if (!fAtlases[index]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -13,9 +13,8 @@
|
|||||||
#include "GrOnFlushResourceProvider.h"
|
#include "GrOnFlushResourceProvider.h"
|
||||||
#include "GrProxyProvider.h"
|
#include "GrProxyProvider.h"
|
||||||
|
|
||||||
class GrAtlasGlypCache;
|
|
||||||
class GrTextStrike;
|
|
||||||
struct GrGlyph;
|
struct GrGlyph;
|
||||||
|
class GrTextStrike;
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/** The GrAtlasManager manages the lifetime of and access to GrDrawOpAtlases.
|
/** The GrAtlasManager manages the lifetime of and access to GrDrawOpAtlases.
|
||||||
@ -26,13 +25,13 @@ struct GrGlyph;
|
|||||||
*/
|
*/
|
||||||
class GrAtlasManager : public GrOnFlushCallbackObject {
|
class GrAtlasManager : public GrOnFlushCallbackObject {
|
||||||
public:
|
public:
|
||||||
GrAtlasManager(GrProxyProvider*, GrGlyphCache*,
|
GrAtlasManager(GrProxyProvider*, GrStrikeCache*,
|
||||||
size_t maxTextureBytes, GrDrawOpAtlas::AllowMultitexturing);
|
size_t maxTextureBytes, GrDrawOpAtlas::AllowMultitexturing);
|
||||||
~GrAtlasManager() override;
|
~GrAtlasManager() override;
|
||||||
|
|
||||||
// Change an expected 565 mask format to 8888 if 565 is not supported (will happen when using
|
// 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
|
// 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 {
|
GrMaskFormat resolveMaskFormat(GrMaskFormat format) const {
|
||||||
if (kA565_GrMaskFormat == format &&
|
if (kA565_GrMaskFormat == format &&
|
||||||
!fProxyProvider->caps()->isConfigTexturable(kRGB_565_GrPixelConfig)) {
|
!fProxyProvider->caps()->isConfigTexturable(kRGB_565_GrPixelConfig)) {
|
||||||
@ -42,7 +41,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
// if getProxies returns nullptr, the client must not try to use other functions on the
|
// 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
|
// functions which use the atlas. Note that we can have proxies available but none active
|
||||||
// (i.e., none instantiated).
|
// (i.e., none instantiated).
|
||||||
const sk_sp<GrTextureProxy>* getProxies(GrMaskFormat format, unsigned int* numActiveProxies) {
|
const sk_sp<GrTextureProxy>* getProxies(GrMaskFormat format, unsigned int* numActiveProxies) {
|
||||||
@ -75,7 +74,7 @@ public:
|
|||||||
|
|
||||||
// add to texture atlas that matches this format
|
// add to texture atlas that matches this format
|
||||||
GrDrawOpAtlas::ErrorCode addToAtlas(
|
GrDrawOpAtlas::ErrorCode addToAtlas(
|
||||||
GrResourceProvider*, GrGlyphCache*, GrTextStrike*,
|
GrResourceProvider*, GrStrikeCache*, GrTextStrike*,
|
||||||
GrDrawOpAtlas::AtlasID*, GrDeferredUploadTarget*, GrMaskFormat,
|
GrDrawOpAtlas::AtlasID*, GrDeferredUploadTarget*, GrMaskFormat,
|
||||||
int width, int height, const void* image, SkIPoint16* loc);
|
int width, int height, const void* image, SkIPoint16* loc);
|
||||||
|
|
||||||
@ -146,7 +145,7 @@ private:
|
|||||||
std::unique_ptr<GrDrawOpAtlas> fAtlases[kMaskFormatCount];
|
std::unique_ptr<GrDrawOpAtlas> fAtlases[kMaskFormatCount];
|
||||||
GrProxyProvider* fProxyProvider;
|
GrProxyProvider* fProxyProvider;
|
||||||
sk_sp<const GrCaps> fCaps;
|
sk_sp<const GrCaps> fCaps;
|
||||||
GrGlyphCache* fGlyphCache;
|
GrStrikeCache* fGlyphCache;
|
||||||
GrDrawOpAtlasConfig fAtlasConfig;
|
GrDrawOpAtlasConfig fAtlasConfig;
|
||||||
|
|
||||||
typedef GrOnFlushCallbackObject INHERITED;
|
typedef GrOnFlushCallbackObject INHERITED;
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
* found in the LICENSE file.
|
* found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "GrGlyphCache.h"
|
#include "GrStrikeCache.h"
|
||||||
#include "GrAtlasManager.h"
|
#include "GrAtlasManager.h"
|
||||||
#include "GrCaps.h"
|
#include "GrCaps.h"
|
||||||
#include "GrColor.h"
|
#include "GrColor.h"
|
||||||
@ -14,12 +14,12 @@
|
|||||||
#include "SkAutoMalloc.h"
|
#include "SkAutoMalloc.h"
|
||||||
#include "SkDistanceFieldGen.h"
|
#include "SkDistanceFieldGen.h"
|
||||||
|
|
||||||
GrGlyphCache::GrGlyphCache(const GrCaps* caps, size_t maxTextureBytes)
|
GrStrikeCache::GrStrikeCache(const GrCaps* caps, size_t maxTextureBytes)
|
||||||
: fPreserveStrike(nullptr)
|
: fPreserveStrike(nullptr)
|
||||||
, f565Masks(SkMasks::CreateMasks({0xF800, 0x07E0, 0x001F, 0},
|
, f565Masks(SkMasks::CreateMasks({0xF800, 0x07E0, 0x001F, 0},
|
||||||
GrMaskFormatBytesPerPixel(kA565_GrMaskFormat) * 8)) { }
|
GrMaskFormatBytesPerPixel(kA565_GrMaskFormat) * 8)) { }
|
||||||
|
|
||||||
GrGlyphCache::~GrGlyphCache() {
|
GrStrikeCache::~GrStrikeCache() {
|
||||||
StrikeHash::Iter iter(&fCache);
|
StrikeHash::Iter iter(&fCache);
|
||||||
while (!iter.done()) {
|
while (!iter.done()) {
|
||||||
(*iter).fIsAbandoned = true;
|
(*iter).fIsAbandoned = true;
|
||||||
@ -28,7 +28,7 @@ GrGlyphCache::~GrGlyphCache() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGlyphCache::freeAll() {
|
void GrStrikeCache::freeAll() {
|
||||||
StrikeHash::Iter iter(&fCache);
|
StrikeHash::Iter iter(&fCache);
|
||||||
while (!iter.done()) {
|
while (!iter.done()) {
|
||||||
(*iter).fIsAbandoned = true;
|
(*iter).fIsAbandoned = true;
|
||||||
@ -38,8 +38,8 @@ void GrGlyphCache::freeAll() {
|
|||||||
fCache.rewind();
|
fCache.rewind();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GrGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
|
void GrStrikeCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
|
||||||
GrGlyphCache* glyphCache = reinterpret_cast<GrGlyphCache*>(ptr);
|
GrStrikeCache* glyphCache = reinterpret_cast<GrStrikeCache*>(ptr);
|
||||||
|
|
||||||
StrikeHash::Iter iter(&glyphCache->fCache);
|
StrikeHash::Iter iter(&glyphCache->fCache);
|
||||||
for (; !iter.done(); ++iter) {
|
for (; !iter.done(); ++iter) {
|
||||||
@ -193,7 +193,7 @@ void GrTextStrike::removeID(GrDrawOpAtlas::AtlasID id) {
|
|||||||
GrDrawOpAtlas::ErrorCode GrTextStrike::addGlyphToAtlas(
|
GrDrawOpAtlas::ErrorCode GrTextStrike::addGlyphToAtlas(
|
||||||
GrResourceProvider* resourceProvider,
|
GrResourceProvider* resourceProvider,
|
||||||
GrDeferredUploadTarget* target,
|
GrDeferredUploadTarget* target,
|
||||||
GrGlyphCache* glyphCache,
|
GrStrikeCache* glyphCache,
|
||||||
GrAtlasManager* fullAtlasManager,
|
GrAtlasManager* fullAtlasManager,
|
||||||
GrGlyph* glyph,
|
GrGlyph* glyph,
|
||||||
SkStrike* cache,
|
SkStrike* cache,
|
@ -5,8 +5,8 @@
|
|||||||
* found in the LICENSE file.
|
* found in the LICENSE file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef GrAtlasGlyphCache_DEFINED
|
#ifndef GrStrikeCache_DEFINED
|
||||||
#define GrAtlasGlyphCache_DEFINED
|
#define GrStrikeCache_DEFINED
|
||||||
|
|
||||||
#include "GrDrawOpAtlas.h"
|
#include "GrDrawOpAtlas.h"
|
||||||
#include "GrGlyph.h"
|
#include "GrGlyph.h"
|
||||||
@ -15,16 +15,16 @@
|
|||||||
#include "SkStrike.h"
|
#include "SkStrike.h"
|
||||||
#include "SkTDynamicHash.h"
|
#include "SkTDynamicHash.h"
|
||||||
|
|
||||||
class GrGlyphCache;
|
|
||||||
class GrAtlasManager;
|
class GrAtlasManager;
|
||||||
class GrGpu;
|
class GrGpu;
|
||||||
|
class GrStrikeCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The GrTextStrike manages a pool of CPU backing memory for GrGlyphs. This backing memory
|
* 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.
|
* is indexed by a PackedID and SkStrike. The SkStrike is what actually creates the mask.
|
||||||
* The GrTextStrike may outlive the generating SkGlyphCache. However, it retains a copy
|
* The GrTextStrike may outlive the generating SkStrike. However, it retains a copy
|
||||||
* of it's SkDescriptor as a key to access (or regenerate) the SkGlyphCache. GrTextStrikes are
|
* of it's SkDescriptor as a key to access (or regenerate) the SkStrike. GrTextStrikes are
|
||||||
* created by and owned by a GrGlyphCache.
|
* created by and owned by a GrStrikeCache.
|
||||||
*/
|
*/
|
||||||
class GrTextStrike : public SkNVRefCnt<GrTextStrike> {
|
class GrTextStrike : public SkNVRefCnt<GrTextStrike> {
|
||||||
public:
|
public:
|
||||||
@ -61,7 +61,7 @@ public:
|
|||||||
// TODO we can handle some of these cases if we really want to, but the long term solution is to
|
// 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.
|
// get the actual glyph image itself when we get the glyph metrics.
|
||||||
GrDrawOpAtlas::ErrorCode addGlyphToAtlas(GrResourceProvider*, GrDeferredUploadTarget*,
|
GrDrawOpAtlas::ErrorCode addGlyphToAtlas(GrResourceProvider*, GrDeferredUploadTarget*,
|
||||||
GrGlyphCache*, GrAtlasManager*, GrGlyph*,
|
GrStrikeCache*, GrAtlasManager*, GrGlyph*,
|
||||||
SkStrike*, GrMaskFormat expectedMaskFormat,
|
SkStrike*, GrMaskFormat expectedMaskFormat,
|
||||||
bool isScaledGlyph);
|
bool isScaledGlyph);
|
||||||
|
|
||||||
@ -94,17 +94,17 @@ private:
|
|||||||
|
|
||||||
GrGlyph* generateGlyph(const SkGlyph&);
|
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.
|
* used to generate individual Glyph Masks.
|
||||||
*/
|
*/
|
||||||
class GrGlyphCache {
|
class GrStrikeCache {
|
||||||
public:
|
public:
|
||||||
GrGlyphCache(const GrCaps* caps, size_t maxTextureBytes);
|
GrStrikeCache(const GrCaps* caps, size_t maxTextureBytes);
|
||||||
~GrGlyphCache();
|
~GrStrikeCache();
|
||||||
|
|
||||||
void setStrikeToPreserve(GrTextStrike* strike) { fPreserveStrike = strike; }
|
void setStrikeToPreserve(GrTextStrike* strike) { fPreserveStrike = strike; }
|
||||||
|
|
||||||
@ -141,4 +141,4 @@ private:
|
|||||||
std::unique_ptr<const SkMasks> f565Masks;
|
std::unique_ptr<const SkMasks> f565Masks;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif // GrStrikeCache_DEFINED
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
#include "GrColor.h"
|
#include "GrColor.h"
|
||||||
#include "GrDrawOpAtlas.h"
|
#include "GrDrawOpAtlas.h"
|
||||||
#include "GrGlyphCache.h"
|
#include "GrStrikeCache.h"
|
||||||
#include "GrTextTarget.h"
|
#include "GrTextTarget.h"
|
||||||
#include "text/GrTextContext.h"
|
#include "text/GrTextContext.h"
|
||||||
#include "SkDescriptor.h"
|
#include "SkDescriptor.h"
|
||||||
@ -55,7 +55,7 @@ public:
|
|||||||
|
|
||||||
class VertexRegenerator;
|
class VertexRegenerator;
|
||||||
|
|
||||||
void generateFromGlyphRunList(GrGlyphCache* glyphCache,
|
void generateFromGlyphRunList(GrStrikeCache* glyphCache,
|
||||||
const GrShaderCaps& shaderCaps,
|
const GrShaderCaps& shaderCaps,
|
||||||
const GrTextContext::Options& options,
|
const GrTextContext::Options& options,
|
||||||
const SkPaint& paint,
|
const SkPaint& paint,
|
||||||
@ -571,7 +571,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
VertexRegenerator(GrResourceProvider*, GrTextBlob*, int runIdx, int subRunIdx,
|
VertexRegenerator(GrResourceProvider*, GrTextBlob*, int runIdx, int subRunIdx,
|
||||||
const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color,
|
const SkMatrix& viewMatrix, SkScalar x, SkScalar y, GrColor color,
|
||||||
GrDeferredUploadTarget*, GrGlyphCache*, GrAtlasManager*,
|
GrDeferredUploadTarget*, GrStrikeCache*, GrAtlasManager*,
|
||||||
SkExclusiveStrikePtr*);
|
SkExclusiveStrikePtr*);
|
||||||
|
|
||||||
struct Result {
|
struct Result {
|
||||||
@ -602,7 +602,7 @@ private:
|
|||||||
const SkMatrix& fViewMatrix;
|
const SkMatrix& fViewMatrix;
|
||||||
GrTextBlob* fBlob;
|
GrTextBlob* fBlob;
|
||||||
GrDeferredUploadTarget* fUploadTarget;
|
GrDeferredUploadTarget* fUploadTarget;
|
||||||
GrGlyphCache* fGlyphCache;
|
GrStrikeCache* fGlyphCache;
|
||||||
GrAtlasManager* fFullAtlasManager;
|
GrAtlasManager* fFullAtlasManager;
|
||||||
SkExclusiveStrikePtr* fLazyCache;
|
SkExclusiveStrikePtr* fLazyCache;
|
||||||
Run* fRun;
|
Run* fRun;
|
||||||
|
@ -121,7 +121,7 @@ GrTextBlob::VertexRegenerator::VertexRegenerator(GrResourceProvider* resourcePro
|
|||||||
const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
|
const SkMatrix& viewMatrix, SkScalar x, SkScalar y,
|
||||||
GrColor color,
|
GrColor color,
|
||||||
GrDeferredUploadTarget* uploadTarget,
|
GrDeferredUploadTarget* uploadTarget,
|
||||||
GrGlyphCache* glyphCache,
|
GrStrikeCache* glyphCache,
|
||||||
GrAtlasManager* fullAtlasManager,
|
GrAtlasManager* fullAtlasManager,
|
||||||
SkExclusiveStrikePtr* lazyCache)
|
SkExclusiveStrikePtr* lazyCache)
|
||||||
: fResourceProvider(resourceProvider)
|
: fResourceProvider(resourceProvider)
|
||||||
@ -137,7 +137,7 @@ GrTextBlob::VertexRegenerator::VertexRegenerator(GrResourceProvider* resourcePro
|
|||||||
// Compute translation if any
|
// Compute translation if any
|
||||||
fSubRun->computeTranslation(fViewMatrix, x, y, &fTransX, &fTransY);
|
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
|
// 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
|
// 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.
|
// otherwise we have to get the new strike, and use that to get the correct glyphs.
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "ccpr/GrCoverageCountingPathRenderer.h"
|
#include "ccpr/GrCoverageCountingPathRenderer.h"
|
||||||
#include "ccpr/GrCCPathCache.h"
|
#include "ccpr/GrCCPathCache.h"
|
||||||
#include "ops/GrMeshDrawOp.h"
|
#include "ops/GrMeshDrawOp.h"
|
||||||
#include "text/GrGlyphCache.h"
|
#include "text/GrStrikeCache.h"
|
||||||
#include "text/GrTextBlobCache.h"
|
#include "text/GrTextBlobCache.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
Loading…
Reference in New Issue
Block a user