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

Unified Diff: src/core/SkMiniRecorder.cpp

Issue 1220733006: Add support for drawBitmapRect() to SkMiniRecorder. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Created 5 years, 6 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/SkMiniRecorder.h ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkMiniRecorder.cpp
diff --git a/src/core/SkMiniRecorder.cpp b/src/core/SkMiniRecorder.cpp
index ff17edb2575cae68001b26e1ce0e3e202c24fd9d..538db087bf244294c301bde6047d84045bee60f8 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);
« no previous file with comments | « src/core/SkMiniRecorder.h ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698