summaryrefslogtreecommitdiff
path: root/core/SkPaintPriv.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/SkPaintPriv.cpp')
-rw-r--r--core/SkPaintPriv.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/SkPaintPriv.cpp b/core/SkPaintPriv.cpp
index ce053890..65fd0e75 100644
--- a/core/SkPaintPriv.cpp
+++ b/core/SkPaintPriv.cpp
@@ -76,3 +76,24 @@ bool isPaintOpaque(const SkPaint* paint,
}
return false;
}
+
+bool NeedsDeepCopy(const SkPaint& paint) {
+ /*
+ * These fields are known to be immutable, and so can be shallow-copied
+ *
+ * getTypeface()
+ * getAnnotation()
+ * paint.getColorFilter()
+ * getXfermode()
+ * getPathEffect()
+ * getMaskFilter()
+ */
+
+ return paint.getShader() ||
+#ifdef SK_SUPPORT_LEGACY_LAYERRASTERIZER_API
+ paint.getRasterizer() ||
+#endif
+ paint.getLooper() || // needs to hide its addLayer...
+ paint.getImageFilter();
+}
+