Index: src/core/SkBitmapProcShader.cpp |
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp |
index c3b10184f4429981d69d18ce888b4af1bb61f609..e382d09c9977ce5d01623809920bd15a1398fe16 100644 |
--- a/src/core/SkBitmapProcShader.cpp |
+++ b/src/core/SkBitmapProcShader.cpp |
@@ -15,7 +15,6 @@ |
#if SK_SUPPORT_GPU |
#include "effects/GrBicubicEffect.h" |
-#include "effects/GrExtractAlphaFragmentProcessor.h" |
#include "effects/GrSimpleTextureEffect.h" |
#endif |
@@ -354,21 +353,22 @@ |
#include "SkGr.h" |
#include "effects/GrSimpleTextureEffect.h" |
-const GrFragmentProcessor* SkBitmapProcShader::asFragmentProcessor(GrContext* context, |
- const SkMatrix& viewM, const SkMatrix* localMatrix, |
- SkFilterQuality filterQuality, |
- GrProcessorDataManager* procDataManager) const { |
+bool SkBitmapProcShader::asFragmentProcessor(GrContext* context, const SkPaint& paint, |
+ const SkMatrix& viewM, |
+ const SkMatrix* localMatrix, GrColor* paintColor, |
+ GrProcessorDataManager* procDataManager, |
+ GrFragmentProcessor** fp) const { |
SkMatrix matrix; |
matrix.setIDiv(fRawBitmap.width(), fRawBitmap.height()); |
SkMatrix lmInverse; |
if (!this->getLocalMatrix().invert(&lmInverse)) { |
- return nullptr; |
+ return false; |
} |
if (localMatrix) { |
SkMatrix inv; |
if (!localMatrix->invert(&inv)) { |
- return nullptr; |
+ return false; |
} |
lmInverse.postConcat(inv); |
} |
@@ -385,7 +385,7 @@ |
// are provided by the caller. |
bool doBicubic; |
GrTextureParams::FilterMode textureFilterMode = |
- GrSkFilterQualityToGrFilterMode(filterQuality, viewM, this->getLocalMatrix(), |
+ GrSkFilterQualityToGrFilterMode(paint.getFilterQuality(), viewM, this->getLocalMatrix(), |
&doBicubic); |
GrTextureParams params(tm, textureFilterMode); |
SkAutoTUnref<GrTexture> texture(GrRefCachedBitmapTexture(context, fRawBitmap, ¶ms)); |
@@ -393,20 +393,29 @@ |
if (!texture) { |
SkErrorInternals::SetError( kInternalError_SkError, |
"Couldn't convert bitmap to texture."); |
- return nullptr; |
- } |
- |
- SkAutoTUnref<GrFragmentProcessor> inner; |
+ return false; |
+ } |
+ |
+ *paintColor = (kAlpha_8_SkColorType == fRawBitmap.colorType()) ? |
+ SkColor2GrColor(paint.getColor()) : |
+ SkColor2GrColorJustAlpha(paint.getColor()); |
+ |
if (doBicubic) { |
- inner.reset(GrBicubicEffect::Create(procDataManager, texture, matrix, tm)); |
+ *fp = GrBicubicEffect::Create(procDataManager, texture, matrix, tm); |
} else { |
- inner.reset(GrSimpleTextureEffect::Create(procDataManager, texture, matrix, params)); |
- } |
- |
- if (kAlpha_8_SkColorType == fRawBitmap.colorType()) { |
- return SkRef(inner.get()); |
- } |
- return GrExtractAlphaFragmentProcessor::Create(inner); |
-} |
- |
-#endif |
+ *fp = GrSimpleTextureEffect::Create(procDataManager, texture, matrix, params); |
+ } |
+ |
+ return true; |
+} |
+ |
+#else |
+ |
+bool SkBitmapProcShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&, |
+ const SkMatrix*, GrColor*, GrProcessorDataManager*, |
+ GrFragmentProcessor**) const { |
+ SkDEBUGFAIL("Should not call in GPU-less build"); |
+ return false; |
+} |
+ |
+#endif |