Implement drawImage in terms of drawImageRect
This will cause the raster backend to draw shadermask_image incorrectly since
drawImageRect implementation has the wrong semantics. bitmapshader's expected
behavior has changed: GPU will draw the new version correctly, but raster's
will not change from the old, incorrect behavior.
Bug: skia:8752
Change-Id: Iee89082e2fdf95c2ee42ca3b052e65556f327eff
Reviewed-on: https://skia-review.googlesource.com/c/190675
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index bf9b690..225b9e5 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2301,7 +2301,9 @@
SkScalarRoundToInt(pt.fY), pnt,
nullptr, SkMatrix::I());
} else {
- iter.fDevice->drawImage(image, x, y, pnt);
+ iter.fDevice->drawImageRect(
+ image, nullptr, SkRect::MakeXYWH(x, y, image->width(), image->height()), pnt,
+ kStrict_SrcRectConstraint);
}
}
@@ -2377,7 +2379,9 @@
SkScalarRoundToInt(pt.fY), pnt,
nullptr, SkMatrix::I());
} else {
- iter.fDevice->drawBitmap(bitmap, x, y, looper.paint());
+ SkRect fullImage = SkRect::MakeWH(bitmap.width(), bitmap.height());
+ iter.fDevice->drawBitmapRect(bitmap, &fullImage, fullImage.makeOffset(x, y), pnt,
+ kStrict_SrcRectConstraint);
}
}