Index: core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp |
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp |
index 977abe1b7bb2de1b29def8e8fb488ca70c879629..f4a5912f4dc1940234e59a418bec3e229062d2ca 100644 |
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp |
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp |
@@ -706,49 +706,36 @@ void CPDF_DIBSource::LoadJpxBitmap() { |
FX_DWORD width = 0; |
FX_DWORD height = 0; |
- FX_DWORD codestream_nComps = 0; |
- FX_DWORD image_nComps = 0; |
- pJpxModule->GetImageInfo(context->context(), width, height, codestream_nComps, |
- image_nComps); |
+ FX_DWORD components = 0; |
+ pJpxModule->GetImageInfo(context->context(), &width, &height, &components); |
if ((int)width < m_Width || (int)height < m_Height) |
return; |
- int output_nComps; |
- FX_BOOL bTranslateColor; |
FX_BOOL bSwapRGB = FALSE; |
if (m_pColorSpace) { |
- if (codestream_nComps != (FX_DWORD)m_pColorSpace->CountComponents()) |
+ if (components != (FX_DWORD)m_pColorSpace->CountComponents()) |
return; |
- output_nComps = codestream_nComps; |
- bTranslateColor = FALSE; |
if (m_pColorSpace == CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB)) { |
bSwapRGB = TRUE; |
m_pColorSpace = nullptr; |
} |
} else { |
- bTranslateColor = TRUE; |
- if (image_nComps) { |
- output_nComps = image_nComps; |
- } else { |
- output_nComps = codestream_nComps; |
- } |
- if (output_nComps == 3) { |
+ if (components == 3) { |
bSwapRGB = TRUE; |
- } else if (output_nComps == 4) { |
+ } else if (components == 4) { |
m_pColorSpace = CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK); |
- bTranslateColor = FALSE; |
} |
- m_nComponents = output_nComps; |
+ m_nComponents = components; |
} |
FXDIB_Format format; |
- if (output_nComps == 1) { |
+ if (components == 1) { |
format = FXDIB_8bppRgb; |
- } else if (output_nComps <= 3) { |
+ } else if (components <= 3) { |
format = FXDIB_Rgb; |
- } else if (output_nComps == 4) { |
+ } else if (components == 4) { |
format = FXDIB_Rgb32; |
} else { |
- width = (width * output_nComps + 2) / 3; |
+ width = (width * components + 2) / 3; |
format = FXDIB_Rgb; |
} |
m_pCachedBitmap.reset(new CFX_DIBitmap); |
@@ -757,15 +744,15 @@ void CPDF_DIBSource::LoadJpxBitmap() { |
return; |
} |
m_pCachedBitmap->Clear(0xFFFFFFFF); |
- context->set_output_offsets(FX_Alloc(uint8_t, output_nComps)); |
- for (int i = 0; i < output_nComps; ++i) |
+ context->set_output_offsets(FX_Alloc(uint8_t, components)); |
+ for (int i = 0; i < components; ++i) |
context->output_offsets()[i] = i; |
if (bSwapRGB) { |
context->output_offsets()[0] = 2; |
context->output_offsets()[2] = 0; |
} |
if (!pJpxModule->Decode(context->context(), m_pCachedBitmap->GetBuffer(), |
- m_pCachedBitmap->GetPitch(), bTranslateColor, |
+ m_pCachedBitmap->GetPitch(), |
context->output_offsets())) { |
m_pCachedBitmap.reset(); |
return; |