Index: src/core/SkBitmapDevice.cpp |
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp |
index 3f3e5fd84e47b1d75434754fc9df5b2da834b9f7..4f8074d3a672ea0df255a09cc540b5c726e552fa 100644 |
--- a/src/core/SkBitmapDevice.cpp |
+++ b/src/core/SkBitmapDevice.cpp |
@@ -233,6 +233,15 @@ void SkBitmapDevice::drawBitmap(const SkDraw& draw, const SkBitmap& bitmap, |
draw.drawBitmap(bitmap, matrix, nullptr, paint); |
} |
+static inline bool CanApplyDstMatrixAsCTM(const SkMatrix& m, const SkPaint& paint) { |
+ if (!paint.getMaskFilter()) { |
f(malita)
2016/08/26 19:19:10
Is there anything else downstream that may care ab
|
+ return true; |
+ } |
+ |
+ // Some mask filters parameters (sigma) depend on the CTM/scale. |
+ return m.getType() <= SkMatrix::kTranslate_Mask; |
+} |
+ |
void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, |
const SkRect* src, const SkRect& dst, |
const SkPaint& paint, SkCanvas::SrcRectConstraint constraint) { |
@@ -309,8 +318,10 @@ void SkBitmapDevice::drawBitmapRect(const SkDraw& draw, const SkBitmap& bitmap, |
// We can go faster by just calling drawBitmap, which will concat the |
// matrix with the CTM, and try to call drawSprite if it can. If not, |
// it will make a shader and call drawRect, as we do below. |
- draw.drawBitmap(*bitmapPtr, matrix, dstPtr, paint); |
- return; |
+ if (CanApplyDstMatrixAsCTM(matrix, paint)) { |
+ draw.drawBitmap(*bitmapPtr, matrix, dstPtr, paint); |
+ return; |
+ } |
} |
USE_SHADER: |