Add push/pop cull to SkRecord.
BUG=skia:2378
R=fmalita@google.com, mtklein@google.com, fmalita@chromium.org
Author: mtklein@chromium.org
Review URL: https://codereview.chromium.org/224723026
git-svn-id: http://skia.googlecode.com/svn/trunk@14091 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/record/SkRecordDraw.h b/src/record/SkRecordDraw.h
index 744dfc5..042147d 100644
--- a/src/record/SkRecordDraw.h
+++ b/src/record/SkRecordDraw.h
@@ -25,6 +25,9 @@
CASE(Save) { canvas->save(r.flags); }
CASE(SaveLayer) { canvas->saveLayer(r.bounds, r.paint, r.flags); }
+CASE(PushCull) { canvas->pushCull(r.rect); }
+CASE(PopCull) { canvas->popCull(); }
+
CASE(Concat) { canvas->concat(r.matrix); }
CASE(SetMatrix) { canvas->setMatrix(r.matrix); }
diff --git a/src/record/SkRecorder.cpp b/src/record/SkRecorder.cpp
index 1edcc52..fabb4be 100644
--- a/src/record/SkRecorder.cpp
+++ b/src/record/SkRecorder.cpp
@@ -195,6 +195,14 @@
APPEND(Restore);
}
+void SkRecorder::onPushCull(const SkRect& rect) {
+ APPEND(PushCull, rect);
+}
+
+void SkRecorder::onPopCull() {
+ APPEND(PopCull);
+}
+
void SkRecorder::didConcat(const SkMatrix& matrix) {
APPEND(Concat, matrix);
}
diff --git a/src/record/SkRecorder.h b/src/record/SkRecorder.h
index 9d722b4..b1782fe 100644
--- a/src/record/SkRecorder.h
+++ b/src/record/SkRecorder.h
@@ -57,6 +57,9 @@
void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle);
void onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op);
+ void onPushCull(const SkRect& cullRect);
+ void onPopCull();
+
private:
template <typename T>
T* copy(const T*);
diff --git a/src/record/SkRecords.h b/src/record/SkRecords.h
index 67cfb20..17a8e84 100644
--- a/src/record/SkRecords.h
+++ b/src/record/SkRecords.h
@@ -39,7 +39,9 @@
M(DrawSprite) \
M(DrawText) \
M(DrawTextOnPath) \
- M(DrawVertices)
+ M(DrawVertices) \
+ M(PushCull) \
+ M(PopCull)
// Defines SkRecords::Type, an enum of all record types.
#define ENUM(T) T##_Type,
@@ -125,6 +127,9 @@
RECORD1(Save, SkCanvas::SaveFlags, flags);
RECORD3(SaveLayer, SkRect*, bounds, SkPaint*, paint, SkCanvas::SaveFlags, flags);
+RECORD1(PushCull, SkRect, rect);
+RECORD0(PopCull);
+
RECORD1(Concat, SkMatrix, matrix);
RECORD1(SetMatrix, SkMatrix, matrix);