Index: src/core/SkBitmapProcShader.cpp |
diff --git a/src/core/SkBitmapProcShader.cpp b/src/core/SkBitmapProcShader.cpp |
index e5b577a20c9bb15b6ce63b926ffadf09c922ada7..804c688320788eecb347ff1be37586ca57423def 100644 |
--- a/src/core/SkBitmapProcShader.cpp |
+++ b/src/core/SkBitmapProcShader.cpp |
@@ -99,6 +99,11 @@ SkShader::Context* SkBitmapProcShader::onCreateContext(const ContextRec& rec, vo |
SkBitmapProvider(fRawBitmap), rec, storage); |
} |
+static bool only_scale_and_translate(const SkMatrix& matrix) { |
+ unsigned mask = SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask; |
+ return (matrix.getType() & ~mask) == 0; |
+} |
+ |
SkBitmapProcShader::BitmapProcShaderContext::BitmapProcShaderContext(const SkShader& shader, |
const ContextRec& rec, |
SkBitmapProcState* state) |
@@ -109,6 +114,10 @@ SkBitmapProcShader::BitmapProcShaderContext::BitmapProcShaderContext(const SkSha |
if (fState->fPixmap.isOpaque() && (255 == this->getPaintAlpha())) { |
fFlags |= kOpaqueAlpha_Flag; |
} |
+ |
+ if (1 == fState->fPixmap.height() && only_scale_and_translate(this->getTotalInverse())) { |
+ fFlags |= kConstInY32_Flag; |
+ } |
} |
SkBitmapProcShader::BitmapProcShaderContext::~BitmapProcShaderContext() { |