Index: src/codec/SkSwizzler.cpp |
diff --git a/src/codec/SkSwizzler.cpp b/src/codec/SkSwizzler.cpp |
index ce6dd26093b0600deba24f1fd0c42e1b481a639e..debcd45c207048b5e96279a7ed5001e0695628cb 100644 |
--- a/src/codec/SkSwizzler.cpp |
+++ b/src/codec/SkSwizzler.cpp |
@@ -309,6 +309,19 @@ static void swizzle_grayalpha_to_n32_unpremul( |
} |
} |
+static void fast_swizzle_grayalpha_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); |
+ |
+ // Note that there is no need to distinguish between RGB and BGR. |
+ // Each color channel will get the same value. |
+ SkOpts::grayA_to_RGBA((uint32_t*) dst, src + offset, width); |
+} |
+ |
static void swizzle_grayalpha_to_n32_premul( |
void* dst, const uint8_t* src, int width, int bpp, int deltaSrc, int offset, |
const SkPMColor ctable[]) { |
@@ -322,6 +335,19 @@ static void swizzle_grayalpha_to_n32_premul( |
} |
} |
+static void fast_swizzle_grayalpha_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); |
+ |
+ // Note that there is no need to distinguish between rgb and bgr. |
+ // Each color channel will get the same value. |
+ SkOpts::grayA_to_rgbA((uint32_t*) dst, src + offset, width); |
+} |
+ |
// kBGRX |
static void swizzle_bgrx_to_n32( |
@@ -718,14 +744,20 @@ SkSwizzler* SkSwizzler::CreateSwizzler(SkSwizzler::SrcConfig sc, |
if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
proc = &SkipLeadingGrayAlphaZerosThen |
<swizzle_grayalpha_to_n32_unpremul>; |
+ fastProc = &SkipLeadingGrayAlphaZerosThen |
+ <fast_swizzle_grayalpha_to_n32_unpremul>; |
} else { |
proc = &swizzle_grayalpha_to_n32_unpremul; |
+ fastProc = &fast_swizzle_grayalpha_to_n32_unpremul; |
} |
} else { |
if (SkCodec::kYes_ZeroInitialized == zeroInit) { |
proc = &SkipLeadingGrayAlphaZerosThen<swizzle_grayalpha_to_n32_premul>; |
+ fastProc = &SkipLeadingGrayAlphaZerosThen |
+ <fast_swizzle_grayalpha_to_n32_premul>; |
} else { |
proc = &swizzle_grayalpha_to_n32_premul; |
+ fastProc = &fast_swizzle_grayalpha_to_n32_premul; |
} |
} |
break; |