diff options
Diffstat (limited to 'include/core/SkCanvas.h')
| -rw-r--r-- | include/core/SkCanvas.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h index 2f83b66fdd..51c285fc08 100644 --- a/include/core/SkCanvas.h +++ b/include/core/SkCanvas.h @@ -739,7 +739,7 @@ public: Call restoreToCount() with returned value to restore this and subsequent saves. @param layerRec layer state - @return depth of save state stack + @return depth of save state stack before this call was made. */ int saveLayer(const SaveLayerRec& layerRec); @@ -2484,6 +2484,8 @@ protected: virtual SaveLayerStrategy getSaveLayerStrategy(const SaveLayerRec& ) { return kFullLayer_SaveLayerStrategy; } + // returns true if we should actually perform the saveBehind, or false if we should just save. + virtual bool onDoSaveBehind(const SkRect*) { return true; } virtual void willRestore() {} virtual void didRestore() {} virtual void didConcat(const SkMatrix& ) {} @@ -2520,6 +2522,7 @@ protected: virtual void onDrawDrawable(SkDrawable* drawable, const SkMatrix* matrix); virtual void onDrawPaint(const SkPaint& paint); + virtual void onDrawBehind(const SkPaint& paint); virtual void onDrawRect(const SkRect& rect, const SkPaint& paint); virtual void onDrawRegion(const SkRegion& region, const SkPaint& paint); virtual void onDrawOval(const SkRect& rect, const SkPaint& paint); @@ -2674,6 +2677,7 @@ private: void internalSetMatrix(const SkMatrix&); friend class SkAndroidFrameworkUtils; + friend class SkCanvasPriv; friend class SkDrawIter; // needs setupDrawForLayerDevice() friend class AutoDrawLooper; friend class SkDebugCanvas; // needs experimental fAllowSimplifyClip @@ -2694,6 +2698,22 @@ private: SkCanvas(const SkBitmap&, std::unique_ptr<SkRasterHandleAllocator>, SkRasterHandleAllocator::Handle); + /** Experimental + * Saves the specified subset of the current pixels in the current layer, + * and then clears those pixels to transparent black. + * Restores the pixels on restore() by drawing them in SkBlendMode::kDstOver. + * + * @param subset conservative bounds of the area to be saved / restored. + * @return depth of save state stack before this call was made. + */ + int only_axis_aligned_saveBehind(const SkRect* subset); + + /** + * Like drawPaint, but magically clipped to the most recent saveBehind buffer rectangle. + * If there is no active saveBehind, then this draws nothing. + */ + void drawClippedToSaveBehind(const SkPaint&); + void resetForNextPicture(const SkIRect& bounds); // needs gettotalclip() @@ -2717,6 +2737,7 @@ private: SrcRectConstraint); void internalDrawPaint(const SkPaint& paint); void internalSaveLayer(const SaveLayerRec&, SaveLayerStrategy); + void internalSaveBehind(const SkRect*); void internalDrawDevice(SkBaseDevice*, int x, int y, const SkPaint*, SkImage* clipImage, const SkMatrix& clipMatrix); |
