Index: src/codec/SkSwizzler.cpp |
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp |
index 65e521050e7795cfc4be18b55745822308f52afa..2955a7176ff2cfa7247ab1c23654227d092fc9e5 100644 |
--- a/src/codec/SkSwizzler.cpp |
+++ b/src/codec/SkSwizzler.cpp |
@@ -13,8 +13,7 @@ |
static void copy(void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset, |
const SkPMColor ctable[]) { |
- // This function must not be called if we are sampling. If we are not |
msarett
2016/01/21 22:09:07
I could be convinced to add these comments back in
scroggo
2016/01/21 23:19:39
I see no reason to take them out.
msarett
2016/01/21 23:29:47
Added back in.
|
- // sampling, deltaSrc should equal bpp. |
+ |
SkASSERT(deltaSrc == bpp); |
memcpy(dst, src + offset, width * bpp); |
@@ -327,11 +326,8 @@ static void fast_swizzle_bgra_to_n32_unpremul( |
void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset, |
const SkPMColor ctable[]) { |
- // This function must not be called if we are sampling. If we are not |
- // sampling, deltaSrc should equal bpp. |
SkASSERT(deltaSrc == bpp); |
- // These swizzles trust that the alpha value is already 0xFF. |
#ifdef SK_PMCOLOR_IS_RGBA |
SkOpts::swaprb_xxxa((uint32_t*) dst, (const uint32_t*) (src + offset), width); |
#else |
@@ -356,8 +352,6 @@ static void fast_swizzle_bgra_to_n32_premul( |
void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset, |
const SkPMColor ctable[]) { |
- // This function must not be called if we are sampling. If we are not |
- // sampling, deltaSrc should equal bpp. |
SkASSERT(deltaSrc == bpp); |
#ifdef SK_PMCOLOR_IS_RGBA |
@@ -376,12 +370,23 @@ static void swizzle_rgb_to_n32( |
src += offset; |
SkPMColor* SK_RESTRICT dst = (SkPMColor*)dstRow; |
for (int x = 0; x < dstWidth; x++) { |
- dst[x] = SkPackARGB32(0xFF, src[0], src[1], src[2]); |
+ dst[x] = SkPackARGB32NoCheck(0xFF, src[0], src[1], src[2]); |
src += deltaSrc; |
} |
} |
+static void fast_swizzle_rgb_to_n32( |
+ void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, |
+ int offset, const SkPMColor ctable[]) { |
+ |
+ SkASSERT(deltaSrc == bpp); |
+#ifdef SK_PMCOLOR_IS_RGBA |
+ SkOpts::xxx_xxxa((uint32_t*) dst, (const uint32_t*) (src + offset), width); |
+#else |
+ SkOpts::xxx_swaprb_xxxa((uint32_t*) dst, (const uint32_t*) (src + offset), width); |
+#endif |
+} |
static void swizzle_rgb_to_565( |
void* SK_RESTRICT dstRow, const uint8_t* SK_RESTRICT src, int dstWidth, |
@@ -414,8 +419,6 @@ static void fast_swizzle_rgba_to_n32_premul( |
void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, |
int offset, const SkPMColor ctable[]) { |
- // This function must not be called if we are sampling. If we are not |
- // sampling, deltaSrc should equal bpp. |
SkASSERT(deltaSrc == bpp); |
#ifdef SK_PMCOLOR_IS_RGBA |
@@ -442,11 +445,8 @@ static void fast_swizzle_rgba_to_n32_unpremul( |
void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset, |
const SkPMColor ctable[]) { |
- // This function must not be called if we are sampling. If we are not |
- // sampling, deltaSrc should equal bpp. |
SkASSERT(deltaSrc == bpp); |
- // These swizzles trust that the alpha value is already 0xFF. |
#ifdef SK_PMCOLOR_IS_RGBA |
memcpy(dst, src + offset, width * bpp); |
#else |
@@ -682,6 +682,7 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, |
switch (dstInfo.colorType()) { |
case kN32_SkColorType: |
proc = &swizzle_rgb_to_n32; |
+ fastProc = &fast_swizzle_rgb_to_n32; |
break; |
case kRGB_565_SkColorType: |
proc = &swizzle_rgb_to_565; |