diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/core/SkCanvas.h | 17 | ||||
-rw-r--r-- | include/core/SkDevice.h | 2 | ||||
-rw-r--r-- | include/gpu/SkGpuDevice.h | 1 | ||||
-rw-r--r-- | include/utils/SkNoSaveLayerCanvas.h | 18 |
4 files changed, 16 insertions, 22 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index f514d18b5e..5088d7ded5 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -1265,11 +1265,6 @@ protected: SkIRect* intersection, const SkImageFilter* imageFilter = NULL); - // Called by child classes that override clipPath and clipRRect to only - // track fast conservative clip bounds, rather than exact clips. - void updateClipConservativelyUsingBounds(const SkRect&, SkRegion::Op, - bool inverseFilled); - // notify our surface (if we have one) that we are about to draw, so it // can perform copy-on-write or invalidate any cached images void predrawNotify(); @@ -1309,13 +1304,22 @@ private: friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip friend class SkDeferredDevice; // needs getTopDevice() friend class SkSurface_Raster; // needs getDevice() + friend class SkRecorder; // InitFlags + friend class SkNoSaveLayerCanvas; // InitFlags + enum InitFlags { + kDefault_InitFlags = 0, + kConservativeRasterClip_InitFlag = 1 << 0, + }; + SkCanvas(int width, int height, InitFlags flags); + SkCanvas(SkBaseDevice*, InitFlags flags); + // needs gettotalclip() friend SkCanvasState* SkCanvasStateUtils::CaptureCanvasState(SkCanvas*); SkBaseDevice* createLayerDevice(const SkImageInfo&); - SkBaseDevice* init(SkBaseDevice*); + SkBaseDevice* init(SkBaseDevice*, InitFlags); /** * DEPRECATED @@ -1365,6 +1369,7 @@ private: mutable bool fCachedLocalClipBoundsDirty; bool fAllowSoftClip; bool fAllowSimplifyClip; + bool fConservativeRasterClip; const SkRect& getLocalClipBounds() const { if (fCachedLocalClipBoundsDirty) { diff --git a/include/core/SkDevice.h b/include/core/SkDevice.h index aad5bf4737..618431a2de 100644 --- a/include/core/SkDevice.h +++ b/include/core/SkDevice.h @@ -372,6 +372,8 @@ private: // TODO: move to SkBitmapDevice virtual void replaceBitmapBackendForRasterSurface(const SkBitmap&) {} + virtual bool forceConservativeRasterClip() const { return false; } + // just called by SkCanvas when built as a layer void setOrigin(int x, int y) { fOrigin.set(x, y); } // just called by SkCanvas for saveLayer diff --git a/include/gpu/SkGpuDevice.h b/include/gpu/SkGpuDevice.h index 91fc2f0bb6..5545227129 100644 --- a/include/gpu/SkGpuDevice.h +++ b/include/gpu/SkGpuDevice.h @@ -152,6 +152,7 @@ private: virtual SkSurface* newSurface(const SkImageInfo&) SK_OVERRIDE; virtual SkImageFilter::Cache* getImageFilterCache() SK_OVERRIDE; + virtual bool forceConservativeRasterClip() const SK_OVERRIDE { return true; } // sets the render target, clip, and matrix on GrContext. Use forceIdenity to override // SkDraw's matrix and draw in device coords. 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; }; |