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

Unified Diff: src/core/SkPicturePlayback.cpp

Issue 1228083004: add src-rect-constraint to drawImageRect (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: rebase Created 5 years, 5 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 | « src/core/SkPictureFlat.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPicturePlayback.cpp
diff --git a/src/core/SkPicturePlayback.cpp b/src/core/SkPicturePlayback.cpp
index 1cf1a1bfb4726c15fe35edec2aec903bc0a09d9d..23383740c75236d4eb27b4e4be62526e7c60bf9f 100644
--- a/src/core/SkPicturePlayback.cpp
+++ b/src/core/SkPicturePlayback.cpp
@@ -182,14 +182,13 @@ void SkPicturePlayback::handleOp(SkReader32* reader,
const SkPoint& loc = reader->skipT<SkPoint>();
canvas->drawBitmap(bitmap, loc.fX, loc.fY, paint);
} break;
- case DRAW_BITMAP_RECT_TO_RECT: {
+ case DRAW_BITMAP_RECT: {
const SkPaint* paint = fPictureData->getPaint(reader);
const SkBitmap bitmap = shallow_copy(fPictureData->getBitmap(reader));
const SkRect* src = get_rect_ptr(reader); // may be null
const SkRect& dst = reader->skipT<SkRect>(); // required
- SkCanvas::DrawBitmapRectFlags flags;
- flags = (SkCanvas::DrawBitmapRectFlags) reader->readInt();
- canvas->drawBitmapRectToRect(bitmap, src, dst, paint, flags);
+ SkCanvas::SrcRectConstraint constraint = (SkCanvas::SrcRectConstraint)reader->readInt();
+ canvas->drawBitmapRect(bitmap, src, dst, paint, constraint);
} break;
case DRAW_BITMAP_MATRIX: {
const SkPaint* paint = fPictureData->getPaint(reader);
@@ -249,12 +248,19 @@ void SkPicturePlayback::handleOp(SkReader32* reader,
const SkRect& dst = reader->skipT<SkRect>();
canvas->drawImageNine(image, center, dst, paint);
} break;
+ case DRAW_IMAGE_RECT_STRICT:
case DRAW_IMAGE_RECT: {
const SkPaint* paint = fPictureData->getPaint(reader);
const SkImage* image = fPictureData->getImage(reader);
const SkRect* src = get_rect_ptr(reader); // may be null
const SkRect& dst = reader->skipT<SkRect>(); // required
- canvas->drawImageRect(image, src, dst, paint);
+ // DRAW_IMAGE_RECT_STRICT assumes this constraint, and doesn't store it
+ SkCanvas::SrcRectConstraint constraint = SkCanvas::kStrict_SrcRectConstraint;
+ if (DRAW_IMAGE_RECT == op) {
+ // newer op-code stores the constraint explicitly
+ constraint = (SkCanvas::SrcRectConstraint)reader->readInt();
+ }
+ canvas->drawImageRect(image, src, dst, paint, constraint);
} break;
case DRAW_OVAL: {
const SkPaint& paint = *fPictureData->getPaint(reader);
« no previous file with comments | « src/core/SkPictureFlat.h ('k') | src/core/SkPictureRecord.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698