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

Side by Side Diff: src/effects/SkArithmeticMode.cpp

Issue 1855733002: change flattenable factory to return sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « src/effects/SkArcToPathEffect.cpp ('k') | src/effects/SkAvoidXfermode.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "SkArithmeticMode.h" 8 #include "SkArithmeticMode.h"
9 #include "SkColorPriv.h" 9 #include "SkColorPriv.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 48
49 SkScalar fK[4]; 49 SkScalar fK[4];
50 bool fEnforcePMColor; 50 bool fEnforcePMColor;
51 51
52 friend class SkArithmeticMode; 52 friend class SkArithmeticMode;
53 53
54 typedef SkXfermode INHERITED; 54 typedef SkXfermode INHERITED;
55 }; 55 };
56 56
57 SkFlattenable* SkArithmeticMode_scalar::CreateProc(SkReadBuffer& buffer) { 57 sk_sp<SkFlattenable> SkArithmeticMode_scalar::CreateProc(SkReadBuffer& buffer) {
58 const SkScalar k1 = buffer.readScalar(); 58 const SkScalar k1 = buffer.readScalar();
59 const SkScalar k2 = buffer.readScalar(); 59 const SkScalar k2 = buffer.readScalar();
60 const SkScalar k3 = buffer.readScalar(); 60 const SkScalar k3 = buffer.readScalar();
61 const SkScalar k4 = buffer.readScalar(); 61 const SkScalar k4 = buffer.readScalar();
62 const bool enforcePMColor = buffer.readBool(); 62 const bool enforcePMColor = buffer.readBool();
63 return SkArithmeticMode::Make(k1, k2, k3, k4, enforcePMColor).release(); 63 return SkArithmeticMode::Make(k1, k2, k3, k4, enforcePMColor);
64 } 64 }
65 65
66 static int pinToByte(int value) { 66 static int pinToByte(int value) {
67 if (value < 0) { 67 if (value < 0) {
68 value = 0; 68 value = 0;
69 } else if (value > 255) { 69 } else if (value > 255) {
70 value = 255; 70 value = 255;
71 } 71 }
72 return value; 72 return value;
73 } 73 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 SkScalarToFloat(fK[2]), 169 SkScalarToFloat(fK[2]),
170 SkScalarToFloat(fK[3]), 170 SkScalarToFloat(fK[3]),
171 fEnforcePMColor); 171 fEnforcePMColor);
172 } 172 }
173 173
174 #endif 174 #endif
175 175
176 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 176 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
177 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 177 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
178 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 178 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/SkArcToPathEffect.cpp ('k') | src/effects/SkAvoidXfermode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698