Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: src/core/SkCanvas.cpp

Issue 2382893002: Add a src rect to drawImageLattice() API (Closed)
Patch Set: Simplify impl Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/private/SkRecords.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkCanvas.cpp
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index 33d1deee60783807bd8db88a54a2267a47226f0a..d78222d1c9e6e9e14977a2c3b0bc70d0cb86f11c 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -2010,8 +2010,16 @@ void SkCanvas::drawImageLattice(const SkImage* image, const Lattice& lattice, co
if (dst.isEmpty()) {
return;
}
- if (SkLatticeIter::Valid(image->width(), image->height(), lattice)) {
- this->onDrawImageLattice(image, lattice, dst, paint);
+
+ SkIRect bounds;
+ Lattice latticePlusBounds = lattice;
+ if (!latticePlusBounds.fBounds) {
+ bounds = SkIRect::MakeWH(image->width(), image->height());
+ latticePlusBounds.fBounds = &bounds;
+ }
+
+ if (SkLatticeIter::Valid(image->width(), image->height(), latticePlusBounds)) {
+ this->onDrawImageLattice(image, latticePlusBounds, dst, paint);
} else {
this->drawImageRect(image, dst, paint);
}
@@ -2060,8 +2068,16 @@ void SkCanvas::drawBitmapLattice(const SkBitmap& bitmap, const Lattice& lattice,
if (bitmap.drawsNothing() || dst.isEmpty()) {
return;
}
- if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), lattice)) {
- this->onDrawBitmapLattice(bitmap, lattice, dst, paint);
+
+ SkIRect bounds;
+ Lattice latticePlusBounds = lattice;
+ if (!latticePlusBounds.fBounds) {
+ bounds = SkIRect::MakeWH(bitmap.width(), bitmap.height());
+ latticePlusBounds.fBounds = &bounds;
+ }
+
+ if (SkLatticeIter::Valid(bitmap.width(), bitmap.height(), latticePlusBounds)) {
+ this->onDrawBitmapLattice(bitmap, latticePlusBounds, dst, paint);
} else {
this->drawBitmapRect(bitmap, dst, paint);
}
« no previous file with comments | « include/private/SkRecords.h ('k') | src/core/SkDevice.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698