Centralize the max glyph dimension
Over several refactorings the max glyph dimension has become
a constant. Simplify the code by removing variables that can
only be constant.
Change-Id: I65800a5ec1dfd4de5337f2f37348bd0eb101cc3e
Reviewed-on: https://skia-review.googlesource.com/154123
Reviewed-by: Mike Klein <mtklein@google.com>
Commit-Queue: Herb Derby <herb@google.com>
diff --git a/src/gpu/text/GrAtlasManager.cpp b/src/gpu/text/GrAtlasManager.cpp
index c1b3d7b..143f84d 100644
--- a/src/gpu/text/GrAtlasManager.cpp
+++ b/src/gpu/text/GrAtlasManager.cpp
@@ -14,7 +14,6 @@
size_t maxTextureBytes,
GrDrawOpAtlas::AllowMultitexturing allowMultitexturing)
: fAllowMultitexturing{allowMultitexturing}
- , fGlyphSizeLimit{SkGlyphCacheCommon::kSkSideTooBigForAtlas}
, fProxyProvider{proxyProvider}
, fCaps{fProxyProvider->refCaps()}
, fGlyphCache{glyphCache}
diff --git a/src/gpu/text/GrAtlasManager.h b/src/gpu/text/GrAtlasManager.h
index e857ae8..e709c24 100644
--- a/src/gpu/text/GrAtlasManager.h
+++ b/src/gpu/text/GrAtlasManager.h
@@ -55,8 +55,6 @@
return nullptr;
}
- SkScalar getGlyphSizeLimit() const { return fGlyphSizeLimit; }
-
void freeAll();
bool hasGlyph(GrGlyph* glyph);
@@ -146,7 +144,6 @@
GrDrawOpAtlas::AllowMultitexturing fAllowMultitexturing;
std::unique_ptr<GrDrawOpAtlas> fAtlases[kMaskFormatCount];
- SkScalar fGlyphSizeLimit;
GrProxyProvider* fProxyProvider;
sk_sp<const GrCaps> fCaps;
GrGlyphCache* fGlyphCache;
diff --git a/src/gpu/text/GrGlyphCache.cpp b/src/gpu/text/GrGlyphCache.cpp
index 933a1c0..7fcd308 100644
--- a/src/gpu/text/GrGlyphCache.cpp
+++ b/src/gpu/text/GrGlyphCache.cpp
@@ -16,11 +16,8 @@
GrGlyphCache::GrGlyphCache(const GrCaps* caps, size_t maxTextureBytes)
: fPreserveStrike(nullptr)
- , fGlyphSizeLimit(0)
, f565Masks(SkMasks::CreateMasks({0xF800, 0x07E0, 0x001F, 0},
- GrMaskFormatBytesPerPixel(kA565_GrMaskFormat) * 8)) {
- fGlyphSizeLimit = ComputeGlyphSizeLimit(caps->maxTextureSize(), maxTextureBytes);
-}
+ GrMaskFormatBytesPerPixel(kA565_GrMaskFormat) * 8)) { }
GrGlyphCache::~GrGlyphCache() {
StrikeHash::Iter iter(&fCache);
@@ -41,10 +38,6 @@
fCache.rewind();
}
-SkScalar GrGlyphCache::ComputeGlyphSizeLimit(int maxTextureSize, size_t maxTextureBytes) {
- return SkGlyphCacheCommon::kSkSideTooBigForAtlas;
-}
-
void GrGlyphCache::HandleEviction(GrDrawOpAtlas::AtlasID id, void* ptr) {
GrGlyphCache* glyphCache = reinterpret_cast<GrGlyphCache*>(ptr);
diff --git a/src/gpu/text/GrGlyphCache.h b/src/gpu/text/GrGlyphCache.h
index 8375d1f..c38ba78 100644
--- a/src/gpu/text/GrGlyphCache.h
+++ b/src/gpu/text/GrGlyphCache.h
@@ -112,8 +112,6 @@
GrGlyphCache(const GrCaps* caps, size_t maxTextureBytes);
~GrGlyphCache();
- SkScalar getGlyphSizeLimit() const { return fGlyphSizeLimit; }
-
void setStrikeToPreserve(GrTextStrike* strike) { fPreserveStrike = strike; }
// The user of the cache may hold a long-lived ref to the returned strike. However, actions by
@@ -133,7 +131,6 @@
void freeAll();
static void HandleEviction(GrDrawOpAtlas::AtlasID, void*);
- static SkScalar ComputeGlyphSizeLimit(int maxTextureSize, size_t maxTextureBytes);
private:
sk_sp<GrTextStrike> generateStrike(const SkGlyphCache* cache) {
@@ -147,7 +144,6 @@
StrikeHash fCache;
GrTextStrike* fPreserveStrike;
- SkScalar fGlyphSizeLimit;
std::unique_ptr<const SkMasks> f565Masks;
};
diff --git a/src/gpu/text/GrTextContext.h b/src/gpu/text/GrTextContext.h
index 8965398..b313d4d 100644
--- a/src/gpu/text/GrTextContext.h
+++ b/src/gpu/text/GrTextContext.h
@@ -72,11 +72,9 @@
public:
FallbackGlyphRunHelper(const SkMatrix& viewMatrix,
const SkPaint& pathPaint,
- SkScalar maxTextSize,
SkScalar textRatio)
: fViewMatrix(viewMatrix)
, fTextSize(pathPaint.getTextSize())
- , fMaxTextSize(maxTextSize)
, fTextRatio(textRatio)
, fTransformedFallbackTextSize(fMaxTextSize)
, fUseTransformedFallback(false) {
@@ -98,7 +96,7 @@
const SkMatrix& fViewMatrix;
SkScalar fTextSize;
- SkScalar fMaxTextSize;
+ SkScalar fMaxTextSize{SkGlyphCacheCommon::kSkSideTooBigForAtlas};
SkScalar fTextRatio;
SkScalar fTransformedFallbackTextSize;
SkScalar fMaxScale;