diff options
author | 2017-03-02 20:22:35 +0000 | |
---|---|---|
committer | 2017-03-02 20:22:48 +0000 | |
commit | ea5e676a7b75600edcde3912886486004ccd7626 (patch) | |
tree | 1ed67f45d493bd4efdef0f0fb83941529aabb2a6 /src/utils | |
parent | d7875f57bd5f17ac27f1cb2ace25224299ff2389 (diff) |
Revert "Remove SkDraw from device-draw methods, and enable device-centric clipping."
This reverts commit c77e33f73d3e86cfabf925d6f2e1166f81022575.
Reason for revert: breaks isClipRect
- this CL inspected the conservative clip for this, which is (by definition) a rect
- probably need to query the device for this info
Original change's description:
> Remove SkDraw from device-draw methods, and enable device-centric clipping.
>
> BUG=skia:6214
>
> Change-Id: I593900724310d09133ae4791ef68d38c43762fc2
> Reviewed-on: https://skia-review.googlesource.com/8806
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Mike Reed <reed@google.com>
>
TBR=bsalomon@google.com,halcanary@google.com,msarett@google.com,robertphillips@google.com,fmalita@chromium.org,reed@google.com,reviews@skia.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=skia:6214
Change-Id: I9090cbbb9f45b2dd204d9fdc187de2ff714b93f6
Reviewed-on: https://skia-review.googlesource.com/9172
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/utils')
-rw-r--r-- | src/utils/SkCanvasStateUtils.cpp | 30 |
1 files changed, 26 insertions, 4 deletions
diff --git a/src/utils/SkCanvasStateUtils.cpp b/src/utils/SkCanvasStateUtils.cpp index 0c50bad0f6..a78f3435a4 100644 --- a/src/utils/SkCanvasStateUtils.cpp +++ b/src/utils/SkCanvasStateUtils.cpp @@ -130,6 +130,28 @@ private: //////////////////////////////////////////////////////////////////////////////// +class ClipValidator : public SkCanvas::ClipVisitor { +public: + ClipValidator() : fFailed(false) {} + bool failed() { return fFailed; } + + // ClipVisitor + void clipRect(const SkRect& rect, SkClipOp op, bool antialias) override { + fFailed |= antialias; + } + + void clipRRect(const SkRRect& rrect, SkClipOp op, bool antialias) override { + fFailed |= antialias; + } + + void clipPath(const SkPath&, SkClipOp, bool antialias) override { + fFailed |= antialias; + } + +private: + bool fFailed; +}; + static void setup_MC_state(SkMCState* state, const SkMatrix& matrix, const SkRegion& clip) { // initialize the struct state->clipRectCount = 0; @@ -171,7 +193,9 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) { SkASSERT(canvas); // Check the clip can be decomposed into rectangles (i.e. no soft clips). - if (canvas->androidFramework_isClipAA()) { + ClipValidator validator; + canvas->replayClips(&validator); + if (validator.failed()) { return nullptr; } @@ -222,9 +246,7 @@ SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas* canvas) { layerState->raster.rowBytes = pmap.rowBytes(); layerState->raster.pixels = pmap.writable_addr(); - SkRegion rgn; - layer.clip(&rgn); - setup_MC_state(&layerState->mcState, layer.matrix(), rgn); + setup_MC_state(&layerState->mcState, layer.matrix(), layer.clip().bwRgn()); layerCount++; } |