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

Unified Diff: src/core/SkRecorder.cpp

Issue 545613002: Implement all SkCanvas overrides that SkPictureRecord does. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 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/SkRecorder.h ('k') | src/core/SkRecords.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecorder.cpp
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index df3e1d8fa51636c1f22a9f39718508cdb076f94b..86578a53b82b66e890f3b0da56ec8e78b97727ce 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -11,7 +11,9 @@
// SkCanvas will fail in mysterious ways if it doesn't know the real width and height.
SkRecorder::SkRecorder(SkRecord* record, int width, int height)
- : SkCanvas(width, height), fRecord(record) {}
+ : SkCanvas(width, height)
+ , fRecord(record)
+ , fSaveLayerCount(0) {}
void SkRecorder::forgetRecord() {
fRecord = NULL;
@@ -229,17 +231,25 @@ void SkRecorder::onDrawPatch(const SkPoint cubics[12], const SkColor colors[4],
}
void SkRecorder::willSave() {
+ fSaveIsSaveLayer.push(false);
APPEND(Save);
}
SkCanvas::SaveLayerStrategy SkRecorder::willSaveLayer(const SkRect* bounds,
const SkPaint* paint,
SkCanvas::SaveFlags flags) {
+ fSaveLayerCount++;
+ fSaveIsSaveLayer.push(true);
APPEND(SaveLayer, this->copy(bounds), this->copy(paint), flags);
return SkCanvas::kNoLayer_SaveLayerStrategy;
}
void SkRecorder::didRestore() {
+ SkBool8 saveLayer;
+ fSaveIsSaveLayer.pop(&saveLayer);
+ if (saveLayer) {
+ fSaveLayerCount--;
+ }
APPEND(Restore, this->devBounds(), this->getTotalMatrix());
}
@@ -295,3 +305,11 @@ void SkRecorder::addComment(const char* key, const char* value) {
void SkRecorder::endCommentGroup() {
APPEND(EndCommentGroup);
}
+
+bool SkRecorder::isDrawingToLayer() const {
+ return fSaveLayerCount > 0;
+}
+
+void SkRecorder::drawData(const void* data, size_t length) {
+ APPEND(DrawData, copy((const char*)data), length);
+}
« no previous file with comments | « src/core/SkRecorder.h ('k') | src/core/SkRecords.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698