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

Unified Diff: src/effects/SkArithmeticMode.cpp

Issue 166583002: Factory methods for heap-allocated SkPathEffect and SkXfermode objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update experimental/PdfViewer 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
« no previous file with comments | « src/core/SkXfermode_proccoeff.h ('k') | src/utils/debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/effects/SkArithmeticMode.cpp
diff --git a/src/effects/SkArithmeticMode.cpp b/src/effects/SkArithmeticMode.cpp
index 052b06507c26a364d4c735c13a94718736ebdd7b..2121e3a81dadea597b4f21018e189152a8615425 100644
--- a/src/effects/SkArithmeticMode.cpp
+++ b/src/effects/SkArithmeticMode.cpp
@@ -23,11 +23,8 @@ static const bool gUseUnpremul = false;
class SkArithmeticMode_scalar : public SkXfermode {
public:
- SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4) {
- fK[0] = k1;
- fK[1] = k2;
- fK[2] = k3;
- fK[3] = k4;
+ static SkArithmeticMode_scalar* Create(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4) {
+ return SkNEW_ARGS(SkArithmeticMode_scalar, (k1, k2, k3, k4));
}
virtual void xfer32(SkPMColor dst[], const SkPMColor src[], int count,
@@ -41,6 +38,13 @@ public:
#endif
private:
+ SkArithmeticMode_scalar(SkScalar k1, SkScalar k2, SkScalar k3, SkScalar k4) {
+ fK[0] = k1;
+ fK[1] = k2;
+ fK[2] = k3;
+ fK[3] = k4;
+ }
+
SkArithmeticMode_scalar(SkReadBuffer& buffer) : INHERITED(buffer) {
fK[0] = buffer.readScalar();
fK[1] = buffer.readScalar();
@@ -216,7 +220,7 @@ SkXfermode* SkArithmeticMode::Create(SkScalar k1, SkScalar k2,
return SkNEW_ARGS(SkArithmeticMode_linear, (i2, i3, i4));
#endif
}
- return SkNEW_ARGS(SkArithmeticMode_scalar, (k1, k2, k3, k4));
+ return SkArithmeticMode_scalar::Create(k1, k2, k3, k4);
}
« no previous file with comments | « src/core/SkXfermode_proccoeff.h ('k') | src/utils/debugger/SkDebugCanvas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698