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
This commit is contained in:
brianosman 2016-04-21 08:29:06 -07:00 committed by Commit bot
parent 58a8d9214a
commit 8d7ffcee75
2 changed files with 3 additions and 2 deletions

View File

@ -61,6 +61,7 @@ public:
SkPaint::Style fStyle;
SkPixelGeometry fPixelGeometry;
bool fHasBlur;
uint32_t fScalerContextFlags;
bool operator==(const Key& other) const {
return 0 == memcmp(this, &other, sizeof(Key));

View File

@ -96,6 +96,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc,
bool canCache = !(skPaint.getPathEffect() ||
(mf && !mf->asABlur(&blurRec)) ||
drawFilter);
uint32_t scalerContextFlags = ComputeScalerContextFlags(dc);
GrTextBlobCache* cache = context->getTextBlobCache();
if (canCache) {
@ -116,6 +117,7 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc,
key.fStyle = skPaint.getStyle();
key.fHasBlur = SkToBool(mf);
key.fCanonicalColor = canonicalColor;
key.fScalerContextFlags = scalerContextFlags;
cacheBlob.reset(SkSafeRef(cache->find(key)));
}
@ -126,8 +128,6 @@ void GrAtlasTextContext::drawTextBlob(GrContext* context, GrDrawContext* dc,
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.