OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 The Android Open Source Project | 2 * Copyright 2014 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 "SkBitmapProcState.h" | 9 #include "SkBitmapProcState.h" |
10 #include "SkBitmapScaler.h" | 10 #include "SkBitmapScaler.h" |
11 #include "SkColorPriv.h" | 11 #include "SkColorPriv.h" |
12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
13 #include "SkUtils.h" | 13 #include "SkUtils.h" |
14 | 14 |
15 static void SI8_D16_nofilter_DX_mips_dsp(const SkBitmapProcState& s, | 15 static void SI8_D16_nofilter_DX_mips_dsp(const SkBitmapProcState& s, |
16 const uint32_t* SK_RESTRICT xy, | 16 const uint32_t* SK_RESTRICT xy, |
17 int count, uint16_t* SK_RESTRICT colors
) { | 17 int count, uint16_t* SK_RESTRICT colors
) { |
18 SkASSERT(count > 0 && colors != NULL); | 18 SkASSERT(count > 0 && colors != nullptr); |
19 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); | 19 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); |
20 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); | 20 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); |
21 const uint16_t* SK_RESTRICT table = s.fPixmap.ctable()->read16BitCache(); | 21 const uint16_t* SK_RESTRICT table = s.fPixmap.ctable()->read16BitCache(); |
22 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fPixmap.addr(); | 22 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fPixmap.addr(); |
23 SkASSERT((unsigned)xy[0] < (unsigned)s.fPixmap.height()); | 23 SkASSERT((unsigned)xy[0] < (unsigned)s.fPixmap.height()); |
24 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fPixmap.rowBytes
()); | 24 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fPixmap.rowBytes
()); |
25 uint8_t src; | 25 uint8_t src; |
26 | 26 |
27 if (1 == s.fPixmap.width()) { | 27 if (1 == s.fPixmap.width()) { |
28 src = srcAddr[0]; | 28 src = srcAddr[0]; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 140 |
141 for (int i = (count & 7); i > 0; --i) { | 141 for (int i = (count & 7); i > 0; --i) { |
142 src = srcAddr[*xx++]; *colors++ = table[src]; | 142 src = srcAddr[*xx++]; *colors++ = table[src]; |
143 } | 143 } |
144 } | 144 } |
145 } | 145 } |
146 | 146 |
147 static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s, | 147 static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s, |
148 const uint32_t* SK_RESTRICT xy, | 148 const uint32_t* SK_RESTRICT xy, |
149 int count, SkPMColor* SK_RESTRIC
T colors) { | 149 int count, SkPMColor* SK_RESTRIC
T colors) { |
150 SkASSERT(count > 0 && colors != NULL); | 150 SkASSERT(count > 0 && colors != nullptr); |
151 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); | 151 SkASSERT(s.fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)); |
152 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); | 152 SkASSERT(kNone_SkFilterQuality == s.fFilterLevel); |
153 const SkPMColor* SK_RESTRICT table = s.fPixmap.ctable()->readColors(); | 153 const SkPMColor* SK_RESTRICT table = s.fPixmap.ctable()->readColors(); |
154 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fPixmap.addr(); | 154 const uint8_t* SK_RESTRICT srcAddr = (const uint8_t*)s.fPixmap.addr(); |
155 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fPixmap.rowBytes
()); | 155 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fPixmap.rowBytes
()); |
156 | 156 |
157 if (1 == s.fPixmap.width()) { | 157 if (1 == s.fPixmap.width()) { |
158 uint8_t src = srcAddr[0]; | 158 uint8_t src = srcAddr[0]; |
159 SkPMColor dstValue = table[src]; | 159 SkPMColor dstValue = table[src]; |
160 sk_memset32(colors, dstValue, count); | 160 sk_memset32(colors, dstValue, count); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 bool justDx = false; | 373 bool justDx = false; |
374 | 374 |
375 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { | 375 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { |
376 justDx = true; | 376 justDx = true; |
377 } | 377 } |
378 | 378 |
379 switch (fPixmap.colorType()) { | 379 switch (fPixmap.colorType()) { |
380 case kIndex_8_SkColorType: | 380 case kIndex_8_SkColorType: |
381 if (justDx && kNone_SkFilterQuality == fFilterLevel) { | 381 if (justDx && kNone_SkFilterQuality == fFilterLevel) { |
382 fSampleProc16 = SI8_D16_nofilter_DX_mips_dsp; | 382 fSampleProc16 = SI8_D16_nofilter_DX_mips_dsp; |
383 fShaderProc16 = NULL; | 383 fShaderProc16 = nullptr; |
384 if (isOpaque) { | 384 if (isOpaque) { |
385 fSampleProc32 = SI8_opaque_D32_nofilter_DX_mips_dsp; | 385 fSampleProc32 = SI8_opaque_D32_nofilter_DX_mips_dsp; |
386 fShaderProc32 = NULL; | 386 fShaderProc32 = nullptr; |
387 } | 387 } |
388 } | 388 } |
389 break; | 389 break; |
390 default: | 390 default: |
391 break; | 391 break; |
392 } | 392 } |
393 } | 393 } |
394 | 394 |
395 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs*) {} | 395 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs*) {} |
OLD | NEW |