diff options
author | mtklein <mtklein@chromium.org> | 2015-07-01 13:56:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-07-01 13:56:53 -0700 |
commit | 64b4c789fd1721d6804ccb5a9ceae39df03a5711 (patch) | |
tree | 7b1cd391c0b0f1a15b7d21f710ee2ac3fc053d69 /src/core/SkMiniRecorder.cpp | |
parent | 478c9e4851eff5feb74dd2f8a14143bec569e1a8 (diff) |
Add support for drawBitmapRect() to SkMiniRecorder.
BUG=chromium:503705
Review URL: https://codereview.chromium.org/1220733006
Diffstat (limited to 'src/core/SkMiniRecorder.cpp')
-rw-r--r-- | src/core/SkMiniRecorder.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/core/SkMiniRecorder.cpp b/src/core/SkMiniRecorder.cpp index ff17edb257..538db087bf 100644 --- a/src/core/SkMiniRecorder.cpp +++ b/src/core/SkMiniRecorder.cpp @@ -72,6 +72,20 @@ SkMiniRecorder::~SkMiniRecorder() { new (fBuffer.get()) Type(__VA_ARGS__); \ return true +bool SkMiniRecorder::drawBitmapRectToRect(const SkBitmap& bm, const SkRect* src, const SkRect& dst, + const SkPaint* p, SkCanvas::DrawBitmapRectFlags flags) { + SkRect bounds; + if (!src) { + bm.getBounds(&bounds); + src = &bounds; + } + SkTLazy<SkPaint> defaultPaint; + if (!p) { + p = defaultPaint.init(); + } + TRY_TO_STORE(DrawBitmapRectToRectFixedSize, *p, bm, *src, dst, flags); +} + bool SkMiniRecorder::drawRect(const SkRect& rect, const SkPaint& paint) { TRY_TO_STORE(DrawRect, paint, rect); } @@ -94,6 +108,7 @@ SkPicture* SkMiniRecorder::detachAsPicture(const SkRect& cull) { switch (fState) { case State::kEmpty: return SkRef(gEmptyPicture.get()); + CASE(DrawBitmapRectToRectFixedSize); CASE(DrawPath); CASE(DrawRect); CASE(DrawTextBlob); @@ -114,6 +129,7 @@ void SkMiniRecorder::flushAndReset(SkCanvas* canvas) { switch (fState) { case State::kEmpty: return; + CASE(DrawBitmapRectToRectFixedSize); CASE(DrawPath); CASE(DrawRect); CASE(DrawTextBlob); |