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 #include "SkGrPriv.h" | 10 #include "SkGrPriv.h" |
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
602 return false; | 602 return false; |
603 } | 603 } |
604 } | 604 } |
605 } | 605 } |
606 | 606 |
607 // When the xfermode is null on the SkPaint (meaning kSrcOver) we need the X
PFactory field on | 607 // When the xfermode is null on the SkPaint (meaning kSrcOver) we need the X
PFactory field on |
608 // the GrPaint to also be null (also kSrcOver). | 608 // the GrPaint to also be null (also kSrcOver). |
609 SkASSERT(!grPaint->getXPFactory()); | 609 SkASSERT(!grPaint->getXPFactory()); |
610 SkXfermode* xfermode = skPaint.getXfermode(); | 610 SkXfermode* xfermode = skPaint.getXfermode(); |
611 if (xfermode) { | 611 if (xfermode) { |
612 // SafeUnref in case a new xfermode is added that returns null. | 612 // SafeUnref in case a new xfermode is added that returns null. |
613 // In such cases we will fall back to kSrcOver_Mode. | 613 // In such cases we will fall back to kSrcOver_Mode. |
614 SkSafeUnref(grPaint->setXPFactory(xfermode->asXPFactory())); | 614 SkSafeUnref(grPaint->setXPFactory(xfermode->asXPFactory())); |
615 } | 615 } |
616 | 616 |
617 #ifndef SK_IGNORE_GPU_DITHER | 617 #ifndef SK_IGNORE_GPU_DITHER |
618 if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0) { | 618 if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0) { |
619 grPaint->addColorFragmentProcessor(GrDitherEffect::Create())->unref(); | 619 grPaint->addColorFragmentProcessor(GrDitherEffect::Create())->unref(); |
620 } | 620 } |
621 #endif | 621 #endif |
622 return true; | 622 return true; |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
749 SkErrorInternals::SetError( kInvalidPaint_SkError, | 749 SkErrorInternals::SetError( kInvalidPaint_SkError, |
750 "Sorry, I don't understand the filtering
" | 750 "Sorry, I don't understand the filtering
" |
751 "mode you asked for. Falling back to " | 751 "mode you asked for. Falling back to " |
752 "MIPMaps."); | 752 "MIPMaps."); |
753 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 753 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
754 break; | 754 break; |
755 | 755 |
756 } | 756 } |
757 return textureFilterMode; | 757 return textureFilterMode; |
758 } | 758 } |
OLD | NEW |