OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2009 The Android Open Source Project | 2 * Copyright 2009 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 "SkBitmapProcState_opts_SSE2.h" | 8 #include "SkBitmapProcState_opts_SSE2.h" |
9 #include "SkBitmapProcState_opts_SSSE3.h" | 9 #include "SkBitmapProcState_opts_SSSE3.h" |
| 10 #include "SkBitmapFilter_opts_SSE2.h" |
10 #include "SkBlitMask.h" | 11 #include "SkBlitMask.h" |
11 #include "SkBlitRow.h" | 12 #include "SkBlitRow.h" |
12 #include "SkBlitRect_opts_SSE2.h" | 13 #include "SkBlitRect_opts_SSE2.h" |
13 #include "SkBlitRow_opts_SSE2.h" | 14 #include "SkBlitRow_opts_SSE2.h" |
14 #include "SkUtils_opts_SSE2.h" | 15 #include "SkUtils_opts_SSE2.h" |
15 #include "SkUtils.h" | 16 #include "SkUtils.h" |
16 | 17 |
| 18 #include "SkRTConf.h" |
| 19 |
17 #if defined(_MSC_VER) && defined(_WIN64) | 20 #if defined(_MSC_VER) && defined(_WIN64) |
18 #include <intrin.h> | 21 #include <intrin.h> |
19 #endif | 22 #endif |
20 | 23 |
21 /* This file must *not* be compiled with -msse or -msse2, otherwise | 24 /* This file must *not* be compiled with -msse or -msse2, otherwise |
22 gcc may generate sse2 even for scalar ops (and thus give an invalid | 25 gcc may generate sse2 even for scalar ops (and thus give an invalid |
23 instruction on Pentium3 on the code below). Only files named *_SSE2.cpp | 26 instruction on Pentium3 on the code below). Only files named *_SSE2.cpp |
24 in this directory should be compiled with -msse2. */ | 27 in this directory should be compiled with -msse2. */ |
25 | 28 |
26 | 29 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 static bool cachedHasSSE2() { | 98 static bool cachedHasSSE2() { |
96 static bool gHasSSE2 = hasSSE2(); | 99 static bool gHasSSE2 = hasSSE2(); |
97 return gHasSSE2; | 100 return gHasSSE2; |
98 } | 101 } |
99 | 102 |
100 static bool cachedHasSSSE3() { | 103 static bool cachedHasSSSE3() { |
101 static bool gHasSSSE3 = hasSSSE3(); | 104 static bool gHasSSSE3 = hasSSSE3(); |
102 return gHasSSSE3; | 105 return gHasSSSE3; |
103 } | 106 } |
104 | 107 |
| 108 SK_CONF_DECLARE( bool, c_hqfilter_sse, "bitmap.filter.highQualitySSE", false, "U
se SSE optimized version of high quality image filters"); |
| 109 |
105 void SkBitmapProcState::platformProcs() { | 110 void SkBitmapProcState::platformProcs() { |
106 if (cachedHasSSSE3()) { | 111 if (cachedHasSSSE3()) { |
107 #if !defined(SK_BUILD_FOR_ANDROID) | 112 #if !defined(SK_BUILD_FOR_ANDROID) |
108 // Disable SSSE3 optimization for Android x86 | 113 // Disable SSSE3 optimization for Android x86 |
109 if (fSampleProc32 == S32_opaque_D32_filter_DX) { | 114 if (fSampleProc32 == S32_opaque_D32_filter_DX) { |
110 fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3; | 115 fSampleProc32 = S32_opaque_D32_filter_DX_SSSE3; |
111 } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { | 116 } else if (fSampleProc32 == S32_alpha_D32_filter_DX) { |
112 fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3; | 117 fSampleProc32 = S32_alpha_D32_filter_DX_SSSE3; |
113 } | 118 } |
114 | 119 |
(...skipping 20 matching lines...) Expand all Loading... |
135 fMatrixProc = ClampX_ClampY_filter_scale_SSE2; | 140 fMatrixProc = ClampX_ClampY_filter_scale_SSE2; |
136 } else if (fMatrixProc == ClampX_ClampY_nofilter_scale) { | 141 } else if (fMatrixProc == ClampX_ClampY_nofilter_scale) { |
137 fMatrixProc = ClampX_ClampY_nofilter_scale_SSE2; | 142 fMatrixProc = ClampX_ClampY_nofilter_scale_SSE2; |
138 } | 143 } |
139 | 144 |
140 if (fMatrixProc == ClampX_ClampY_filter_affine) { | 145 if (fMatrixProc == ClampX_ClampY_filter_affine) { |
141 fMatrixProc = ClampX_ClampY_filter_affine_SSE2; | 146 fMatrixProc = ClampX_ClampY_filter_affine_SSE2; |
142 } else if (fMatrixProc == ClampX_ClampY_nofilter_affine) { | 147 } else if (fMatrixProc == ClampX_ClampY_nofilter_affine) { |
143 fMatrixProc = ClampX_ClampY_nofilter_affine_SSE2; | 148 fMatrixProc = ClampX_ClampY_nofilter_affine_SSE2; |
144 } | 149 } |
| 150 if (c_hqfilter_sse) { |
| 151 if (fShaderProc32 == highQualityFilter) { |
| 152 fShaderProc32 = highQualityFilter_SSE2; |
| 153 } |
| 154 if (fShaderProc32 == highQualityFilter_ScaleOnly) { |
| 155 fShaderProc32 = highQualityFilter_ScaleOnly_SSE2; |
| 156 } |
| 157 } |
145 } | 158 } |
146 } | 159 } |
147 | 160 |
148 static SkBlitRow::Proc32 platform_32_procs[] = { | 161 static SkBlitRow::Proc32 platform_32_procs[] = { |
149 NULL, // S32_Opaque, | 162 NULL, // S32_Opaque, |
150 S32_Blend_BlitRow32_SSE2, // S32_Blend, | 163 S32_Blend_BlitRow32_SSE2, // S32_Blend, |
151 S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque | 164 S32A_Opaque_BlitRow32_SSE2, // S32A_Opaque |
152 S32A_Blend_BlitRow32_SSE2, // S32A_Blend, | 165 S32A_Blend_BlitRow32_SSE2, // S32A_Blend, |
153 }; | 166 }; |
154 | 167 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
233 | 246 |
234 SkBlitRow::ColorRectProc PlatformColorRectProcFactory(); // suppress warning | 247 SkBlitRow::ColorRectProc PlatformColorRectProcFactory(); // suppress warning |
235 | 248 |
236 SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { | 249 SkBlitRow::ColorRectProc PlatformColorRectProcFactory() { |
237 if (cachedHasSSE2()) { | 250 if (cachedHasSSE2()) { |
238 return ColorRect32_SSE2; | 251 return ColorRect32_SSE2; |
239 } else { | 252 } else { |
240 return NULL; | 253 return NULL; |
241 } | 254 } |
242 } | 255 } |
OLD | NEW |