aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/utils/SkNoSaveLayerCanvas.h
diff options
context:
space:
mode:
authorGravatar reed <reed@google.com>2014-09-09 12:19:30 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-09-09 12:19:30 -0700
commit27a5e656c3d6ef22f9cb34de18e1b960da3aa241 (patch)
treeb940544e91d9c4646d5e78e151ed6c4f656c61d4 /include/utils/SkNoSaveLayerCanvas.h
parentf5b6bf775c331784964bfcc9b9ac707dc6a7c62b (diff)
Allow SkCanvas to be initialized to force conservative rasterclips. This has the following effects:
1. Queries to the current clip will be conservatively large. This can mean the quickReject may return false more often. 2. The conservative clips mean less work is done. 3. Enabled by default for Gpu, Record, and NoSaveLayer canvases. 4. API is private for now. R=robertphillips@google.com, bsalomon@google.com, mtklein@google.com, junov@google.com Author: reed@google.com Review URL: https://codereview.chromium.org/541593005
Diffstat (limited to 'include/utils/SkNoSaveLayerCanvas.h')
-rw-r--r--include/utils/SkNoSaveLayerCanvas.h18
1 files changed, 2 insertions, 16 deletions
diff --git a/include/utils/SkNoSaveLayerCanvas.h b/include/utils/SkNoSaveLayerCanvas.h
index 686f179901..56a09622a0 100644
--- a/include/utils/SkNoSaveLayerCanvas.h
+++ b/include/utils/SkNoSaveLayerCanvas.h
@@ -16,7 +16,8 @@
// It also simplifies the clipping calls to only use rectangles.
class SK_API SkNoSaveLayerCanvas : public SkCanvas {
public:
- SkNoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device) {}
+ SkNoSaveLayerCanvas(SkBaseDevice* device) : INHERITED(device, kConservativeRasterClip_InitFlag)
+ {}
protected:
virtual SaveLayerStrategy willSaveLayer(const SkRect* bounds, const SkPaint* paint,
@@ -25,21 +26,6 @@ protected:
return kNoLayer_SaveLayerStrategy;
}
- // disable aa for speed
- virtual void onClipRect(const SkRect& rect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
- this->INHERITED::onClipRect(rect, op, kHard_ClipEdgeStyle);
- }
-
- // for speed, just respect the bounds, and disable AA. May give us a few
- // false positives and negatives.
- virtual void onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
- this->updateClipConservativelyUsingBounds(path.getBounds(), op,
- path.isInverseFillType());
- }
- virtual void onClipRRect(const SkRRect& rrect, SkRegion::Op op, ClipEdgeStyle) SK_OVERRIDE {
- this->updateClipConservativelyUsingBounds(rrect.getBounds(), op, false);
- }
-
private:
typedef SkCanvas INHERITED;
};