OLD | NEW |
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 "SkAtomics.h" | 8 #include "SkAtomics.h" |
9 #include "SkBitmapProcShader.h" | 9 #include "SkBitmapProcShader.h" |
10 #include "SkColorShader.h" | 10 #include "SkColorShader.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 ////////////////////////////////////////////////////////////////////////////// | 207 ////////////////////////////////////////////////////////////////////////////// |
208 | 208 |
209 SkShader::BitmapType SkShader::asABitmap(SkBitmap*, SkMatrix*, TileMode*) const
{ | 209 SkShader::BitmapType SkShader::asABitmap(SkBitmap*, SkMatrix*, TileMode*) const
{ |
210 return kNone_BitmapType; | 210 return kNone_BitmapType; |
211 } | 211 } |
212 | 212 |
213 SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const { | 213 SkShader::GradientType SkShader::asAGradient(GradientInfo* info) const { |
214 return kNone_GradientType; | 214 return kNone_GradientType; |
215 } | 215 } |
216 | 216 |
217 bool SkShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&,
const SkMatrix*, | 217 const GrFragmentProcessor* SkShader::asFragmentProcessor(GrContext*, const SkMat
rix&, |
218 GrColor*, GrProcessorDataManager*, | 218 const SkMatrix*, SkFilt
erQuality, |
219 GrFragmentProcessor**) const { | 219 GrProcessorDataManager*
) const { |
220 return false; | 220 return nullptr; |
221 } | 221 } |
222 | 222 |
223 SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const { | 223 SkShader* SkShader::refAsALocalMatrixShader(SkMatrix*) const { |
224 return nullptr; | 224 return nullptr; |
225 } | 225 } |
226 | 226 |
227 SkShader* SkShader::CreateEmptyShader() { return new SkEmptyShader; } | 227 SkShader* SkShader::CreateEmptyShader() { return new SkEmptyShader; } |
228 | 228 |
229 SkShader* SkShader::CreateColorShader(SkColor color) { return new SkColorShader(
color); } | 229 SkShader* SkShader::CreateColorShader(SkColor color) { return new SkColorShader(
color); } |
230 | 230 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
328 } | 328 } |
329 info->fColorCount = 1; | 329 info->fColorCount = 1; |
330 info->fTileMode = SkShader::kRepeat_TileMode; | 330 info->fTileMode = SkShader::kRepeat_TileMode; |
331 } | 331 } |
332 return kColor_GradientType; | 332 return kColor_GradientType; |
333 } | 333 } |
334 | 334 |
335 #if SK_SUPPORT_GPU | 335 #if SK_SUPPORT_GPU |
336 | 336 |
337 #include "SkGr.h" | 337 #include "SkGr.h" |
338 | 338 #include "effects/GrConstColorProcessor.h" |
339 bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const
SkMatrix&, | 339 const GrFragmentProcessor* SkColorShader::asFragmentProcessor(GrContext*, const
SkMatrix&, |
340 const SkMatrix*, GrColor* paintColor, | 340 const SkMatrix*, S
kFilterQuality, |
341 GrProcessorDataManager*, GrFragmentProce
ssor** fp) const { | 341 GrProcessorDataMan
ager*) const { |
342 *fp = nullptr; | 342 GrColor color = SkColor2GrColor(fColor); |
343 SkColor skColor = fColor; | 343 return GrConstColorProcessor::Create(color, GrConstColorProcessor::kModulate
A_InputMode); |
344 U8CPU newA = SkMulDiv255Round(SkColorGetA(fColor), paint.getAlpha()); | |
345 *paintColor = SkColor2GrColor(SkColorSetA(skColor, newA)); | |
346 return true; | |
347 } | |
348 | |
349 #else | |
350 | |
351 bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatr
ix&, | |
352 const SkMatrix*, GrColor*, GrProcessorDa
taManager*, | |
353 GrFragmentProcessor**) const { | |
354 SkDEBUGFAIL("Should not call in GPU-less build"); | |
355 return false; | |
356 } | 344 } |
357 | 345 |
358 #endif | 346 #endif |
359 | 347 |
360 #ifndef SK_IGNORE_TO_STRING | 348 #ifndef SK_IGNORE_TO_STRING |
361 void SkColorShader::toString(SkString* str) const { | 349 void SkColorShader::toString(SkString* str) const { |
362 str->append("SkColorShader: ("); | 350 str->append("SkColorShader: ("); |
363 | 351 |
364 str->append("Color: "); | 352 str->append("Color: "); |
365 str->appendHex(fColor); | 353 str->appendHex(fColor); |
(...skipping 14 matching lines...) Expand all Loading... |
380 #include "SkEmptyShader.h" | 368 #include "SkEmptyShader.h" |
381 | 369 |
382 void SkEmptyShader::toString(SkString* str) const { | 370 void SkEmptyShader::toString(SkString* str) const { |
383 str->append("SkEmptyShader: ("); | 371 str->append("SkEmptyShader: ("); |
384 | 372 |
385 this->INHERITED::toString(str); | 373 this->INHERITED::toString(str); |
386 | 374 |
387 str->append(")"); | 375 str->append(")"); |
388 } | 376 } |
389 #endif | 377 #endif |
OLD | NEW |