Chromium Code Reviews| Index: src/gpu/GrAtlasTextContext.cpp |
| diff --git a/src/gpu/GrAtlasTextContext.cpp b/src/gpu/GrAtlasTextContext.cpp |
| index b6e0acc58f8660d7fd6b60fabebe94390df443dd..5e933d94e40716188b581859c6a0643d091f3a15 100644 |
| --- a/src/gpu/GrAtlasTextContext.cpp |
| +++ b/src/gpu/GrAtlasTextContext.cpp |
| @@ -242,11 +242,13 @@ bool GrAtlasTextContext::HasLCD(const SkTextBlob* blob) { |
| bool GrAtlasTextContext::MustRegenerateBlob(SkScalar* outTransX, SkScalar* outTransY, |
| const GrAtlasTextBlob& blob, const SkPaint& paint, |
| - const SkMaskFilter::BlurRec& blurRec, |
| + GrColor color, const SkMaskFilter::BlurRec& blurRec, |
| const SkMatrix& viewMatrix, SkScalar x, SkScalar y) { |
| // If we have LCD text then our canonical color will be set to transparent, in this case we have |
| // to regenerate the blob on any color change |
| - if (blob.fKey.fCanonicalColor == SK_ColorTRANSPARENT && blob.fPaintColor != paint.getColor()) { |
| + // We use the grPaint to get any color filter effects |
| + if (blob.fKey.fCanonicalColor == SK_ColorTRANSPARENT && |
| + blob.fPaintColor != color) { |
| return true; |
| } |
| @@ -395,7 +397,8 @@ void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt, |
| } |
| if (cacheBlob) { |
| - if (MustRegenerateBlob(&transX, &transY, *cacheBlob, skPaint, blurRec, viewMatrix, x, y)) { |
| + if (MustRegenerateBlob(&transX, &transY, *cacheBlob, skPaint, grPaint.getColor(), blurRec, |
| + viewMatrix, x, y)) { |
| // We have to remake the blob because changes may invalidate our masks. |
| // TODO we could probably get away reuse most of the time if the pointer is unique, |
| // but we'd have to clear the subrun information |
| @@ -403,7 +406,7 @@ void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt, |
| cacheBlob.reset(SkRef(fCache->createCachedBlob(blob, key, blurRec, skPaint, |
| kGrayTextVASize))); |
| this->regenerateTextBlob(cacheBlob, skPaint, grPaint.getColor(), viewMatrix, |
| - blob, x, y, drawFilter, clipRect, rt, clip, grPaint); |
| + blob, x, y, drawFilter, clipRect, rt, clip); |
| } else { |
| // If we can reuse the blob, then make sure we update the blob's viewmatrix, and x/y |
| // offsets. Note, we offset the vertex bounds right before flushing |
| @@ -420,7 +423,7 @@ void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt, |
| kGrayTextVASize)); |
| GrTextBlobCache::SetupCacheBlobKey(sanityBlob, key, blurRec, skPaint); |
| this->regenerateTextBlob(sanityBlob, skPaint, grPaint.getColor(), viewMatrix, |
| - blob, x, y, drawFilter, clipRect, rt, clip, grPaint); |
| + blob, x, y, drawFilter, clipRect, rt, clip); |
| GrAtlasTextBlob::AssertEqual(*sanityBlob, *cacheBlob); |
| } |
| @@ -434,7 +437,7 @@ void GrAtlasTextContext::drawTextBlob(GrRenderTarget* rt, |
| cacheBlob.reset(fCache->createBlob(blob, kGrayTextVASize)); |
| } |
| this->regenerateTextBlob(cacheBlob, skPaint, grPaint.getColor(), viewMatrix, |
| - blob, x, y, drawFilter, clipRect, rt, clip, grPaint); |
| + blob, x, y, drawFilter, clipRect, rt, clip); |
| } |
| this->flush(blob, cacheBlob, rt, skPaint, grPaint, drawFilter, |
| @@ -485,9 +488,8 @@ void GrAtlasTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob, |
| const SkMatrix& viewMatrix, |
| const SkTextBlob* blob, SkScalar x, SkScalar y, |
| SkDrawFilter* drawFilter, const SkIRect& clipRect, |
| - GrRenderTarget* rt, const GrClip& clip, |
| - const GrPaint& paint) { |
| - cacheBlob->fPaintColor = skPaint.getColor(); |
| + GrRenderTarget* rt, const GrClip& clip) { |
| + cacheBlob->fPaintColor = color; |
|
joshualitt
2015/08/18 14:25:52
Could we put a comment here explaining that this i
jvanverth1
2015/08/18 14:37:53
Done.
|
| cacheBlob->fViewMatrix = viewMatrix; |
| cacheBlob->fX = x; |
| cacheBlob->fY = y; |
| @@ -566,7 +568,7 @@ void GrAtlasTextContext::regenerateTextBlob(GrAtlasTextBlob* cacheBlob, |
| } |
| } |
| if (fallbackTxt.count()) { |
| - this->fallbackDrawPosText(cacheBlob, run, rt, clip, paint, runPaint, viewMatrix, |
| + this->fallbackDrawPosText(cacheBlob, run, rt, clip, color, runPaint, viewMatrix, |
| fallbackTxt, fallbackPos, scalarsPerPosition, dfOffset, |
| clipRect); |
| } |
| @@ -662,7 +664,7 @@ inline void GrAtlasTextContext::initDistanceFieldPaint(GrAtlasTextBlob* blob, |
| inline void GrAtlasTextContext::fallbackDrawPosText(GrAtlasTextBlob* blob, |
| int runIndex, |
| GrRenderTarget* rt, const GrClip& clip, |
| - const GrPaint& paint, |
| + GrColor color, |
| const SkPaint& skPaint, |
| const SkMatrix& viewMatrix, |
| const SkTDArray<char>& fallbackTxt, |
| @@ -680,7 +682,7 @@ inline void GrAtlasTextContext::fallbackDrawPosText(GrAtlasTextBlob* blob, |
| fSurfaceProps, &viewMatrix, false); |
| SkGlyphCache* cache = SkGlyphCache::DetachCache(run.fTypeface, |
| run.fOverrideDescriptor->getDesc()); |
| - this->internalDrawBMPPosText(blob, runIndex, cache, skPaint, paint.getColor(), viewMatrix, |
| + this->internalDrawBMPPosText(blob, runIndex, cache, skPaint, color, viewMatrix, |
| fallbackTxt.begin(), fallbackTxt.count(), |
| fallbackPos.begin(), scalarsPerPosition, offset, clipRect); |
| SkGlyphCache::AttachCache(cache); |
| @@ -729,8 +731,8 @@ GrAtlasTextContext::createDrawTextBlob(GrRenderTarget* rt, const GrClip& clip, |
| &offset, skPaint); |
| SkGlyphCache::AttachCache(cache); |
| if (fallbackTxt.count()) { |
| - this->fallbackDrawPosText(blob, 0, rt, clip, paint, skPaint, viewMatrix, fallbackTxt, |
| - fallbackPos, 2, offset, clipRect); |
| + this->fallbackDrawPosText(blob, 0, rt, clip, paint.getColor(), skPaint, viewMatrix, |
| + fallbackTxt, fallbackPos, 2, offset, clipRect); |
| } |
| } else { |
| blob = fCache->createBlob(glyphCount, 1, kGrayTextVASize); |
| @@ -770,8 +772,9 @@ GrAtlasTextContext::createDrawPosTextBlob(GrRenderTarget* rt, const GrClip& clip |
| textRatio, &fallbackTxt, &fallbackPos); |
| SkGlyphCache::AttachCache(cache); |
| if (fallbackTxt.count()) { |
| - this->fallbackDrawPosText(blob, 0, rt, clip, paint, skPaint, viewMatrix, fallbackTxt, |
| - fallbackPos, scalarsPerPosition, offset, clipRect); |
| + this->fallbackDrawPosText(blob, 0, rt, clip, paint.getColor(), skPaint, viewMatrix, |
| + fallbackTxt, fallbackPos, scalarsPerPosition, offset, |
| + clipRect); |
| } |
| } else { |
| blob = fCache->createBlob(glyphCount, 1, kGrayTextVASize); |