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 | 8 |
9 #include "SkBitmapScaler.h" | 9 #include "SkBitmapScaler.h" |
10 #include "SkBitmapProcState.h" | 10 #include "SkBitmapProcState.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 const SkBitmapProcState& s, | 21 const SkBitmapProcState& s, |
22 const uint32_t* SK_RESTRICT xy, | 22 const uint32_t* SK_RESTRICT xy, |
23 int count, | 23 int count, |
24 uint16_t* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1; | 24 uint16_t* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1; |
25 | 25 |
26 void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s, | 26 void SI8_D16_nofilter_DX_arm(const SkBitmapProcState& s, |
27 const uint32_t* SK_RESTRICT xy, | 27 const uint32_t* SK_RESTRICT xy, |
28 int count, uint16_t* SK_RESTRICT colors) { | 28 int count, uint16_t* SK_RESTRICT colors) { |
29 SkASSERT(count > 0 && colors != NULL); | 29 SkASSERT(count > 0 && colors != NULL); |
30 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); | 30 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); |
31 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); | 31 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); |
32 | 32 |
33 const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCac
he(); | 33 const uint16_t* SK_RESTRICT table = s.fBitmap->getColorTable()->read16BitCac
he(); |
34 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); | 34 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); |
35 | 35 |
36 // buffer is y32, x16, x16, x16, x16, x16 | 36 // buffer is y32, x16, x16, x16, x16, x16 |
37 // bump srcAddr to the proper row, since we're told Y never changes | 37 // bump srcAddr to the proper row, since we're told Y never changes |
38 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); | 38 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); |
39 srcAddr = (const uint8_t*)((const char*)srcAddr + | 39 srcAddr = (const uint8_t*)((const char*)srcAddr + |
40 xy[0] * s.fBitmap->rowBytes()); | 40 xy[0] * s.fBitmap->rowBytes()); |
41 | 41 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 const SkBitmapProcState& s, | 110 const SkBitmapProcState& s, |
111 const uint32_t* SK_RESTRICT xy, | 111 const uint32_t* SK_RESTRICT xy, |
112 int count, | 112 int count, |
113 SkPMColor* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1; | 113 SkPMColor* SK_RESTRICT colors) SK_ATTRIBUTE_OPTIMIZE_O1; |
114 | 114 |
115 void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s, | 115 void SI8_opaque_D32_nofilter_DX_arm(const SkBitmapProcState& s, |
116 const uint32_t* SK_RESTRICT xy, | 116 const uint32_t* SK_RESTRICT xy, |
117 int count, SkPMColor* SK_RESTRICT colors) { | 117 int count, SkPMColor* SK_RESTRICT colors) { |
118 SkASSERT(count > 0 && colors != NULL); | 118 SkASSERT(count > 0 && colors != NULL); |
119 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); | 119 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); |
120 SkASSERT(SkPaint::kNone_FilterLevel == s.fFilterLevel); | 120 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); |
121 | 121 |
122 const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors(
); | 122 const SkPMColor* SK_RESTRICT table = s.fBitmap->getColorTable()->readColors(
); |
123 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); | 123 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fBitmap->getPixels(); |
124 | 124 |
125 // buffer is y32, x16, x16, x16, x16, x16 | 125 // buffer is y32, x16, x16, x16, x16, x16 |
126 // bump srcAddr to the proper row, since we're told Y never changes | 126 // bump srcAddr to the proper row, since we're told Y never changes |
127 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); | 127 SkASSERT((unsigned)xy[0] < (unsigned)s.fBitmap->height()); |
128 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte
s()); | 128 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fBitmap->rowByte
s()); |
129 | 129 |
130 if (1 == s.fBitmap->width()) { | 130 if (1 == s.fBitmap->width()) { |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 #if !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN) | 194 #if !defined(SK_CPU_ARM64) && SK_ARM_ARCH >= 6 && !defined(SK_CPU_BENDIAN) |
195 bool isOpaque = 256 == fAlphaScale; | 195 bool isOpaque = 256 == fAlphaScale; |
196 bool justDx = false; | 196 bool justDx = false; |
197 | 197 |
198 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { | 198 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { |
199 justDx = true; | 199 justDx = true; |
200 } | 200 } |
201 | 201 |
202 switch (fBitmap->colorType()) { | 202 switch (fBitmap->colorType()) { |
203 case kIndex_8_SkColorType: | 203 case kIndex_8_SkColorType: |
204 if (justDx && SkPaint::kNone_FilterLevel == fFilterLevel) { | 204 if (justDx && kNone_SkFilterQuality == fFilterLevel) { |
205 #if 0 /* crashing on android device */ | 205 #if 0 /* crashing on android device */ |
206 fSampleProc16 = SI8_D16_nofilter_DX_arm; | 206 fSampleProc16 = SI8_D16_nofilter_DX_arm; |
207 fShaderProc16 = NULL; | 207 fShaderProc16 = NULL; |
208 #endif | 208 #endif |
209 if (isOpaque) { | 209 if (isOpaque) { |
210 // this one is only very slighty faster than the C version | 210 // this one is only very slighty faster than the C version |
211 fSampleProc32 = SI8_opaque_D32_nofilter_DX_arm; | 211 fSampleProc32 = SI8_opaque_D32_nofilter_DX_arm; |
212 fShaderProc32 = NULL; | 212 fShaderProc32 = NULL; |
213 } | 213 } |
214 } | 214 } |
215 break; | 215 break; |
216 default: | 216 default: |
217 break; | 217 break; |
218 } | 218 } |
219 #endif | 219 #endif |
220 } | 220 } |
221 | 221 |
222 /////////////////////////////////////////////////////////////////////////////// | 222 /////////////////////////////////////////////////////////////////////////////// |
223 | 223 |
224 extern void platformConvolutionProcs_arm_neon(SkConvolutionProcs* procs); | 224 extern void platformConvolutionProcs_arm_neon(SkConvolutionProcs* procs); |
225 | 225 |
226 void platformConvolutionProcs_arm(SkConvolutionProcs* procs) { | 226 void platformConvolutionProcs_arm(SkConvolutionProcs* procs) { |
227 } | 227 } |
228 | 228 |
229 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs* procs) { | 229 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs* procs) { |
230 SK_ARM_NEON_WRAP(platformConvolutionProcs_arm)(procs); | 230 SK_ARM_NEON_WRAP(platformConvolutionProcs_arm)(procs); |
231 } | 231 } |
OLD | NEW |