From 55512706477c035ee27413a7a2c9a75f31ceae34 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 3 Sep 2015 14:44:16 -0700 Subject: Merge to XFA: Reapply Foxit's libopenjpeg modifications. They were lost in commit d53e6fd. BUG=pdfium:168 TBR=tsepez@chromium.org Review URL: https://codereview.chromium.org/1196523002 . (cherry picked from commit 870b5b6793fa261f0c6f31f026010d2d715968bf) Review URL: https://codereview.chromium.org/1301323007 . --- .../libopenjpeg20/0000-use-colorspace.patch | 25 ++++++++++++++++++++++ third_party/libopenjpeg20/README.pdfium | 13 +++++++++++ third_party/libopenjpeg20/jp2.c | 2 +- third_party/libopenjpeg20/openjpeg.h | 3 +++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 third_party/libopenjpeg20/0000-use-colorspace.patch create mode 100644 third_party/libopenjpeg20/README.pdfium (limited to 'third_party/libopenjpeg20') diff --git a/third_party/libopenjpeg20/0000-use-colorspace.patch b/third_party/libopenjpeg20/0000-use-colorspace.patch new file mode 100644 index 0000000000..92f83a2291 --- /dev/null +++ b/third_party/libopenjpeg20/0000-use-colorspace.patch @@ -0,0 +1,25 @@ +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 -u a/openjpeg.h b/openjpeg.h +--- a/openjpeg.h ++++ b/openjpeg.h +@@ -677,6 +677,9 @@ + 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; + } opj_image_t; + + diff --git a/third_party/libopenjpeg20/README.pdfium b/third_party/libopenjpeg20/README.pdfium new file mode 100644 index 0000000000..e1fad70151 --- /dev/null +++ b/third_party/libopenjpeg20/README.pdfium @@ -0,0 +1,13 @@ +Name: OpenJPEG +URL: http://www.openjpeg.org/ +Version: 0fa5a17c98c4b8f9ee2286f4f0a50cf52a5fccb0 +Security Critical: yes +License: 2-clause BSD + +Description: +JPEG 2000 library. + +Local Modifications: + +0000-use-colorspace.patch: Makes it possible to not call opj_jp2_apply_pclr(). +TODO(thestig): List all the other patches. diff --git a/third_party/libopenjpeg20/jp2.c b/third_party/libopenjpeg20/jp2.c index aafbe199d6..08b195304d 100644 --- a/third_party/libopenjpeg20/jp2.c +++ b/third_party/libopenjpeg20/jp2.c @@ -1429,7 +1429,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 4a8e75ce5a..e988de4785 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; } opj_image_t; -- cgit v1.2.3