Include scaler context flags (gamma and contrast boost) in the text blob cache key.
Fixes a bug in skiaserve when switching between L32 and S32 modes - we were
reusing blobs created with the other (wrong) masks.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1905683004
Review URL: https://codereview.chromium.org/1905683004
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h
index 3fd4599..084de62 100644
--- a/src/gpu/text/GrAtlasTextBlob.h
+++ b/src/gpu/text/GrAtlasTextBlob.h
@@ -61,6 +61,7 @@
SkPaint::Style fStyle;
SkPixelGeometry fPixelGeometry;
bool fHasBlur;
+ uint32_t fScalerContextFlags;
bool operator==(const Key& other) const {
return 0 == memcmp(this, &other, sizeof(Key));
diff --git a/src/gpu/text/GrAtlasTextContext.cpp b/src/gpu/text/GrAtlasTextContext.cpp
index 22fd8a3..ff62b1f 100644
--- a/src/gpu/text/GrAtlasTextContext.cpp
+++ b/src/gpu/text/GrAtlasTextContext.cpp
@@ -96,6 +96,7 @@
bool canCache = !(skPaint.getPathEffect() ||
(mf && !mf->asABlur(&blurRec)) ||
drawFilter);
+ uint32_t scalerContextFlags = ComputeScalerContextFlags(dc);
GrTextBlobCache* cache = context->getTextBlobCache();
if (canCache) {
@@ -116,6 +117,7 @@
key.fStyle = skPaint.getStyle();
key.fHasBlur = SkToBool(mf);
key.fCanonicalColor = canonicalColor;
+ key.fScalerContextFlags = scalerContextFlags;
cacheBlob.reset(SkSafeRef(cache->find(key)));
}
@@ -126,8 +128,6 @@
return;
}
- uint32_t scalerContextFlags = ComputeScalerContextFlags(dc);
-
if (cacheBlob) {
if (cacheBlob->mustRegenerate(skPaint, grPaint.getColor(), blurRec, viewMatrix, x, y)) {
// We have to remake the blob because changes may invalidate our masks.