diff options
author | 2014-12-22 15:27:05 -0800 | |
---|---|---|
committer | 2014-12-22 15:27:05 -0800 | |
commit | 8fc6c2d82c1f30ff82274334c01f0799def6a609 (patch) | |
tree | 6499d32fd02b524167a690704d855e804f66c8a3 /src/gpu/GrBitmapTextContext.cpp | |
parent | 16c8f14cd481b78673a33450a1395958e3e10e62 (diff) |
This CL cleans up the last remaining users of localCoordChange on paint
NOTREECHECKS=True
BUG=skia:
Review URL: https://codereview.chromium.org/817853002
Diffstat (limited to 'src/gpu/GrBitmapTextContext.cpp')
-rwxr-xr-x | src/gpu/GrBitmapTextContext.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/gpu/GrBitmapTextContext.cpp b/src/gpu/GrBitmapTextContext.cpp index 732a514c4f..790590dbcc 100755 --- a/src/gpu/GrBitmapTextContext.cpp +++ b/src/gpu/GrBitmapTextContext.cpp @@ -154,7 +154,8 @@ void GrBitmapTextContext::onDrawText(const GrPaint& paint, const SkPaint& skPain SkFixed fx = SkScalarToFixed(x) + halfSampleX; SkFixed fy = SkScalarToFixed(y) + halfSampleY; - if (!fPaint.localCoordChangeInverse(viewMatrix)) { + // if we have RGB, then we won't have any SkShaders so no need to use a localmatrix + if (kARGB_GrMaskFormat != fCurrMaskFormat && !viewMatrix.invert(&fLocalMatrix)) { SkDebugf("Cannot invert viewmatrix\n"); } @@ -202,7 +203,9 @@ void GrBitmapTextContext::onDrawPosText(const GrPaint& paint, const SkPaint& skP // store original matrix before we reset, so we can use it to transform positions SkMatrix ctm = viewMatrix; - if (!fPaint.localCoordChangeInverse(viewMatrix)) { + + // if we have RGB, then we won't have any SkShaders so no need to use a localmatrix + if (kARGB_GrMaskFormat != fCurrMaskFormat && !viewMatrix.invert(&fLocalMatrix)) { SkDebugf("Cannot invert viewmatrix\n"); } @@ -559,7 +562,6 @@ void GrBitmapTextContext::flush() { } GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kNone_FilterMode); - // TODO cache these GPs if (kARGB_GrMaskFormat == fCurrMaskFormat) { uint32_t textureUniqueID = fCurrTexture->getUniqueID(); if (textureUniqueID != fEffectTextureUniqueID || @@ -569,19 +571,22 @@ void GrBitmapTextContext::flush() { fCachedTextureProcessor.reset(GrSimpleTextureEffect::Create(fCurrTexture, SkMatrix::I(), params)); + fEffectTextureUniqueID = textureUniqueID; } drawState.addColorProcessor(fCachedTextureProcessor.get()); } else { uint32_t textureUniqueID = fCurrTexture->getUniqueID(); if (textureUniqueID != fEffectTextureUniqueID || - fCachedGeometryProcessor->color() != color) { + fCachedGeometryProcessor->color() != color || + !fCachedGeometryProcessor->localMatrix().cheapEqualTo(fLocalMatrix)) { bool hasColor = kA8_GrMaskFormat == fCurrMaskFormat; bool opaqueVertexColors = GrColorIsOpaque(fPaint.getColor()); fCachedGeometryProcessor.reset(GrBitmapTextGeoProc::Create(color, fCurrTexture, params, hasColor, - opaqueVertexColors)); + opaqueVertexColors, + fLocalMatrix)); fEffectTextureUniqueID = textureUniqueID; } } |