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

Unified Diff: src/gpu/GrRecordReplaceDraw.cpp

Issue 694533004: Add return value on GrRecordReplaceDraw (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 2 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/gpu/GrRecordReplaceDraw.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrRecordReplaceDraw.cpp
diff --git a/src/gpu/GrRecordReplaceDraw.cpp b/src/gpu/GrRecordReplaceDraw.cpp
index b069e60f6e98a4c15639043b1513d414c98f0ac4..e4cc00696def6efc77a18ec282c8cbe6ae275642 100644
--- a/src/gpu/GrRecordReplaceDraw.cpp
+++ b/src/gpu/GrRecordReplaceDraw.cpp
@@ -66,16 +66,19 @@ public:
, fReplacements(replacements)
, fInitialMatrix(initialMatrix)
, fCallback(callback)
- , fIndex(0) {
+ , fIndex(0)
+ , fNumReplaced(0) {
}
- void draw() {
+ int draw() {
const SkBBoxHierarchy* bbh = fPicture->fBBH.get();
const SkRecord* record = fPicture->fRecord.get();
if (NULL == record) {
- return;
+ return 0;
}
+ fNumReplaced = 0;
+
fOps.rewind();
if (bbh) {
@@ -91,7 +94,7 @@ public:
for (fIndex = 0; fIndex < fOps.count(); ++fIndex) {
if (fCallback && fCallback->abortDrawing()) {
- return;
+ return fNumReplaced;
}
record->visit<void>(fOps[fIndex], *this);
@@ -100,12 +103,14 @@ public:
} else {
for (fIndex = 0; fIndex < (int) record->count(); ++fIndex) {
if (fCallback && fCallback->abortDrawing()) {
- return;
+ return fNumReplaced;
}
record->visit<void>(fIndex, *this);
}
}
+
+ return fNumReplaced;
}
// Same as Draw for all ops except DrawPicture and SaveLayer.
@@ -118,7 +123,7 @@ public:
// Draw sub-pictures with the same replacement list but a different picture
ReplaceDraw draw(fCanvas, dp.picture, fReplacements, fInitialMatrix, fCallback);
- draw.draw();
+ fNumReplaced += draw.draw();
}
void operator()(const SkRecords::SaveLayer& sl) {
@@ -131,12 +136,14 @@ public:
startOffset = fIndex;
}
+ const SkMatrix& ctm = fCanvas->getTotalMatrix();
const GrReplacements::ReplacementInfo* ri = fReplacements->lookupByStart(
fPicture->uniqueID(),
startOffset,
- fCanvas->getTotalMatrix());
+ ctm);
if (ri) {
+ fNumReplaced++;
draw_replacement_bitmap(ri, fCanvas, fInitialMatrix);
if (fPicture->fBBH.get()) {
@@ -163,18 +170,19 @@ private:
SkTDArray<unsigned> fOps;
int fIndex;
+ int fNumReplaced;
typedef Draw INHERITED;
};
-void GrRecordReplaceDraw(const SkPicture* picture,
- SkCanvas* canvas,
- const GrReplacements* replacements,
- const SkMatrix& initialMatrix,
- SkDrawPictureCallback* callback) {
+int GrRecordReplaceDraw(const SkPicture* picture,
+ SkCanvas* canvas,
+ const GrReplacements* replacements,
+ const SkMatrix& initialMatrix,
+ SkDrawPictureCallback* callback) {
SkAutoCanvasRestore saveRestore(canvas, true /*save now, restore at exit*/);
ReplaceDraw draw(canvas, picture, replacements, initialMatrix, callback);
- draw.draw();
+ return draw.draw();
}
« no previous file with comments | « src/gpu/GrRecordReplaceDraw.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698