Index: src/codec/SkJpegCodec.cpp |
diff --git a/src/codec/SkJpegCodec.cpp b/src/codec/SkJpegCodec.cpp |
index 36a723f2d642cc9113abea2e39a71b2152488878..cca71c1cadec45665bdc96d8af38cc71d57aee67 100644 |
--- a/src/codec/SkJpegCodec.cpp |
+++ b/src/codec/SkJpegCodec.cpp |
@@ -151,7 +151,11 @@ SkJpegCodec::SkJpegCodec(const SkImageInfo& srcInfo, SkStream* stream, |
* Return the row bytes of a particular image type and width |
*/ |
static int get_row_bytes(const j_decompress_ptr dinfo) { |
+#if defined (GOOGLE3) |
scroggo
2015/10/27 13:51:23
Is this because GOOGLE3 is expected to build again
mtklein
2015/10/27 14:27:59
Why don't we just use libjpeg's own defines as the
msarett
2015/10/27 14:31:36
sgtm
They are actually enums. Will that still wo
dogben
2015/10/27 15:07:22
Sorry, I should have left a comment or TODO. I for
|
+ int colorBytes = dinfo->out_color_components; |
+#else |
int colorBytes = (dinfo->out_color_space == JCS_RGB565) ? 2 : dinfo->out_color_components; |
+#endif |
return dinfo->output_width * colorBytes; |
} |
@@ -247,10 +251,14 @@ bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dst) { |
} else { |
// Check the byte ordering of the RGBA color space for the |
// current platform |
-#if defined(SK_PMCOLOR_IS_RGBA) |
- fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA; |
+#if defined(GOOGLE3) |
+ return false; |
scroggo
2015/10/27 13:51:23
It appears that in GOOGLE3, SkJpegCodec will not w
dogben
2015/10/27 15:07:22
I didn't realize that not supporting JCS_EXT_* wou
|
#else |
+ #if defined(SK_PMCOLOR_IS_RGBA) |
+ fDecoderMgr->dinfo()->out_color_space = JCS_EXT_RGBA; |
+ #else |
fDecoderMgr->dinfo()->out_color_space = JCS_EXT_BGRA; |
+ #endif |
#endif |
} |
return true; |
@@ -261,8 +269,12 @@ bool SkJpegCodec::setOutputColorSpace(const SkImageInfo& dst) { |
// best to do this in SkSwizzler and also move convert_CMYK_to_RGBA into SkSwizzler. |
return false; |
} else { |
+#if defined(GOOGLE3) |
+ return false; |
+#else |
fDecoderMgr->dinfo()->dither_mode = JDITHER_NONE; |
fDecoderMgr->dinfo()->out_color_space = JCS_RGB565; |
+#endif |
} |
return true; |
case kGray_8_SkColorType: |
@@ -397,7 +409,11 @@ void SkJpegCodec::initializeSwizzler(const SkImageInfo& dstInfo, const Options& |
break; |
default: |
// This function should only be called if the colorType is supported by jpeg |
+#if defined(GOOGLE3) |
+ SK_CRASH(); |
scroggo
2015/10/27 13:51:23
Why this difference? I assume that SkASSERT works
dogben
2015/10/27 15:07:22
Sorry, I added this before https://codereview.chro
|
+#else |
SkASSERT(false); |
+#endif |
} |
fSwizzler.reset(SkSwizzler::CreateSwizzler(srcConfig, nullptr, dstInfo, options)); |
@@ -488,7 +504,7 @@ int SkJpegCodec::onGetScanlines(void* dst, int count, size_t rowBytes) { |
#ifndef TURBO_HAS_SKIP |
// TODO (msarett): Avoid reallocating the memory buffer on each call to skip. |
-static uint32_t jpeg_skip_scanlines(dinfo, count) { |
+static uint32_t jpeg_skip_scanlines(jpeg_decompress_struct* dinfo, int count) { |
msarett
2015/10/15 15:02:33
+1
|
SkAutoMalloc storage(get_row_bytes(dinfo)); |
uint8_t* storagePtr = static_cast<uint8_t*>(storage.get()); |
for (int y = 0; y < count; y++) { |