Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2590)

Unified Diff: core/src/fxcodec/codec/fx_codec_jpx_opj.cpp

Issue 1416783002: Merge to M46: upgrade openjpeg to commit# cf352af (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@2490
Patch Set: Fix pdfium:168 since we are already half way there Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
diff --git a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
index 0a5d6ab24efec8db8931dc2557b16d68f8757787..6df408d123ea90c73d2b0ce72a7ce7207f3b7078 100644
--- a/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpx_opj.cpp
@@ -655,7 +655,7 @@ void color_apply_conversion(opj_image_t* image) {
}
class CJPX_Decoder {
public:
- CJPX_Decoder();
+ explicit CJPX_Decoder(bool use_colorspace);
~CJPX_Decoder();
FX_BOOL Init(const unsigned char* src_data, int src_size);
void GetInfo(FX_DWORD& width,
@@ -671,10 +671,10 @@ class CJPX_Decoder {
opj_image_t* image;
opj_codec_t* l_codec;
opj_stream_t* l_stream;
- FX_BOOL m_useColorSpace;
+ const bool m_UseColorSpace;
};
-CJPX_Decoder::CJPX_Decoder()
- : image(NULL), l_codec(NULL), l_stream(NULL), m_useColorSpace(FALSE) {}
+CJPX_Decoder::CJPX_Decoder(bool use_colorspace)
+ : image(NULL), l_codec(NULL), l_stream(NULL), m_UseColorSpace(use_colorspace) {}
CJPX_Decoder::~CJPX_Decoder() {
if (l_codec) {
opj_destroy_codec(l_codec);
@@ -724,6 +724,8 @@ FX_BOOL CJPX_Decoder::Init(const unsigned char* src_data, int 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,
parameters.DA_x1, parameters.DA_y1)) {
@@ -864,8 +866,7 @@ CCodec_JpxModule::CCodec_JpxModule() {}
void* CCodec_JpxModule::CreateDecoder(const uint8_t* src_buf,
FX_DWORD src_size,
FX_BOOL useColorSpace) {
- CJPX_Decoder* pDecoder = new CJPX_Decoder;
- pDecoder->m_useColorSpace = useColorSpace;
+ CJPX_Decoder* pDecoder = new CJPX_Decoder(useColorSpace);
if (!pDecoder->Init(src_buf, src_size)) {
delete pDecoder;
return NULL;
« no previous file with comments | « core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp ('k') | third_party/libopenjpeg20/0000-use-colorspace.patch » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698