OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
9 #include "SkGr.h" | 9 #include "SkGr.h" |
10 | 10 |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 if (cfFP) { | 482 if (cfFP) { |
483 grPaint->addColorFragmentProcessor(cfFP); | 483 grPaint->addColorFragmentProcessor(cfFP); |
484 } else { | 484 } else { |
485 return false; | 485 return false; |
486 } | 486 } |
487 } | 487 } |
488 } | 488 } |
489 | 489 |
490 SkXfermode* mode = skPaint.getXfermode(); | 490 SkXfermode* mode = skPaint.getXfermode(); |
491 GrXPFactory* xpFactory = nullptr; | 491 GrXPFactory* xpFactory = nullptr; |
492 if (!SkXfermode::AsXPFactory(mode, &xpFactory)) { | 492 SkXfermode::AsXPFactory(mode, &xpFactory); |
493 // Fall back to src-over | 493 SkSafeUnref(grPaint->setXPFactory(xpFactory)); |
494 // return false here? | |
495 xpFactory = GrPorterDuffXPFactory::Create(SkXfermode::kSrcOver_Mode); | |
496 } | |
497 SkASSERT(xpFactory); | |
498 grPaint->setXPFactory(xpFactory)->unref(); | |
499 | 494 |
500 #ifndef SK_IGNORE_GPU_DITHER | 495 #ifndef SK_IGNORE_GPU_DITHER |
501 if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0) { | 496 if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0) { |
502 grPaint->addColorFragmentProcessor(GrDitherEffect::Create())->unref(); | 497 grPaint->addColorFragmentProcessor(GrDitherEffect::Create())->unref(); |
503 } | 498 } |
504 #endif | 499 #endif |
505 return true; | 500 return true; |
506 } | 501 } |
507 | 502 |
508 bool SkPaintToGrPaint(GrContext* context, const SkPaint& skPaint, const SkMatrix
& viewM, | 503 bool SkPaintToGrPaint(GrContext* context, const SkPaint& skPaint, const SkMatrix
& viewM, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
632 SkErrorInternals::SetError( kInvalidPaint_SkError, | 627 SkErrorInternals::SetError( kInvalidPaint_SkError, |
633 "Sorry, I don't understand the filtering
" | 628 "Sorry, I don't understand the filtering
" |
634 "mode you asked for. Falling back to " | 629 "mode you asked for. Falling back to " |
635 "MIPMaps."); | 630 "MIPMaps."); |
636 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 631 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
637 break; | 632 break; |
638 | 633 |
639 } | 634 } |
640 return textureFilterMode; | 635 return textureFilterMode; |
641 } | 636 } |
OLD | NEW |