| 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" |
| 11 | 11 |
| 12 #include "GrCaps.h" | 12 #include "GrCaps.h" |
| 13 #include "GrContext.h" | 13 #include "GrContext.h" |
| 14 #include "GrDrawContext.h" | 14 #include "GrDrawContext.h" |
| 15 #include "GrGpuResourcePriv.h" | 15 #include "GrGpuResourcePriv.h" |
| 16 #include "GrImageIDTextureAdjuster.h" | 16 #include "GrImageIDTextureAdjuster.h" |
| 17 #include "GrTextureParamsAdjuster.h" | 17 #include "GrTextureParamsAdjuster.h" |
| 18 #include "GrTexturePriv.h" | 18 #include "GrTexturePriv.h" |
| 19 #include "GrTypes.h" | 19 #include "GrTypes.h" |
| 20 #include "GrXferProcessor.h" | 20 #include "GrXferProcessor.h" |
| 21 #include "GrYUVProvider.h" | 21 #include "GrYUVProvider.h" |
| 22 | 22 |
| 23 #include "SkBlendModePriv.h" |
| 23 #include "SkColorFilter.h" | 24 #include "SkColorFilter.h" |
| 24 #include "SkConfig8888.h" | 25 #include "SkConfig8888.h" |
| 25 #include "SkCanvas.h" | 26 #include "SkCanvas.h" |
| 26 #include "SkData.h" | 27 #include "SkData.h" |
| 27 #include "SkErrorInternals.h" | 28 #include "SkErrorInternals.h" |
| 28 #include "SkMessageBus.h" | 29 #include "SkMessageBus.h" |
| 29 #include "SkMipMap.h" | 30 #include "SkMipMap.h" |
| 30 #include "SkPixelRef.h" | 31 #include "SkPixelRef.h" |
| 31 #include "SkPM4fPriv.h" | 32 #include "SkPM4fPriv.h" |
| 32 #include "SkResourceCache.h" | 33 #include "SkResourceCache.h" |
| (...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 673 grPaint->addColorFragmentProcessor(std::move(cfFP)); | 674 grPaint->addColorFragmentProcessor(std::move(cfFP)); |
| 674 } else { | 675 } else { |
| 675 return false; | 676 return false; |
| 676 } | 677 } |
| 677 } | 678 } |
| 678 } | 679 } |
| 679 | 680 |
| 680 // When the xfermode is null on the SkPaint (meaning kSrcOver) we need the X
PFactory field on | 681 // When the xfermode is null on the SkPaint (meaning kSrcOver) we need the X
PFactory field on |
| 681 // the GrPaint to also be null (also kSrcOver). | 682 // the GrPaint to also be null (also kSrcOver). |
| 682 SkASSERT(!grPaint->getXPFactory()); | 683 SkASSERT(!grPaint->getXPFactory()); |
| 683 SkXfermode* xfermode = skPaint.getXfermode(); | 684 if (!skPaint.isSrcOver()) { |
| 684 if (xfermode) { | 685 grPaint->setXPFactory(SkBlendMode_AsXPFactory(skPaint.getBlendMode())); |
| 685 grPaint->setXPFactory(xfermode->asXPFactory()); | |
| 686 } | 686 } |
| 687 | 687 |
| 688 #ifndef SK_IGNORE_GPU_DITHER | 688 #ifndef SK_IGNORE_GPU_DITHER |
| 689 if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0 && !dc->
isGammaCorrect()) { | 689 if (skPaint.isDither() && grPaint->numColorFragmentProcessors() > 0 && !dc->
isGammaCorrect()) { |
| 690 grPaint->addColorFragmentProcessor(GrDitherEffect::Make()); | 690 grPaint->addColorFragmentProcessor(GrDitherEffect::Make()); |
| 691 } | 691 } |
| 692 #endif | 692 #endif |
| 693 return true; | 693 return true; |
| 694 } | 694 } |
| 695 | 695 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 804 SkErrorInternals::SetError( kInvalidPaint_SkError, | 804 SkErrorInternals::SetError( kInvalidPaint_SkError, |
| 805 "Sorry, I don't understand the filtering
" | 805 "Sorry, I don't understand the filtering
" |
| 806 "mode you asked for. Falling back to " | 806 "mode you asked for. Falling back to " |
| 807 "MIPMaps."); | 807 "MIPMaps."); |
| 808 textureFilterMode = GrTextureParams::kMipMap_FilterMode; | 808 textureFilterMode = GrTextureParams::kMipMap_FilterMode; |
| 809 break; | 809 break; |
| 810 | 810 |
| 811 } | 811 } |
| 812 return textureFilterMode; | 812 return textureFilterMode; |
| 813 } | 813 } |
| OLD | NEW |