| Index: third_party/libopenjpeg20/0000-use-colorspace.patch
|
| diff --git a/third_party/libopenjpeg20/0000-use-colorspace.patch b/third_party/libopenjpeg20/0000-use-colorspace.patch
|
| index 92f83a229172521a60fb4220980531fa65e98b4e..f6176c4665e4321286526130548146dde54d01e0 100644
|
| --- a/third_party/libopenjpeg20/0000-use-colorspace.patch
|
| +++ b/third_party/libopenjpeg20/0000-use-colorspace.patch
|
| @@ -1,25 +1,61 @@
|
| -diff -u a/jp2.c b/jp2.c
|
| ---- a/jp2.c
|
| -+++ b/jp2.c
|
| -@@ -1429,7 +1429,7 @@
|
| - /* Part 1, I.5.3.4: Either both or none : */
|
| - if( !jp2->color.jp2_pclr->cmap)
|
| - opj_jp2_free_pclr(&(jp2->color));
|
| -- else
|
| -+ else if (p_image->pdfium_use_colorspace)
|
| - opj_jp2_apply_pclr(p_image, &(jp2->color));
|
| - }
|
| +diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
|
| +index c6b15bd..c3029e0 100644
|
| +--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
|
| ++++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
|
| +@@ -690,7 +690,7 @@ void CPDF_DIBSource::LoadJpxBitmap() {
|
| + new JpxBitMapContext(pJpxModule));
|
| + context->set_decoder(pJpxModule->CreateDecoder(m_pStreamAcc->GetData(),
|
| + m_pStreamAcc->GetSize(),
|
| +- m_pColorSpace != nullptr));
|
| ++ m_pColorSpace == nullptr));
|
| + if (!context->decoder())
|
| + return;
|
|
|
| -diff -u a/openjpeg.h b/openjpeg.h
|
| ---- a/openjpeg.h
|
| -+++ b/openjpeg.h
|
| -@@ -677,6 +677,9 @@
|
| +diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
|
| +index 1b70a03..616af36 100644
|
| +--- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
|
| ++++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
|
| +@@ -670,7 +670,7 @@ class CJPX_Decoder {
|
| + opj_image_t* image;
|
| + opj_codec_t* l_codec;
|
| + opj_stream_t* l_stream;
|
| +- bool m_UseColorSpace;
|
| ++ const bool m_UseColorSpace;
|
| + };
|
| +
|
| + CJPX_Decoder::CJPX_Decoder(bool use_colorspace)
|
| +@@ -730,6 +730,7 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, FX_DWORD src_size) {
|
| + image = NULL;
|
| + return FALSE;
|
| + }
|
| ++ image->pdfium_use_colorspace = m_UseColorSpace;
|
| +
|
| + if (!parameters.nb_tile_to_decode) {
|
| + if (!opj_set_decode_area(l_codec, image, parameters.DA_x0, parameters.DA_y0,
|
| +diff --git a/third_party/libopenjpeg20/jp2.c b/third_party/libopenjpeg20/jp2.c
|
| +index 8bf60f6..47f83a1 100644
|
| +--- a/third_party/libopenjpeg20/jp2.c
|
| ++++ b/third_party/libopenjpeg20/jp2.c
|
| +@@ -1508,7 +1508,7 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2,
|
| + /* Part 1, I.5.3.4: Either both or none : */
|
| + if( !jp2->color.jp2_pclr->cmap)
|
| + opj_jp2_free_pclr(&(jp2->color));
|
| +- else
|
| ++ else if (p_image->pdfium_use_colorspace)
|
| + opj_jp2_apply_pclr(p_image, &(jp2->color));
|
| + }
|
| +
|
| +diff --git a/third_party/libopenjpeg20/openjpeg.h b/third_party/libopenjpeg20/openjpeg.h
|
| +index c07e9c8..e571672 100644
|
| +--- a/third_party/libopenjpeg20/openjpeg.h
|
| ++++ b/third_party/libopenjpeg20/openjpeg.h
|
| +@@ -677,6 +677,9 @@ typedef struct opj_image {
|
| OPJ_BYTE *icc_profile_buf;
|
| /** size of ICC profile */
|
| OPJ_UINT32 icc_profile_len;
|
| +
|
| -+ /** Whether to apply PCLR or not */
|
| -+ OPJ_BOOL pdfium_use_colorspace;
|
| ++ /** Whether to apply PCLR or not */
|
| ++ OPJ_BOOL pdfium_use_colorspace;
|
| } opj_image_t;
|
|
|
|
|
|
|