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

Unified Diff: src/core/SkRecorder.cpp

Issue 1130283004: Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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 45283f81185f911f89ebd3320642066b13930e95..0a2d43edbf22c74956bdd17b83c70ec40b686e8c 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkBigPicture.h"
#include "SkPatchUtils.h"
#include "SkPicture.h"
#include "SkPictureUtils.h"
@@ -15,7 +14,7 @@
fArray.unrefAll();
}
-SkBigPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
+SkPicture::SnapshotArray* SkDrawableList::newDrawableSnapshot() {
const int count = fArray.count();
if (0 == count) {
return NULL;
@@ -24,7 +23,7 @@
for (int i = 0; i < count; ++i) {
pics[i] = fArray[i]->newPictureSnapshot();
}
- return SkNEW_ARGS(SkBigPicture::SnapshotArray, (pics.detach(), count));
+ return SkNEW_ARGS(SkPicture::SnapshotArray, (pics.detach(), count));
}
void SkDrawableList::append(SkDrawable* drawable) {
@@ -33,23 +32,20 @@
///////////////////////////////////////////////////////////////////////////////////////////////
-SkRecorder::SkRecorder(SkRecord* record, int width, int height, SkMiniRecorder* mr)
+SkRecorder::SkRecorder(SkRecord* record, int width, int height)
: SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip_InitFlag)
, fApproxBytesUsedBySubPictures(0)
- , fRecord(record)
- , fMiniRecorder(mr) {}
-
-SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds, SkMiniRecorder* mr)
+ , fRecord(record) {}
+
+SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds)
: SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag)
, fApproxBytesUsedBySubPictures(0)
- , fRecord(record)
- , fMiniRecorder(mr) {}
-
-void SkRecorder::reset(SkRecord* record, const SkRect& bounds, SkMiniRecorder* mr) {
+ , fRecord(record) {}
+
+void SkRecorder::reset(SkRecord* record, const SkRect& bounds) {
this->forgetRecord();
fRecord = record;
this->resetForNextPicture(bounds.roundOut());
- fMiniRecorder = mr;
}
void SkRecorder::forgetRecord() {
@@ -59,12 +55,8 @@
}
// To make appending to fRecord a little less verbose.
-#define APPEND(T, ...) \
- if (fMiniRecorder) { this->flushMiniRecorder(); } \
+#define APPEND(T, ...) \
SkNEW_PLACEMENT_ARGS(fRecord->append<SkRecords::T>(), SkRecords::T, (__VA_ARGS__))
-
-#define TRY_MINIRECORDER(method, ...) \
- if (fMiniRecorder && fMiniRecorder->method(__VA_ARGS__)) { return; }
// For methods which must call back into SkCanvas.
#define INHERITED(method, ...) this->SkCanvas::method(__VA_ARGS__)
@@ -133,15 +125,6 @@
return this->copy(src, strlen(src)+1);
}
-void SkRecorder::flushMiniRecorder() {
- if (fMiniRecorder) {
- SkMiniRecorder* mr = fMiniRecorder;
- fMiniRecorder = nullptr; // Needs to happen before p->playback(this) or we loop forever.
- // TODO: this can probably be done more efficiently by SkMiniRecorder if it matters.
- SkAutoTUnref<SkPicture> p(mr->detachAsPicture(SkRect::MakeEmpty()));
- p->playback(this);
- }
-}
void SkRecorder::onDrawPaint(const SkPaint& paint) {
APPEND(DrawPaint, delay_copy(paint));
@@ -155,7 +138,6 @@
}
void SkRecorder::onDrawRect(const SkRect& rect, const SkPaint& paint) {
- TRY_MINIRECORDER(drawRect, rect, paint);
APPEND(DrawRect, delay_copy(paint), rect);
}
@@ -180,7 +162,6 @@
}
void SkRecorder::onDrawPath(const SkPath& path, const SkPaint& paint) {
- TRY_MINIRECORDER(drawPath, path, paint);
APPEND(DrawPath, delay_copy(paint), delay_copy(path));
}
@@ -267,7 +248,6 @@
void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
const SkPaint& paint) {
- TRY_MINIRECORDER(drawTextBlob, blob, x, y, paint);
APPEND(DrawTextBlob, delay_copy(paint), blob, x, y);
}
« 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