diff options
Diffstat (limited to 'src/core/SkRecordDraw.h')
-rw-r--r-- | src/core/SkRecordDraw.h | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/src/core/SkRecordDraw.h b/src/core/SkRecordDraw.h index 509f5a6c72..e95123bbe6 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 |