Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(24)

Unified Diff: include/core/SkXfermode.h

Issue 166583002: Factory methods for heap-allocated SkPathEffect and SkXfermode objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move comments from constructors to factory methods. Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: include/core/SkXfermode.h
diff --git a/include/core/SkXfermode.h b/include/core/SkXfermode.h
index 31b8081f85b0f05a2904f20d9ae22f07900634cd..40b251d1396a7624fc94a1914b962f14cfb01aac 100644
--- a/include/core/SkXfermode.h
+++ b/include/core/SkXfermode.h
@@ -32,8 +32,6 @@ class SK_API SkXfermode : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkXfermode)
- SkXfermode() {}
-
virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
const SkAlpha aa[]) const;
virtual void xfer16(uint16_t dst[], const SkPMColor src[], int count,
@@ -218,6 +216,7 @@ public:
SK_DEFINE_FLATTENABLE_TYPE(SkXfermode)
protected:
+ SkXfermode() {}
SkXfermode(SkReadBuffer& rb) : SkFlattenable(rb) {}
/** The default implementation of xfer32/xfer16/xferA8 in turn call this
@@ -250,7 +249,9 @@ private:
*/
class SkProcXfermode : public SkXfermode {
public:
- SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {}
+ static SkProcXfermode* Create(SkXfermodeProc proc) {
+ return SkNEW_ARGS(SkProcXfermode, (proc));
+ }
// overrides from SkXfermode
virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
@@ -276,6 +277,11 @@ protected:
return fProc;
}
+#ifdef SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS
+public:
+#endif
+ SkProcXfermode(SkXfermodeProc proc) : fProc(proc) {}
+
private:
SkXfermodeProc fProc;

Powered by Google App Engine
This is Rietveld 408576698