Index: src/core/SkXfermode.cpp |
diff --git a/src/core/SkXfermode.cpp b/src/core/SkXfermode.cpp |
index 66e0dea2f552c00153a6a3c3c3962a3d63663c9f..f5ac20b2825ad91601ebe4fe4c146e4570be70c4 100644 |
--- a/src/core/SkXfermode.cpp |
+++ b/src/core/SkXfermode.cpp |
@@ -1444,7 +1444,9 @@ void SkProcCoeffXfermode::toString(SkString* str) const { |
class SkClearXfermode : public SkProcCoeffXfermode { |
public: |
- SkClearXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kClear_Mode) {} |
+ static SkClearXfermode* Create(const ProcCoeff& rec) { |
+ return SkNEW_ARGS(SkClearXfermode, (rec)); |
+ } |
virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; |
virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; |
@@ -1453,6 +1455,7 @@ public: |
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkClearXfermode) |
private: |
+ SkClearXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kClear_Mode) {} |
SkClearXfermode(SkReadBuffer& buffer) |
: SkProcCoeffXfermode(buffer) {} |
@@ -1506,7 +1509,9 @@ void SkClearXfermode::toString(SkString* str) const { |
class SkSrcXfermode : public SkProcCoeffXfermode { |
public: |
- SkSrcXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kSrc_Mode) {} |
+ static SkSrcXfermode* Create(const ProcCoeff& rec) { |
+ return SkNEW_ARGS(SkSrcXfermode, (rec)); |
+ } |
virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; |
virtual void xferA8(SkAlpha*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; |
@@ -1515,6 +1520,7 @@ public: |
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSrcXfermode) |
private: |
+ SkSrcXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kSrc_Mode) {} |
SkSrcXfermode(SkReadBuffer& buffer) |
: SkProcCoeffXfermode(buffer) {} |
@@ -1573,7 +1579,9 @@ void SkSrcXfermode::toString(SkString* str) const { |
class SkDstInXfermode : public SkProcCoeffXfermode { |
public: |
- SkDstInXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstIn_Mode) {} |
+ static SkDstInXfermode* Create(const ProcCoeff& rec) { |
+ return SkNEW_ARGS(SkDstInXfermode, (rec)); |
+ } |
virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; |
@@ -1581,6 +1589,7 @@ public: |
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDstInXfermode) |
private: |
+ SkDstInXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstIn_Mode) {} |
SkDstInXfermode(SkReadBuffer& buffer) : INHERITED(buffer) {} |
typedef SkProcCoeffXfermode INHERITED; |
@@ -1616,7 +1625,9 @@ void SkDstInXfermode::toString(SkString* str) const { |
class SkDstOutXfermode : public SkProcCoeffXfermode { |
public: |
- SkDstOutXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstOut_Mode) {} |
+ static SkDstOutXfermode* Create(const ProcCoeff& rec) { |
+ return SkNEW_ARGS(SkDstOutXfermode, (rec)); |
+ } |
virtual void xfer32(SkPMColor*, const SkPMColor*, int, const SkAlpha*) const SK_OVERRIDE; |
@@ -1624,6 +1635,7 @@ public: |
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDstOutXfermode) |
private: |
+ SkDstOutXfermode(const ProcCoeff& rec) : SkProcCoeffXfermode(rec, kDstOut_Mode) {} |
SkDstOutXfermode(SkReadBuffer& buffer) |
: INHERITED(buffer) {} |
@@ -1712,23 +1724,23 @@ SkXfermode* SkXfermode::Create(Mode mode) { |
// commonly used, so we call those out for their own subclasses here. |
switch (mode) { |
case kClear_Mode: |
- xfer = SkNEW_ARGS(SkClearXfermode, (rec)); |
+ xfer = SkClearXfermode::Create(rec); |
break; |
case kSrc_Mode: |
- xfer = SkNEW_ARGS(SkSrcXfermode, (rec)); |
+ xfer = SkSrcXfermode::Create(rec); |
break; |
case kSrcOver_Mode: |
SkASSERT(false); // should not land here |
break; |
case kDstIn_Mode: |
- xfer = SkNEW_ARGS(SkDstInXfermode, (rec)); |
+ xfer = SkDstInXfermode::Create(rec); |
break; |
case kDstOut_Mode: |
- xfer = SkNEW_ARGS(SkDstOutXfermode, (rec)); |
+ xfer = SkDstOutXfermode::Create(rec); |
break; |
default: |
// no special-case, just rely in the rec and its function-ptrs |
- xfer = SkNEW_ARGS(SkProcCoeffXfermode, (rec, mode)); |
+ xfer = SkProcCoeffXfermode::Create(rec, mode); |
break; |
} |
} |