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

Unified Diff: src/core/SkRecordDraw.cpp

Issue 527423002: SkRecordPartialDraw with less code duplication (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: test Created 6 years, 3 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/SkRecordDraw.h ('k') | tests/RecordDrawTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordDraw.cpp
diff --git a/src/core/SkRecordDraw.cpp b/src/core/SkRecordDraw.cpp
index 0117adeefaec04a2d8f85a6a8f04dbc743c46495..f7f02997dfb149045f98722546e1ec75fcb45184 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -35,15 +35,29 @@ void SkRecordDraw(const SkRecord& record,
}
} else {
// Draw all ops.
- for (SkRecords::Draw draw(canvas); draw.index() < record.count(); draw.next()) {
+ SkRecords::Draw draw(canvas);
+ for (unsigned i = 0; i < record.count(); i++) {
if (NULL != callback && callback->abortDrawing()) {
return;
}
- record.visit<void>(draw.index(), draw);
+ record.visit<void>(i, draw);
}
}
}
+void SkRecordPartialDraw(const SkRecord& record,
+ SkCanvas* canvas,
+ const SkRect& clearRect,
+ unsigned start, unsigned stop) {
+ SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
+
+ stop = SkTMin(stop, record.count());
+ SkRecords::PartialDraw draw(canvas, clearRect);
+ for (unsigned i = start; i < stop; i++) {
+ record.visit<void>(i, draw);
+ }
+}
+
namespace SkRecords {
// FIXME: SkBitmaps are stateful, so we need to copy them to play back in multiple threads.
« no previous file with comments | « src/core/SkRecordDraw.h ('k') | tests/RecordDrawTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698