| OLD | NEW |
| 1 diff -u a/jp2.c b/jp2.c | 1 diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/f
pdfapi/fpdf_render/fpdf_render_loadimage.cpp |
| 2 --- a/jp2.c | 2 index c6b15bd..c3029e0 100644 |
| 3 +++ b/jp2.c | 3 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp |
| 4 @@ -1429,7 +1429,7 @@ | 4 +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp |
| 5 » » /* Part 1, I.5.3.4: Either both or none : */ | 5 @@ -690,7 +690,7 @@ void CPDF_DIBSource::LoadJpxBitmap() { |
| 6 » » if( !jp2->color.jp2_pclr->cmap) | 6 new JpxBitMapContext(pJpxModule)); |
| 7 » » » opj_jp2_free_pclr(&(jp2->color)); | 7 context->set_decoder(pJpxModule->CreateDecoder(m_pStreamAcc->GetData(), |
| 8 -» » else | 8 m_pStreamAcc->GetSize(), |
| 9 +» » else if (p_image->pdfium_use_colorspace) | 9 - m_pColorSpace != nullptr)); |
| 10 » » » opj_jp2_apply_pclr(p_image, &(jp2->color)); | 10 + m_pColorSpace == nullptr)); |
| 11 » } | 11 if (!context->decoder()) |
| 12 return; |
| 12 | 13 |
| 13 diff -u a/openjpeg.h b/openjpeg.h | 14 diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/code
c/fx_codec_jpx_opj.cpp |
| 14 --- a/openjpeg.h | 15 index 1b70a03..616af36 100644 |
| 15 +++ b/openjpeg.h | 16 --- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp |
| 16 @@ -677,6 +677,9 @@ | 17 +++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp |
| 18 @@ -670,7 +670,7 @@ class CJPX_Decoder { |
| 19 opj_image_t* image; |
| 20 opj_codec_t* l_codec; |
| 21 opj_stream_t* l_stream; |
| 22 - bool m_UseColorSpace; |
| 23 + const bool m_UseColorSpace; |
| 24 }; |
| 25 |
| 26 CJPX_Decoder::CJPX_Decoder(bool use_colorspace) |
| 27 @@ -730,6 +730,7 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, FX
_DWORD src_size) { |
| 28 image = NULL; |
| 29 return FALSE; |
| 30 } |
| 31 + image->pdfium_use_colorspace = m_UseColorSpace; |
| 32 |
| 33 if (!parameters.nb_tile_to_decode) { |
| 34 if (!opj_set_decode_area(l_codec, image, parameters.DA_x0, parameters.DA_y0
, |
| 35 diff --git a/third_party/libopenjpeg20/jp2.c b/third_party/libopenjpeg20/jp2.c |
| 36 index 8bf60f6..47f83a1 100644 |
| 37 --- a/third_party/libopenjpeg20/jp2.c |
| 38 +++ b/third_party/libopenjpeg20/jp2.c |
| 39 @@ -1508,7 +1508,7 @@ OPJ_BOOL opj_jp2_decode(opj_jp2_t *jp2, |
| 40 » » » /* Part 1, I.5.3.4: Either both or none : */ |
| 41 » » » if( !jp2->color.jp2_pclr->cmap) |
| 42 » » » » opj_jp2_free_pclr(&(jp2->color)); |
| 43 -» » » else |
| 44 +» » » else if (p_image->pdfium_use_colorspace) |
| 45 » » » » opj_jp2_apply_pclr(p_image, &(jp2->color)); |
| 46 » » } |
| 47 |
| 48 diff --git a/third_party/libopenjpeg20/openjpeg.h b/third_party/libopenjpeg20/op
enjpeg.h |
| 49 index c07e9c8..e571672 100644 |
| 50 --- a/third_party/libopenjpeg20/openjpeg.h |
| 51 +++ b/third_party/libopenjpeg20/openjpeg.h |
| 52 @@ -677,6 +677,9 @@ typedef struct opj_image { |
| 17 OPJ_BYTE *icc_profile_buf; | 53 OPJ_BYTE *icc_profile_buf; |
| 18 /** size of ICC profile */ | 54 /** size of ICC profile */ |
| 19 OPJ_UINT32 icc_profile_len; | 55 OPJ_UINT32 icc_profile_len; |
| 20 + | 56 + |
| 21 + /** Whether to apply PCLR or not */ | 57 +» /** Whether to apply PCLR or not */ |
| 22 + OPJ_BOOL pdfium_use_colorspace; | 58 +» OPJ_BOOL pdfium_use_colorspace; |
| 23 } opj_image_t; | 59 } opj_image_t; |
| 24 | 60 |
| 25 | 61 |
| OLD | NEW |