Chromium Code Reviews| Index: src/core/SkBitmapProcShader.cpp |
| diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp |
| index 8e25530cee5dabe85cbfde36638fc0fe84533096..91975043a6d78ac0ef40515e3070a1ce8308f2cb 100644 |
| --- a/src/core/SkBitmapProcShader.cpp |
| +++ b/src/core/SkBitmapProcShader.cpp |
| @@ -382,19 +382,20 @@ void SkBitmapProcShader::toString(SkString* str) const { |
| #include "effects/GrSimpleTextureEffect.h" |
| #include "SkGr.h" |
| -GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, |
| - const SkMatrix* localMatrix) const { |
| +bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, |
| + const SkMatrix* localMatrix, GrColor* grColor, |
| + GrEffectRef** grEffect) const { |
| SkMatrix matrix; |
| matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); |
| SkMatrix lmInverse; |
| if (!this->getLocalMatrix().invert(&lmInverse)) { |
| - return NULL; |
| + return false; |
| } |
| if (localMatrix) { |
| SkMatrix inv; |
| if (!localMatrix->invert(&inv)) { |
| - return NULL; |
| + return false; |
| } |
| lmInverse.postConcat(inv); |
| } |
| @@ -450,16 +451,29 @@ GrEffectRef* SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& |
| if (NULL == texture) { |
| SkErrorInternals::SetError( kInternalError_SkError, |
| "Couldn't convert bitmap to texture."); |
| - return NULL; |
| + return false; |
| } |
| + |
| + *grColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ? SkColor2GrColor(paint.getColor()) |
|
dandov
2014/06/09 19:10:55
Fix for the bitmap shader bug
|
| + : *grColor = SkColor2GrColorJustAlpha(paint.getColor()); |
| - GrEffectRef* effect = NULL; |
| if (useBicubic) { |
| - effect = GrBicubicEffect::Create(texture, matrix, tm); |
| + *grEffect = GrBicubicEffect::Create(texture, matrix, tm); |
| } else { |
| - effect = GrSimpleTextureEffect::Create(texture, matrix, params); |
| + *grEffect = GrSimpleTextureEffect::Create(texture, matrix, params); |
| } |
| GrUnlockAndUnrefCachedBitmapTexture(texture); |
| - return effect; |
| + |
| + return true; |
| +} |
| + |
| +#else |
| + |
| +bool SkBitmapProcShader::asNewEffect(GrContext* context, const SkPaint& paint, |
|
dandov
2014/06/09 19:10:55
Added to have the same implementation as in Gradie
|
| + const SkMatrix* localMatrix, GrColor* grColor, |
| + GrEffectRef** grEffect) const { |
| + SkDEBUGFAIL("Should not call in GPU-less build"); |
| + return false; |
| } |
| + |
| #endif |