diff options
author | Mike Reed <reed@google.com> | 2016-11-09 15:23:26 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-11-09 21:00:39 +0000 |
commit | 28930b46487fc94fde206d1283623204c595b0f1 (patch) | |
tree | 4e1450408d09c5b8cd25dbac35d8a2e03090ca9f /src/core/SkBlitter.h | |
parent | 8a1036caf1231286923112f0bcffb12ac2257b41 (diff) |
add debugging wrapper blitter to ensure unclipped scan-conversion is safe
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4629
Change-Id: Ie6c35b28a6e8e87bf230e50f9940d3924d12969a
Reviewed-on: https://skia-review.googlesource.com/4629
Commit-Queue: Mike Reed <reed@google.com>
Reviewed-by: Yuqian Li <liyuqian@google.com>
Diffstat (limited to 'src/core/SkBlitter.h')
-rw-r--r-- | src/core/SkBlitter.h | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/SkBlitter.h b/src/core/SkBlitter.h index 0e5fedd7eb..c9fed1ce22 100644 --- a/src/core/SkBlitter.h +++ b/src/core/SkBlitter.h @@ -240,6 +240,39 @@ private: const SkRegion* fRgn; }; +#ifdef SK_DEBUG +class SkRectClipCheckBlitter : public SkBlitter { +public: + void init(SkBlitter* blitter, const SkIRect& clipRect) { + SkASSERT(blitter); + SkASSERT(!clipRect.isEmpty()); + fBlitter = blitter; + fClipRect = clipRect; + } + + void blitH(int x, int y, int width) override; + void blitAntiH(int x, int y, const SkAlpha[], const int16_t runs[]) override; + void blitV(int x, int y, int height, SkAlpha alpha) override; + void blitRect(int x, int y, int width, int height) override; + void blitAntiRect(int x, int y, int width, int height, + SkAlpha leftAlpha, SkAlpha rightAlpha) override; + void blitMask(const SkMask&, const SkIRect& clip) override; + const SkPixmap* justAnOpaqueColor(uint32_t* value) override; + + int requestRowsPreserved() const override { + return fBlitter->requestRowsPreserved(); + } + + void* allocBlitMemory(size_t sz) override { + return fBlitter->allocBlitMemory(sz); + } + +private: + SkBlitter* fBlitter; + SkIRect fClipRect; +}; +#endif + /** Factory to set up the appropriate most-efficient wrapper blitter to apply a clip. Returns a pointer to a member, so lifetime must be managed carefully. |