aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar lsalzman <lsalzman@mozilla.com>2017-03-31 13:46:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2017-03-31 13:46:47 -0700
commitea9bc0c07b5dae78a9a449d7d7a07fc79262d41a (patch)
treef716d67d9d288664f5dead8199d8ff42e4630d91 /src
parentec53c636b781830cb6146bb32106d4ee44651fcc (diff)
Fix the size check for the drawBitmap fast-path in SkBitmapDevice::drawBitmapRect. It would fail when the source rectangle had a non-zero offset, in which case it would compare the source rectangle with the offset to the extracted bitmap size, which always fails. The only thing that should matter is that the source rectangle and extract bitmap have the same size, since the offset gets added onto the matrix.
Diffstat (limited to 'src')
-rw-r--r--src/core/SkBitmapDevice.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/SkBitmapDevice.cpp b/src/core/SkBitmapDevice.cpp
index 3be63ba66b..de0cc7d381 100644
--- a/src/core/SkBitmapDevice.cpp
+++ b/src/core/SkBitmapDevice.cpp
@@ -316,8 +316,9 @@ void SkBitmapDevice::drawBitmapRect(const SkBitmap& bitmap,
matrix.preTranslate(dx, dy);
}
- SkRect extractedBitmapBounds;
- extractedBitmapBounds.isetWH(bitmapPtr->width(), bitmapPtr->height());
+ SkRect extractedBitmapBounds = SkRect::MakeXYWH(dx, dy,
+ SkIntToScalar(bitmapPtr->width()),
+ SkIntToScalar(bitmapPtr->height()));
if (extractedBitmapBounds == tmpSrc) {
// no fractional part in src, we can just call drawBitmap
goto USE_DRAWBITMAP;