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 "SkBlitter.h" | 8 #include "SkBlitter.h" |
9 #include "SkAntiRun.h" | 9 #include "SkAntiRun.h" |
10 #include "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 }; | 781 }; |
782 | 782 |
783 /////////////////////////////////////////////////////////////////////////////// | 783 /////////////////////////////////////////////////////////////////////////////// |
784 | 784 |
785 #include "SkCoreBlitters.h" | 785 #include "SkCoreBlitters.h" |
786 | 786 |
787 SkShader::ContextRec::DstType SkBlitter::PreferredShaderDest(const SkImageInfo&
dstInfo) { | 787 SkShader::ContextRec::DstType SkBlitter::PreferredShaderDest(const SkImageInfo&
dstInfo) { |
788 #ifdef SK_FORCE_PM4f_FOR_L32_BLITS | 788 #ifdef SK_FORCE_PM4f_FOR_L32_BLITS |
789 return SkShader::ContextRec::kPM4f_DstType; | 789 return SkShader::ContextRec::kPM4f_DstType; |
790 #else | 790 #else |
791 return (dstInfo.isSRGB() || dstInfo.colorType() == kRGBA_F16_SkColorType) | 791 return (dstInfo.gammaCloseToSRGB() || dstInfo.colorType() == kRGBA_F16_SkCol
orType) |
792 ? SkShader::ContextRec::kPM4f_DstType | 792 ? SkShader::ContextRec::kPM4f_DstType |
793 : SkShader::ContextRec::kPMColor_DstType; | 793 : SkShader::ContextRec::kPMColor_DstType; |
794 #endif | 794 #endif |
795 } | 795 } |
796 | 796 |
797 SkBlitter* SkBlitter::Choose(const SkPixmap& device, | 797 SkBlitter* SkBlitter::Choose(const SkPixmap& device, |
798 const SkMatrix& matrix, | 798 const SkMatrix& matrix, |
799 const SkPaint& origPaint, | 799 const SkPaint& origPaint, |
800 SkTBlitterAllocator* allocator, | 800 SkTBlitterAllocator* allocator, |
801 bool drawCoverage) { | 801 bool drawCoverage) { |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
915 break; | 915 break; |
916 | 916 |
917 case kRGB_565_SkColorType: | 917 case kRGB_565_SkColorType: |
918 blitter = SkBlitter_ChooseD565(device, *paint, shaderContext, alloca
tor); | 918 blitter = SkBlitter_ChooseD565(device, *paint, shaderContext, alloca
tor); |
919 break; | 919 break; |
920 | 920 |
921 case kN32_SkColorType: | 921 case kN32_SkColorType: |
922 #ifdef SK_FORCE_PM4f_FOR_L32_BLITS | 922 #ifdef SK_FORCE_PM4f_FOR_L32_BLITS |
923 if (true) | 923 if (true) |
924 #else | 924 #else |
925 if (device.info().isSRGB()) | 925 if (device.info().gammaCloseToSRGB()) |
926 #endif | 926 #endif |
927 { | 927 { |
928 blitter = SkBlitter_ARGB32_Create(device, *paint, shaderContext,
allocator); | 928 blitter = SkBlitter_ARGB32_Create(device, *paint, shaderContext,
allocator); |
929 } else { | 929 } else { |
930 if (shader) { | 930 if (shader) { |
931 blitter = allocator->createT<SkARGB32_Shader_Blitter>( | 931 blitter = allocator->createT<SkARGB32_Shader_Blitter>( |
932 device, *paint, shaderContext); | 932 device, *paint, shaderContext); |
933 } else if (paint->getColor() == SK_ColorBLACK) { | 933 } else if (paint->getColor() == SK_ColorBLACK) { |
934 blitter = allocator->createT<SkARGB32_Black_Blitter>(device,
*paint); | 934 blitter = allocator->createT<SkARGB32_Black_Blitter>(device,
*paint); |
935 } else if (paint->getAlpha() == 0xFF) { | 935 } else if (paint->getAlpha() == 0xFF) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1005 fShaderContext->~Context(); | 1005 fShaderContext->~Context(); |
1006 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); | 1006 SkShader::Context* ctx = fShader->createContext(rec, (void*)fShaderContext); |
1007 if (nullptr == ctx) { | 1007 if (nullptr == ctx) { |
1008 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call | 1008 // Need a valid context in fShaderContext's storage, so we can later (or
our caller) call |
1009 // the in-place destructor. | 1009 // the in-place destructor. |
1010 new (fShaderContext) SkZeroShaderContext(*fShader, rec); | 1010 new (fShaderContext) SkZeroShaderContext(*fShader, rec); |
1011 return false; | 1011 return false; |
1012 } | 1012 } |
1013 return true; | 1013 return true; |
1014 } | 1014 } |
OLD | NEW |