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 const GrFragmentProcessor* SkShader::asFragmentProcessor(GrContext*, const SkMat
rix&, | 217 bool SkShader::asFragmentProcessor(GrContext*, const SkPaint&, const SkMatrix&,
const SkMatrix*, |
218 const SkMatrix*, SkFilt
erQuality, | 218 GrColor*, GrProcessorDataManager*, |
219 GrProcessorDataManager*
) const { | 219 GrFragmentProcessor**) const { |
220 return nullptr; | 220 return false; |
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 #include "effects/GrConstColorProcessor.h" | 338 |
339 const GrFragmentProcessor* SkColorShader::asFragmentProcessor(GrContext*, const
SkMatrix&, | 339 bool SkColorShader::asFragmentProcessor(GrContext*, const SkPaint& paint, const
SkMatrix&, |
340 const SkMatrix*, S
kFilterQuality, | 340 const SkMatrix*, GrColor* paintColor, |
341 GrProcessorDataMan
ager*) const { | 341 GrProcessorDataManager*, GrFragmentProce
ssor** fp) const { |
342 GrColor color = SkColor2GrColor(fColor); | 342 *fp = nullptr; |
343 return GrConstColorProcessor::Create(color, GrConstColorProcessor::kModulate
A_InputMode); | 343 SkColor skColor = fColor; |
| 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; |
344 } | 356 } |
345 | 357 |
346 #endif | 358 #endif |
347 | 359 |
348 #ifndef SK_IGNORE_TO_STRING | 360 #ifndef SK_IGNORE_TO_STRING |
349 void SkColorShader::toString(SkString* str) const { | 361 void SkColorShader::toString(SkString* str) const { |
350 str->append("SkColorShader: ("); | 362 str->append("SkColorShader: ("); |
351 | 363 |
352 str->append("Color: "); | 364 str->append("Color: "); |
353 str->appendHex(fColor); | 365 str->appendHex(fColor); |
(...skipping 14 matching lines...) Expand all Loading... |
368 #include "SkEmptyShader.h" | 380 #include "SkEmptyShader.h" |
369 | 381 |
370 void SkEmptyShader::toString(SkString* str) const { | 382 void SkEmptyShader::toString(SkString* str) const { |
371 str->append("SkEmptyShader: ("); | 383 str->append("SkEmptyShader: ("); |
372 | 384 |
373 this->INHERITED::toString(str); | 385 this->INHERITED::toString(str); |
374 | 386 |
375 str->append(")"); | 387 str->append(")"); |
376 } | 388 } |
377 #endif | 389 #endif |
OLD | NEW |