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

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

Issue 2041113004: sk_sp for gpu. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Reserve correctly. Created 4 years, 6 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/GrCircleBlurFragmentProcessor.cpp ('k') | src/effects/SkArithmeticMode_gpu.h » ('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 "SkNx.h" 10 #include "SkNx.h"
(...skipping 15 matching lines...) Expand all
26 fK[3] = k4; 26 fK[3] = k4;
27 fEnforcePMColor = enforcePMColor; 27 fEnforcePMColor = enforcePMColor;
28 } 28 }
29 29
30 void xfer32(SkPMColor[], const SkPMColor[], int count, const SkAlpha[]) cons t override; 30 void xfer32(SkPMColor[], const SkPMColor[], int count, const SkAlpha[]) cons t override;
31 31
32 SK_TO_STRING_OVERRIDE() 32 SK_TO_STRING_OVERRIDE()
33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar) 33 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkArithmeticMode_scalar)
34 34
35 #if SK_SUPPORT_GPU 35 #if SK_SUPPORT_GPU
36 const GrFragmentProcessor* getFragmentProcessorForImageFilter( 36 sk_sp<GrFragmentProcessor> makeFragmentProcessorForImageFilter(
37 const GrFragmentProcessor* dst) const override; 37 sk_sp<GrFragmentProcessor> dst) const override;
38 GrXPFactory* asXPFactory() const override; 38 sk_sp<GrXPFactory> asXPFactory() const override;
39 #endif 39 #endif
40 40
41 private: 41 private:
42 void flatten(SkWriteBuffer& buffer) const override { 42 void flatten(SkWriteBuffer& buffer) const override {
43 buffer.writeScalar(fK[0]); 43 buffer.writeScalar(fK[0]);
44 buffer.writeScalar(fK[1]); 44 buffer.writeScalar(fK[1]);
45 buffer.writeScalar(fK[2]); 45 buffer.writeScalar(fK[2]);
46 buffer.writeScalar(fK[3]); 46 buffer.writeScalar(fK[3]);
47 buffer.writeBool(fEnforcePMColor); 47 buffer.writeBool(fEnforcePMColor);
48 } 48 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 SkScalarNearlyEqual(k3, SK_Scalar1) && SkScalarNearlyZero(k4)) { 120 SkScalarNearlyEqual(k3, SK_Scalar1) && SkScalarNearlyZero(k4)) {
121 return SkXfermode::Make(SkXfermode::kDst_Mode); 121 return SkXfermode::Make(SkXfermode::kDst_Mode);
122 } 122 }
123 return sk_make_sp<SkArithmeticMode_scalar>(k1, k2, k3, k4, enforcePMColor); 123 return sk_make_sp<SkArithmeticMode_scalar>(k1, k2, k3, k4, enforcePMColor);
124 } 124 }
125 125
126 126
127 ////////////////////////////////////////////////////////////////////////////// 127 //////////////////////////////////////////////////////////////////////////////
128 128
129 #if SK_SUPPORT_GPU 129 #if SK_SUPPORT_GPU
130 const GrFragmentProcessor* SkArithmeticMode_scalar::getFragmentProcessorForImage Filter( 130 sk_sp<GrFragmentProcessor> SkArithmeticMode_scalar::makeFragmentProcessorForImag eFilter(
131 const GrFragmentProc essor* dst) const { 131 sk_sp<GrFragmentProc essor> dst) const {
132 return GrArithmeticFP::Create(SkScalarToFloat(fK[0]), 132 return GrArithmeticFP::Make(SkScalarToFloat(fK[0]),
133 SkScalarToFloat(fK[1]), 133 SkScalarToFloat(fK[1]),
134 SkScalarToFloat(fK[2]), 134 SkScalarToFloat(fK[2]),
135 SkScalarToFloat(fK[3]), 135 SkScalarToFloat(fK[3]),
136 fEnforcePMColor, 136 fEnforcePMColor,
137 dst); 137 std::move(dst));
138 } 138 }
139 139
140 GrXPFactory* SkArithmeticMode_scalar::asXPFactory() const { 140 sk_sp<GrXPFactory> SkArithmeticMode_scalar::asXPFactory() const {
141 return GrArithmeticXPFactory::Create(SkScalarToFloat(fK[0]), 141 return GrArithmeticXPFactory::Make(SkScalarToFloat(fK[0]),
142 SkScalarToFloat(fK[1]), 142 SkScalarToFloat(fK[1]),
143 SkScalarToFloat(fK[2]), 143 SkScalarToFloat(fK[2]),
144 SkScalarToFloat(fK[3]), 144 SkScalarToFloat(fK[3]),
145 fEnforcePMColor); 145 fEnforcePMColor);
146 } 146 }
147 147
148 #endif 148 #endif
149 149
150 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode) 150 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_START(SkArithmeticMode)
151 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar) 151 SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkArithmeticMode_scalar)
152 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END 152 SK_DEFINE_FLATTENABLE_REGISTRAR_GROUP_END
OLDNEW
« no previous file with comments | « src/effects/GrCircleBlurFragmentProcessor.cpp ('k') | src/effects/SkArithmeticMode_gpu.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698