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

Unified Diff: src/core/SkRecordDraw.h

Issue 778563002: Revert "Change clear() to respect the clip" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years 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/SkPictureRecord.cpp ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecordDraw.h
diff --git a/src/core/SkRecordDraw.h b/src/core/SkRecordDraw.h
index 509f5a6c72bbea6465bef0ffb14985b255f0059b..e95123bbe6ebcd0d2994cfc7468329062d1d3d76 100644
--- a/src/core/SkRecordDraw.h
+++ b/src/core/SkRecordDraw.h
@@ -29,14 +29,15 @@ void SkRecordDraw(const SkRecord&, SkCanvas*, SkPicture const* const drawablePic
SkCanvasDrawable* const drawables[], int drawableCount,
const SkBBoxHierarchy*, SkDrawPictureCallback*);
-// Draw a portion of an SkRecord into an SkCanvas.
+// Draw a portion of an SkRecord into an SkCanvas while replacing clears with drawRects.
// When drawing a portion of an SkRecord the CTM on the passed in canvas must be
// the composition of the replay matrix with the record-time CTM (for the portion
// of the record that is being replayed). For setMatrix calls to behave correctly
// the initialCTM parameter must set to just the replay matrix.
void SkRecordPartialDraw(const SkRecord&, SkCanvas*,
SkPicture const* const drawablePicts[], int drawableCount,
- unsigned start, unsigned stop, const SkMatrix& initialCTM);
+ const SkRect&, unsigned start, unsigned stop,
+ const SkMatrix& initialCTM);
namespace SkRecords {
@@ -75,6 +76,30 @@ private:
int fDrawableCount;
};
+// Used by SkRecordPartialDraw.
+class PartialDraw : public Draw {
+public:
+ PartialDraw(SkCanvas* canvas, SkPicture const* const drawablePicts[], int drawableCount,
+ const SkRect& clearRect, const SkMatrix& initialCTM)
+ : INHERITED(canvas, drawablePicts, NULL, drawableCount, &initialCTM), fClearRect(clearRect)
+ {}
+
+ // Same as Draw for all ops except Clear.
+ template <typename T> void operator()(const T& r) {
+ this->INHERITED::operator()(r);
+ }
+ void operator()(const Clear& c) {
+ SkPaint p;
+ p.setColor(c.color);
+ DrawRect drawRect(p, fClearRect);
+ this->INHERITED::operator()(drawRect);
+ }
+
+private:
+ const SkRect fClearRect;
+ typedef Draw INHERITED;
+};
+
} // namespace SkRecords
#endif//SkRecordDraw_DEFINED
« no previous file with comments | « src/core/SkPictureRecord.cpp ('k') | src/core/SkRecordDraw.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698