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

Side by Side Diff: src/core/SkComposeShader.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/core/SkComposeShader.h ('k') | src/core/SkImageFilter.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 const GrFragmentProcessor* SkComposeShader::asFragmentProcessor( 186 sk_sp<GrFragmentProcessor> SkComposeShader::asFragmentProcessor(
187 GrContext* context, 187 GrContext* context,
188 const SkMatrix& viewM, 188 const SkMatrix& viewM,
189 const SkMatrix* localMatrix , 189 const SkMatrix* localMatrix ,
190 SkFilterQuality fq, 190 SkFilterQuality fq,
191 SkSourceGammaTreatment gamm aTreatment) const { 191 SkSourceGammaTreatment gamm aTreatment) const {
192 // Fragment processor will only support SkXfermode::Mode modes currently. 192 // Fragment processor will only support SkXfermode::Mode modes currently.
193 SkXfermode::Mode mode; 193 SkXfermode::Mode mode;
194 if (!(SkXfermode::AsMode(fMode, &mode))) { 194 if (!(SkXfermode::AsMode(fMode, &mode))) {
195 return nullptr; 195 return nullptr;
196 } 196 }
197 197
198 switch (mode) { 198 switch (mode) {
199 case SkXfermode::kClear_Mode: 199 case SkXfermode::kClear_Mode:
200 return GrConstColorProcessor::Create(GrColor_TRANSPARENT_BLACK, 200 return GrConstColorProcessor::Make(GrColor_TRANSPARENT_BLACK,
201 GrConstColorProcessor::kIgnore_ InputMode); 201 GrConstColorProcessor::kIgnore_In putMode);
202 break; 202 break;
203 case SkXfermode::kSrc_Mode: 203 case SkXfermode::kSrc_Mode:
204 return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq , gammaTreatment); 204 return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq , gammaTreatment);
205 break; 205 break;
206 case SkXfermode::kDst_Mode: 206 case SkXfermode::kDst_Mode:
207 return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq , gammaTreatment); 207 return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq , gammaTreatment);
208 break; 208 break;
209 default: 209 default:
210 SkAutoTUnref<const GrFragmentProcessor> fpA(fShaderA->asFragmentProc essor(context, 210 sk_sp<GrFragmentProcessor> fpA(fShaderA->asFragmentProcessor(context ,
211 viewM, localMatrix, fq, gammaTreatment)); 211 viewM, localMatrix, fq, gammaTreatmen t));
212 if (!fpA.get()) { 212 if (!fpA) {
213 return nullptr; 213 return nullptr;
214 } 214 }
215 SkAutoTUnref<const GrFragmentProcessor> fpB(fShaderB->asFragmentProc essor(context, 215 sk_sp<GrFragmentProcessor> fpB(fShaderB->asFragmentProcessor(context ,
216 viewM, localMatrix, fq, gammaTreatment)); 216 viewM, localMatrix, fq, gammaTreatmen t));
217 if (!fpB.get()) { 217 if (!fpB) {
218 return nullptr; 218 return nullptr;
219 } 219 }
220 return GrXfermodeFragmentProcessor::CreateFromTwoProcessors(fpB, fpA , mode); 220 return GrXfermodeFragmentProcessor::MakeFromTwoProcessors(std::move( fpB),
221 std::move( fpA), mode);
221 } 222 }
222 } 223 }
223 #endif 224 #endif
224 225
225 #ifndef SK_IGNORE_TO_STRING 226 #ifndef SK_IGNORE_TO_STRING
226 void SkComposeShader::toString(SkString* str) const { 227 void SkComposeShader::toString(SkString* str) const {
227 str->append("SkComposeShader: ("); 228 str->append("SkComposeShader: (");
228 229
229 str->append("ShaderA: "); 230 str->append("ShaderA: ");
230 fShaderA->toString(str); 231 fShaderA->toString(str);
(...skipping 17 matching lines...) Expand all
248 if (!dst || !src) { 249 if (!dst || !src) {
249 return nullptr; 250 return nullptr;
250 } 251 }
251 return sk_make_sp<SkComposeShader>(std::move(dst), std::move(src), std::move (xfer)); 252 return sk_make_sp<SkComposeShader>(std::move(dst), std::move(src), std::move (xfer));
252 } 253 }
253 254
254 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src, 255 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src,
255 SkXfermode::Mode mode) { 256 SkXfermode::Mode mode) {
256 return MakeComposeShader(std::move(dst), std::move(src), SkXfermode::Make(mo de)); 257 return MakeComposeShader(std::move(dst), std::move(src), SkXfermode::Make(mo de));
257 } 258 }
OLDNEW
« no previous file with comments | « src/core/SkComposeShader.h ('k') | src/core/SkImageFilter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698