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

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

Issue 1398383002: core/ difference with XFA (for information only). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: After bidi 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_jpeg.cpp
diff --git a/core/src/fxcodec/codec/fx_codec_jpeg.cpp b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
index 4fdbb8ed293b8f29d10db1035d98ee42b651e01a..66e762eaa1c152b650593d315cc977a5d591aef5 100644
--- a/core/src/fxcodec/codec/fx_codec_jpeg.cpp
+++ b/core/src/fxcodec/codec/fx_codec_jpeg.cpp
@@ -224,6 +224,19 @@ static void _JpegEncode(const CFX_DIBSource* pSource,
FX_Free(line_buf);
dest_size = dest_buf_length - (FX_STRSIZE)dest.free_in_buffer;
}
+#ifdef PDF_ENABLE_XFA
+static void _JpegLoadAttribute(struct jpeg_decompress_struct* pInfo,
+ CFX_DIBAttribute* pAttribute) {
+ if (pInfo == NULL || pAttribute == NULL) {
+ return;
+ }
+ if (pAttribute) {
+ pAttribute->m_nXDPI = pInfo->X_density;
+ pAttribute->m_nYDPI = pInfo->Y_density;
+ pAttribute->m_wDPIUnit = pInfo->density_unit;
+ }
+}
+#endif
static FX_BOOL _JpegLoadInfo(const uint8_t* src_buf,
FX_DWORD src_size,
int& width,
@@ -657,9 +670,19 @@ void CCodec_JpegModule::Input(void* pContext,
int CCodec_JpegModule::ReadHeader(void* pContext,
int* width,
int* height,
+#ifndef PDF_ENABLE_XFA
int* nComps) {
+#else
+ int* nComps,
+ CFX_DIBAttribute* pAttribute) {
+#endif
if (m_pExtProvider) {
+#ifndef PDF_ENABLE_XFA
return m_pExtProvider->ReadHeader(pContext, width, height, nComps);
+#else
+ return m_pExtProvider->ReadHeader(pContext, width, height, nComps,
+ pAttribute);
+#endif
}
FXJPEG_Context* p = (FXJPEG_Context*)pContext;
if (setjmp(p->m_JumpMark) == -1) {
@@ -675,6 +698,9 @@ int CCodec_JpegModule::ReadHeader(void* pContext,
*width = p->m_Info.image_width;
*height = p->m_Info.image_height;
*nComps = p->m_Info.num_components;
+#ifdef PDF_ENABLE_XFA
+ _JpegLoadAttribute(&p->m_Info, pAttribute);
+#endif
return 0;
}
int CCodec_JpegModule::StartScanline(void* pContext, int down_scale) {

Powered by Google App Engine
This is Rietveld 408576698