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

Side by Side Diff: src/core/SkColorShader.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/SkColorShader.h ('k') | src/core/SkComposeShader.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 2016 Google Inc. 2 * Copyright 2016 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 "SkColorShader.h" 8 #include "SkColorShader.h"
9 #include "SkColorSpace.h" 9 #include "SkColorSpace.h"
10 #include "SkReadBuffer.h" 10 #include "SkReadBuffer.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 info->fColorCount = 1; 82 info->fColorCount = 1;
83 info->fTileMode = SkShader::kRepeat_TileMode; 83 info->fTileMode = SkShader::kRepeat_TileMode;
84 } 84 }
85 return kColor_GradientType; 85 return kColor_GradientType;
86 } 86 }
87 87
88 #if SK_SUPPORT_GPU 88 #if SK_SUPPORT_GPU
89 89
90 #include "SkGr.h" 90 #include "SkGr.h"
91 #include "effects/GrConstColorProcessor.h" 91 #include "effects/GrConstColorProcessor.h"
92 const GrFragmentProcessor* SkColorShader::asFragmentProcessor(GrContext*, const SkMatrix&, 92 sk_sp<GrFragmentProcessor> SkColorShader::asFragmentProcessor(GrContext*, const SkMatrix&,
93 const SkMatrix*, 93 const SkMatrix*,
94 SkFilterQuality, 94 SkFilterQuality,
95 SkSourceGammaTreat ment) const { 95 SkSourceGammaTreat ment) const {
96 GrColor color = SkColorToPremulGrColor(fColor); 96 GrColor color = SkColorToPremulGrColor(fColor);
97 return GrConstColorProcessor::Create(color, GrConstColorProcessor::kModulate A_InputMode); 97 return GrConstColorProcessor::Make(color, GrConstColorProcessor::kModulateA_ InputMode);
98 } 98 }
99 99
100 #endif 100 #endif
101 101
102 #ifndef SK_IGNORE_TO_STRING 102 #ifndef SK_IGNORE_TO_STRING
103 void SkColorShader::toString(SkString* str) const { 103 void SkColorShader::toString(SkString* str) const {
104 str->append("SkColorShader: ("); 104 str->append("SkColorShader: (");
105 105
106 str->append("Color: "); 106 str->append("Color: ");
107 str->appendHex(fColor); 107 str->appendHex(fColor);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 info->fColorCount = 1; 210 info->fColorCount = 1;
211 info->fTileMode = SkShader::kRepeat_TileMode; 211 info->fTileMode = SkShader::kRepeat_TileMode;
212 } 212 }
213 return kColor_GradientType; 213 return kColor_GradientType;
214 } 214 }
215 215
216 #if SK_SUPPORT_GPU 216 #if SK_SUPPORT_GPU
217 217
218 #include "SkGr.h" 218 #include "SkGr.h"
219 #include "effects/GrConstColorProcessor.h" 219 #include "effects/GrConstColorProcessor.h"
220 const GrFragmentProcessor* SkColor4Shader::asFragmentProcessor(GrContext*, const SkMatrix&, 220 sk_sp<GrFragmentProcessor> SkColor4Shader::asFragmentProcessor(GrContext*, const SkMatrix&,
221 const SkMatrix*, 221 const SkMatrix*,
222 SkFilterQuality, 222 SkFilterQuality,
223 SkSourceGammaTrea tment) const { 223 SkSourceGammaTrea tment) const {
224 // TODO: how to communicate color4f to Gr 224 // TODO: how to communicate color4f to Gr
225 GrColor color = SkColorToPremulGrColor(fCachedByteColor); 225 GrColor color = SkColorToPremulGrColor(fCachedByteColor);
226 return GrConstColorProcessor::Create(color, GrConstColorProcessor::kModulate A_InputMode); 226 return GrConstColorProcessor::Make(color, GrConstColorProcessor::kModulateA_ InputMode);
227 } 227 }
228 228
229 #endif 229 #endif
230 230
231 #ifndef SK_IGNORE_TO_STRING 231 #ifndef SK_IGNORE_TO_STRING
232 void SkColor4Shader::toString(SkString* str) const { 232 void SkColor4Shader::toString(SkString* str) const {
233 str->append("SkColor4Shader: ("); 233 str->append("SkColor4Shader: (");
234 234
235 str->append("ARGB:"); 235 str->append("ARGB:");
236 for (int i = 0; i < 4; ++i) { 236 for (int i = 0; i < 4; ++i) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 } 306 }
307 307
308 bool SkColorShader::ColorShaderContext::onChooseBlitProcs(const SkImageInfo& inf o, 308 bool SkColorShader::ColorShaderContext::onChooseBlitProcs(const SkImageInfo& inf o,
309 BlitState* state) { 309 BlitState* state) {
310 return choose_blitprocs(&fPM4f, info, state); 310 return choose_blitprocs(&fPM4f, info, state);
311 } 311 }
312 312
313 bool SkColor4Shader::Color4Context::onChooseBlitProcs(const SkImageInfo& info, B litState* state) { 313 bool SkColor4Shader::Color4Context::onChooseBlitProcs(const SkImageInfo& info, B litState* state) {
314 return choose_blitprocs(&fPM4f, info, state); 314 return choose_blitprocs(&fPM4f, info, state);
315 } 315 }
OLDNEW
« no previous file with comments | « src/core/SkColorShader.h ('k') | src/core/SkComposeShader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698