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

Unified Diff: src/pipe/SkGPipeWrite.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/pipe/SkGPipeRead.cpp ('k') | src/svg/SkSVGDevice.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pipe/SkGPipeWrite.cpp
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp
index 4dbb5b536c8f852a7116a5604ba40c1876b2579f..60a63b090a6f50b31f600a08a95e83f4570a6a2b 100644
--- a/src/pipe/SkGPipeWrite.cpp
+++ b/src/pipe/SkGPipeWrite.cpp
@@ -276,10 +276,10 @@ protected:
void onDrawPath(const SkPath&, const SkPaint&) override;
void onDrawBitmap(const SkBitmap&, SkScalar left, SkScalar top, const SkPaint*) override;
void onDrawBitmapRect(const SkBitmap&, const SkRect* src, const SkRect& dst, const SkPaint*,
- DrawBitmapRectFlags flags) override;
+ SK_VIRTUAL_CONSTRAINT_TYPE) override;
void onDrawImage(const SkImage*, SkScalar left, SkScalar top, const SkPaint*) override;
void onDrawImageRect(const SkImage*, const SkRect* src, const SkRect& dst,
- const SkPaint*) override;
+ const SkPaint* SRC_RECT_CONSTRAINT_PARAM(constraint)) override;
void onDrawImageNine(const SkImage*, const SkIRect& center, const SkRect& dst,
const SkPaint*) override;
void onDrawBitmapNine(const SkBitmap&, const SkIRect& center, const SkRect& dst,
@@ -791,7 +791,10 @@ void SkGPipeCanvas::onDrawBitmap(const SkBitmap& bm, SkScalar left, SkScalar top
}
void SkGPipeCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src, const SkRect& dst,
- const SkPaint* paint, DrawBitmapRectFlags dbmrFlags) {
+ const SkPaint* paint,
+ SK_VIRTUAL_CONSTRAINT_TYPE legacyConstraint) {
+ SrcRectConstraint constraint = (SrcRectConstraint)legacyConstraint;
+
NOTIFY_SETUP(this);
size_t opBytesNeeded = sizeof(SkRect);
bool hasSrc = src != NULL;
@@ -802,11 +805,11 @@ void SkGPipeCanvas::onDrawBitmapRect(const SkBitmap& bm, const SkRect* src, cons
} else {
flags = 0;
}
- if (dbmrFlags & kBleed_DrawBitmapRectFlag) {
+ if (kFast_SrcRectConstraint == constraint) {
flags |= kDrawBitmap_Bleed_DrawOpFlag;
}
- if (this->commonDrawBitmap(bm, kDrawBitmapRectToRect_DrawOp, flags, opBytesNeeded, paint)) {
+ if (this->commonDrawBitmap(bm, kDrawBitmapRect_DrawOp, flags, opBytesNeeded, paint)) {
if (hasSrc) {
fWriter.writeRect(*src);
}
@@ -869,8 +872,10 @@ void SkGPipeCanvas::onDrawImage(const SkImage* image, SkScalar x, SkScalar y,
}
void SkGPipeCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, const SkRect& dst,
- const SkPaint* paint) {
+ const SkPaint* paint SRC_RECT_CONSTRAINT_PARAM(constraint)) {
NOTIFY_SETUP(this);
+
+ SRC_RECT_CONSTRAINT_LOCAL_DEFAULT(constraint)
unsigned flags = 0;
size_t opBytesNeeded = sizeof(SkRect); // dst
if (src) {
@@ -882,6 +887,7 @@ void SkGPipeCanvas::onDrawImageRect(const SkImage* image, const SkRect* src, con
fWriter.writeRect(*src);
}
fWriter.writeRect(dst);
+ fWriter.writeInt(constraint);
}
}
« no previous file with comments | « src/pipe/SkGPipeRead.cpp ('k') | src/svg/SkSVGDevice.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698