diff options
-rw-r--r-- | src/effects/SkTileImageFilter.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/effects/SkTileImageFilter.cpp b/src/effects/SkTileImageFilter.cpp index ca4c15d419..844895c6d8 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); } |