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

Unified Diff: src/core/SkRecordDraw.cpp

Issue 727363003: wip for drawables (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make the pictures in the array also const (the array already was const) Created 6 years, 1 month 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') | src/core/SkRecorder.h » ('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 77235fda415577eb1c6288c8de87cdd9d91a4492..323ceca0e17818d3c8476ad2050f4ba09f4408c7 100644
--- a/src/core/SkRecordDraw.cpp
+++ b/src/core/SkRecordDraw.cpp
@@ -11,6 +11,7 @@
void SkRecordDraw(const SkRecord& record,
SkCanvas* canvas,
+ SkPicture const* const drawablePicts[], int drawableCount,
const SkBBoxHierarchy* bbh,
SkDrawPictureCallback* callback) {
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
@@ -29,7 +30,7 @@ void SkRecordDraw(const SkRecord& record,
SkTDArray<unsigned> ops;
bbh->search(query, &ops);
- SkRecords::Draw draw(canvas);
+ SkRecords::Draw draw(canvas, drawablePicts, drawableCount);
for (int i = 0; i < ops.count(); i++) {
if (callback && callback->abortDrawing()) {
return;
@@ -41,7 +42,7 @@ void SkRecordDraw(const SkRecord& record,
}
} else {
// Draw all ops.
- SkRecords::Draw draw(canvas);
+ SkRecords::Draw draw(canvas, drawablePicts, drawableCount);
for (unsigned i = 0; i < record.count(); i++) {
if (callback && callback->abortDrawing()) {
return;
@@ -54,15 +55,15 @@ void SkRecordDraw(const SkRecord& record,
}
}
-void SkRecordPartialDraw(const SkRecord& record,
- SkCanvas* canvas,
+void SkRecordPartialDraw(const SkRecord& record, SkCanvas* canvas,
+ SkPicture const* const drawablePicts[], int drawableCount,
const SkRect& clearRect,
unsigned start, unsigned stop,
const SkMatrix& initialCTM) {
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
stop = SkTMin(stop, record.count());
- SkRecords::PartialDraw draw(canvas, clearRect, initialCTM);
+ SkRecords::PartialDraw draw(canvas, NULL, 0, clearRect, initialCTM);
for (unsigned i = start; i < stop; i++) {
record.visit<void>(i, draw);
}
@@ -123,6 +124,12 @@ DRAW(DrawVertices, drawVertices(r.vmode, r.vertexCount, r.vertices, r.texs, r.co
DRAW(DrawData, drawData(r.data, r.length));
#undef DRAW
+template <> void Draw::draw(const DrawDrawable& r) {
+ SkASSERT(r.index >= 0);
+ SkASSERT(r.index < fDrawableCount);
+ fCanvas->drawPicture(fDrawablePicts[r.index]);
+}
+
// This is an SkRecord visitor that fills an SkBBoxHierarchy.
//
// The interesting part here is how to calculate bounds for ops which don't
@@ -502,6 +509,10 @@ private:
return this->adjustAndMap(dst, &op.paint);
}
+ Bounds bounds(const DrawDrawable& op) const {
+ return this->adjustAndMap(op.worstCaseBounds, NULL);
+ }
+
static void AdjustTextForFontMetrics(SkRect* rect, const SkPaint& paint) {
#ifdef SK_DEBUG
SkRect correct = *rect;
« no previous file with comments | « src/core/SkRecordDraw.h ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698