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

Side by Side Diff: src/core/SkComposeShader.cpp

Issue 2175563003: Bundle SkShader::asFragmentProcessor arguments in a struct (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix indentation to be less arbitrary Created 4 years, 5 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/core/SkComposeShader.h ('k') | src/core/SkLightingShader.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 2006 The Android Open Source Project 2 * Copyright 2006 The Android Open Source Project
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 "SkComposeShader.h" 8 #include "SkComposeShader.h"
9 #include "SkColorFilter.h" 9 #include "SkColorFilter.h"
10 #include "SkColorPriv.h" 10 #include "SkColorPriv.h"
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 } 176 }
177 } 177 }
178 178
179 #if SK_SUPPORT_GPU 179 #if SK_SUPPORT_GPU
180 180
181 #include "effects/GrConstColorProcessor.h" 181 #include "effects/GrConstColorProcessor.h"
182 #include "effects/GrXfermodeFragmentProcessor.h" 182 #include "effects/GrXfermodeFragmentProcessor.h"
183 183
184 ///////////////////////////////////////////////////////////////////// 184 /////////////////////////////////////////////////////////////////////
185 185
186 sk_sp<GrFragmentProcessor> SkComposeShader::asFragmentProcessor( 186 sk_sp<GrFragmentProcessor> SkComposeShader::asFragmentProcessor(const AsFPArgs& args) const {
187 GrContext* context,
188 const SkMatrix& viewM,
189 const SkMatrix* localMatrix ,
190 SkFilterQuality fq,
191 SkSourceGammaTreatment gamm aTreatment) const {
192 // Fragment processor will only support SkXfermode::Mode modes currently. 187 // Fragment processor will only support SkXfermode::Mode modes currently.
193 SkXfermode::Mode mode; 188 SkXfermode::Mode mode;
194 if (!(SkXfermode::AsMode(fMode, &mode))) { 189 if (!(SkXfermode::AsMode(fMode, &mode))) {
195 return nullptr; 190 return nullptr;
196 } 191 }
197 192
198 switch (mode) { 193 switch (mode) {
199 case SkXfermode::kClear_Mode: 194 case SkXfermode::kClear_Mode:
200 return GrConstColorProcessor::Make(GrColor_TRANSPARENT_BLACK, 195 return GrConstColorProcessor::Make(GrColor_TRANSPARENT_BLACK,
201 GrConstColorProcessor::kIgnore_In putMode); 196 GrConstColorProcessor::kIgnore_In putMode);
202 break; 197 break;
203 case SkXfermode::kSrc_Mode: 198 case SkXfermode::kSrc_Mode:
204 return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq , gammaTreatment); 199 return fShaderB->asFragmentProcessor(args);
205 break; 200 break;
206 case SkXfermode::kDst_Mode: 201 case SkXfermode::kDst_Mode:
207 return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq , gammaTreatment); 202 return fShaderA->asFragmentProcessor(args);
208 break; 203 break;
209 default: 204 default:
210 sk_sp<GrFragmentProcessor> fpA(fShaderA->asFragmentProcessor(context , 205 sk_sp<GrFragmentProcessor> fpA(fShaderA->asFragmentProcessor(args));
211 viewM, localMatrix, fq, gammaTreatmen t));
212 if (!fpA) { 206 if (!fpA) {
213 return nullptr; 207 return nullptr;
214 } 208 }
215 sk_sp<GrFragmentProcessor> fpB(fShaderB->asFragmentProcessor(context , 209 sk_sp<GrFragmentProcessor> fpB(fShaderB->asFragmentProcessor(args));
216 viewM, localMatrix, fq, gammaTreatmen t));
217 if (!fpB) { 210 if (!fpB) {
218 return nullptr; 211 return nullptr;
219 } 212 }
220 return GrXfermodeFragmentProcessor::MakeFromTwoProcessors(std::move( fpB), 213 return GrXfermodeFragmentProcessor::MakeFromTwoProcessors(std::move( fpB),
221 std::move( fpA), mode); 214 std::move( fpA), mode);
222 } 215 }
223 } 216 }
224 #endif 217 #endif
225 218
226 #ifndef SK_IGNORE_TO_STRING 219 #ifndef SK_IGNORE_TO_STRING
(...skipping 22 matching lines...) Expand all
249 if (!dst || !src) { 242 if (!dst || !src) {
250 return nullptr; 243 return nullptr;
251 } 244 }
252 return sk_make_sp<SkComposeShader>(std::move(dst), std::move(src), std::move (xfer)); 245 return sk_make_sp<SkComposeShader>(std::move(dst), std::move(src), std::move (xfer));
253 } 246 }
254 247
255 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src, 248 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src,
256 SkXfermode::Mode mode) { 249 SkXfermode::Mode mode) {
257 return MakeComposeShader(std::move(dst), std::move(src), SkXfermode::Make(mo de)); 250 return MakeComposeShader(std::move(dst), std::move(src), SkXfermode::Make(mo de));
258 } 251 }
OLDNEW
« no previous file with comments | « src/core/SkComposeShader.h ('k') | src/core/SkLightingShader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698