| 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_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s, | 15 static void SI8_opaque_D32_nofilter_DX_mips_dsp(const SkBitmapProcState& s, |
| 16 const uint32_t* SK_RESTRICT xy, | 16 const uint32_t* SK_RESTRICT xy, |
| 17 int count, SkPMColor* SK_RESTRIC
T colors) { | 17 int count, SkPMColor* SK_RESTRIC
T colors) { |
| 18 SkASSERT(count > 0 && colors != nullptr); | 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.fFilterQuality); |
| 21 const SkPMColor* SK_RESTRICT table = s.fPixmap.ctable()->readColors(); | 21 const SkPMColor* SK_RESTRICT table = s.fPixmap.ctable()->readColors(); |
| 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 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fPixmap.rowBytes
()); | 23 srcAddr = (const uint8_t*)((const char*)srcAddr + xy[0] * s.fPixmap.rowBytes
()); |
| 24 | 24 |
| 25 if (1 == s.fPixmap.width()) { | 25 if (1 == s.fPixmap.width()) { |
| 26 uint8_t src = srcAddr[0]; | 26 uint8_t src = srcAddr[0]; |
| 27 SkPMColor dstValue = table[src]; | 27 SkPMColor dstValue = table[src]; |
| 28 sk_memset32(colors, dstValue, count); | 28 sk_memset32(colors, dstValue, count); |
| 29 } else { | 29 } else { |
| 30 const uint16_t* xx = (const uint16_t*)(xy + 1); | 30 const uint16_t* xx = (const uint16_t*)(xy + 1); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 void SkBitmapProcState::platformProcs() { | 239 void SkBitmapProcState::platformProcs() { |
| 240 bool isOpaque = 256 == fAlphaScale; | 240 bool isOpaque = 256 == fAlphaScale; |
| 241 bool justDx = false; | 241 bool justDx = false; |
| 242 | 242 |
| 243 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { | 243 if (fInvType <= (SkMatrix::kTranslate_Mask | SkMatrix::kScale_Mask)) { |
| 244 justDx = true; | 244 justDx = true; |
| 245 } | 245 } |
| 246 | 246 |
| 247 switch (fPixmap.colorType()) { | 247 switch (fPixmap.colorType()) { |
| 248 case kIndex_8_SkColorType: | 248 case kIndex_8_SkColorType: |
| 249 if (justDx && kNone_SkFilterQuality == fFilterLevel) { | 249 if (justDx && kNone_SkFilterQuality == fFilterQuality) { |
| 250 if (isOpaque) { | 250 if (isOpaque) { |
| 251 fSampleProc32 = SI8_opaque_D32_nofilter_DX_mips_dsp; | 251 fSampleProc32 = SI8_opaque_D32_nofilter_DX_mips_dsp; |
| 252 fShaderProc32 = nullptr; | 252 fShaderProc32 = nullptr; |
| 253 } | 253 } |
| 254 } | 254 } |
| 255 break; | 255 break; |
| 256 default: | 256 default: |
| 257 break; | 257 break; |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 | 260 |
| 261 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs*) {} | 261 void SkBitmapScaler::PlatformConvolutionProcs(SkConvolutionProcs*) {} |
| OLD | NEW |