diff options
author | 2015-07-14 10:54:12 -0700 | |
---|---|---|
committer | 2015-07-14 10:54:12 -0700 | |
commit | a5517e2b190a8083b38964972b031c13e99f1012 (patch) | |
tree | 16fc3439de41b3af1e85c360904e96c44a2b8078 /src/pipe/SkGPipeWrite.cpp | |
parent | 4abc186d029c3c57a53cec3f483de2fff6d4a954 (diff) |
add src-rect-constraint to drawImageRect
Follow-on work
- unify around SrcRectConstraint (i.e. drawBitmapRect)
- remove silly drawBitmapRectToRect alias
- clean-up (possibly remove) alias problems around drawBitmapRect + IRect parameter
BUG=skia:
Review URL: https://codereview.chromium.org/1228083004
Diffstat (limited to 'src/pipe/SkGPipeWrite.cpp')
-rw-r--r-- | src/pipe/SkGPipeWrite.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/pipe/SkGPipeWrite.cpp b/src/pipe/SkGPipeWrite.cpp index 4dbb5b536c..60a63b090a 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); } } |