aboutsummaryrefslogtreecommitdiffhomepage
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/core/SkCanvas.h14
-rw-r--r--include/core/SkClipStack.h10
2 files changed, 23 insertions, 1 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 620c5820b9..2a6100db8d 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -487,6 +487,17 @@ public:
}
/**
+ * Sets the max clip rectangle, which can be set by clipRect, clipRRect and
+ * clipPath and intersect the current clip with the specified rect.
+ * The max clip affects only future ops (it is not retroactive).
+ * We DON'T record the clip restriction in pictures.
+ * This is private API to be used only by Android framework.
+ * @param rect The maximum allowed clip in device coordinates.
+ * Empty rect means max clip is not enforced.
+ */
+ void androidFramework_setDeviceClipRestriction(const SkIRect& rect);
+
+ /**
* Modify the current clip with the specified SkRRect.
* @param rrect The rrect to combine with the current clip
* @param op The region op to apply to the current clip
@@ -1558,7 +1569,7 @@ private:
enum {
kMCRecSize = 128, // most recent measurement
kMCRecCount = 32, // common depth for save/restores
- kDeviceCMSize = 176, // most recent measurement
+ kDeviceCMSize = 184, // most recent measurement
};
intptr_t fMCRecStorage[kMCRecSize * kMCRecCount / sizeof(intptr_t)];
intptr_t fDeviceCMStorage[kDeviceCMSize / sizeof(intptr_t)];
@@ -1578,6 +1589,7 @@ private:
friend class SkSurface_Gpu;
bool fDeviceCMDirty; // cleared by updateDeviceCMCache()
+ SkIRect fClipRestrictionRect = SkIRect::MakeEmpty();
void updateDeviceCMCache();
void doSave();
diff --git a/include/core/SkClipStack.h b/include/core/SkClipStack.h
index d30bbcc128..4ca09154eb 100644
--- a/include/core/SkClipStack.h
+++ b/include/core/SkClipStack.h
@@ -20,8 +20,10 @@ class SkCanvasClipVisitor;
#ifdef SK_SUPPORT_LEGACY_CLIPOPS_PLAIN_ENUM
+ #define SkClipStackImpl_UnionOp kUnion_SkClipOp
#define SkClipStackImpl_ReplaceOp kReplace_SkClipOp
#else
+ #define SkClipStackImpl_UnionOp SkClipOp::kUnion_private_internal_do_not_use
#define SkClipStackImpl_ReplaceOp SkClipOp::kReplace_private_internal_do_not_use
#endif
@@ -363,6 +365,9 @@ public:
void clipPath(const SkPath&, const SkMatrix& matrix, SkClipOp, bool doAA);
// An optimized version of clipDevRect(emptyRect, kIntersect, ...)
void clipEmpty();
+ void setDeviceClipRestriction(const SkIRect& rect) {
+ fClipRestrictionRect = SkRect::MakeFromIRect(rect);
+ }
/**
* isWideOpen returns true if the clip state corresponds to the infinite
@@ -504,6 +509,7 @@ private:
// clipDevRect and clipDevPath call. 0 is reserved to indicate an
// invalid ID.
static int32_t gGenID;
+ SkRect fClipRestrictionRect = SkRect::MakeEmpty();
bool internalQuickContains(const SkRect& devRect) const;
bool internalQuickContains(const SkRRect& devRRect) const;
@@ -518,6 +524,10 @@ private:
*/
void restoreTo(int saveCount);
+ inline bool hasClipRestriction(SkClipOp op) {
+ return op >= SkClipStackImpl_UnionOp && !fClipRestrictionRect.isEmpty();
+ }
+
/**
* Return the next unique generation ID.
*/