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

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

Issue 2037413002: Add SkSourceGammaTreatment enum so we know how to create mips (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix DM compilation 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/SkImageCacherator.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 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(GrContext* conte xt, 186 const GrFragmentProcessor* SkComposeShader::asFragmentProcessor(
187 const SkMatrix& view M, 187 GrContext* context,
188 const SkMatrix* loca lMatrix, 188 const SkMatrix& viewM,
189 SkFilterQuality fq) const { 189 const SkMatrix* localMatrix ,
190 SkFilterQuality fq,
191 SkSourceGammaTreatment gamm aTreatment) const {
190 // Fragment processor will only support SkXfermode::Mode modes currently. 192 // Fragment processor will only support SkXfermode::Mode modes currently.
191 SkXfermode::Mode mode; 193 SkXfermode::Mode mode;
192 if (!(SkXfermode::AsMode(fMode, &mode))) { 194 if (!(SkXfermode::AsMode(fMode, &mode))) {
193 return nullptr; 195 return nullptr;
194 } 196 }
195 197
196 switch (mode) { 198 switch (mode) {
197 case SkXfermode::kClear_Mode: 199 case SkXfermode::kClear_Mode:
198 return GrConstColorProcessor::Create(GrColor_TRANSPARENT_BLACK, 200 return GrConstColorProcessor::Create(GrColor_TRANSPARENT_BLACK,
199 GrConstColorProcessor::kIgnore_ InputMode); 201 GrConstColorProcessor::kIgnore_ InputMode);
200 break; 202 break;
201 case SkXfermode::kSrc_Mode: 203 case SkXfermode::kSrc_Mode:
202 return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq ); 204 return fShaderB->asFragmentProcessor(context, viewM, localMatrix, fq , gammaTreatment);
203 break; 205 break;
204 case SkXfermode::kDst_Mode: 206 case SkXfermode::kDst_Mode:
205 return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq ); 207 return fShaderA->asFragmentProcessor(context, viewM, localMatrix, fq , gammaTreatment);
206 break; 208 break;
207 default: 209 default:
208 SkAutoTUnref<const GrFragmentProcessor> fpA(fShaderA->asFragmentProc essor(context, 210 SkAutoTUnref<const GrFragmentProcessor> fpA(fShaderA->asFragmentProc essor(context,
209 viewM, localMatrix, fq)) ; 211 viewM, localMatrix, fq, gammaTreatment));
210 if (!fpA.get()) { 212 if (!fpA.get()) {
211 return nullptr; 213 return nullptr;
212 } 214 }
213 SkAutoTUnref<const GrFragmentProcessor> fpB(fShaderB->asFragmentProc essor(context, 215 SkAutoTUnref<const GrFragmentProcessor> fpB(fShaderB->asFragmentProc essor(context,
214 viewM, localMatrix, fq)) ; 216 viewM, localMatrix, fq, gammaTreatment));
215 if (!fpB.get()) { 217 if (!fpB.get()) {
216 return nullptr; 218 return nullptr;
217 } 219 }
218 return GrXfermodeFragmentProcessor::CreateFromTwoProcessors(fpB, fpA , mode); 220 return GrXfermodeFragmentProcessor::CreateFromTwoProcessors(fpB, fpA , mode);
219 } 221 }
220 } 222 }
221 #endif 223 #endif
222 224
223 #ifndef SK_IGNORE_TO_STRING 225 #ifndef SK_IGNORE_TO_STRING
224 void SkComposeShader::toString(SkString* str) const { 226 void SkComposeShader::toString(SkString* str) const {
(...skipping 21 matching lines...) Expand all
246 if (!dst || !src) { 248 if (!dst || !src) {
247 return nullptr; 249 return nullptr;
248 } 250 }
249 return sk_make_sp<SkComposeShader>(std::move(dst), std::move(src), std::move (xfer)); 251 return sk_make_sp<SkComposeShader>(std::move(dst), std::move(src), std::move (xfer));
250 } 252 }
251 253
252 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src, 254 sk_sp<SkShader> SkShader::MakeComposeShader(sk_sp<SkShader> dst, sk_sp<SkShader> src,
253 SkXfermode::Mode mode) { 255 SkXfermode::Mode mode) {
254 return MakeComposeShader(std::move(dst), std::move(src), SkXfermode::Make(mo de)); 256 return MakeComposeShader(std::move(dst), std::move(src), SkXfermode::Make(mo de));
255 } 257 }
OLDNEW
« no previous file with comments | « src/core/SkComposeShader.h ('k') | src/core/SkImageCacherator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698