Index: src/effects/SkTileImageFilter.cpp |
diff --git a/src/effects/SkTileImageFilter.cpp b/src/effects/SkTileImageFilter.cpp |
index ca4c15d4191900fc644cdb3961096bcb8b4bf125..844895c6d827a9d103f6136293ec4a1f2d7db8cf 100644 |
--- a/src/effects/SkTileImageFilter.cpp |
+++ b/src/effects/SkTileImageFilter.cpp |
@@ -9,6 +9,7 @@ |
#include "SkBitmap.h" |
#include "SkCanvas.h" |
#include "SkDevice.h" |
+#include "SkOffsetImageFilter.h" |
#include "SkReadBuffer.h" |
#include "SkWriteBuffer.h" |
#include "SkMatrix.h" |
@@ -21,6 +22,16 @@ SkImageFilter* SkTileImageFilter::Create(const SkRect& srcRect, const SkRect& ds |
if (!SkIsValidRect(srcRect) || !SkIsValidRect(dstRect)) { |
return nullptr; |
} |
+ if (srcRect.width() == dstRect.width() && srcRect.height() == dstRect.height()) { |
+ SkRect ir = dstRect; |
+ if (!ir.intersect(srcRect)) { |
+ return SkSafeRef(input); |
+ } |
+ CropRect cropRect(ir); |
+ return SkOffsetImageFilter::Create(dstRect.x() - srcRect.x(), |
+ dstRect.y() - srcRect.y(), |
+ input, &cropRect); |
+ } |
return new SkTileImageFilter(srcRect, dstRect, input); |
} |