rpms/openoffice.org/F-12 openoffice.org-3.3.0.ooo80674.cmyk-for-jpeg-images.patch, NONE, 1.1 openoffice.org.spec, 1.2053, 1.2054
David Tardon
dtardon at fedoraproject.org
Thu Jan 14 15:53:53 UTC 2010
Author: dtardon
Update of /cvs/pkgs/rpms/openoffice.org/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21672
Modified Files:
openoffice.org.spec
Added Files:
openoffice.org-3.3.0.ooo80674.cmyk-for-jpeg-images.patch
Log Message:
Resolves: rbhz#555257 openoffice cannot use JPEG images using CMYK colorspace
openoffice.org-3.3.0.ooo80674.cmyk-for-jpeg-images.patch:
jpegc.c | 54 +++++++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 45 insertions(+), 9 deletions(-)
--- NEW FILE openoffice.org-3.3.0.ooo80674.cmyk-for-jpeg-images.patch ---
--- ooo/svtools/source/filter.vcl/jpeg/jpegc.c.orig 2006-09-08 10:25:21.000000000 +0200
+++ ooo/svtools/source/filter.vcl/jpeg/jpegc.c 2007-11-02 17:40:10.000000000 +0100
@@ -39,7 +39,8 @@
#include "jpeglib.h"
#include "jerror.h"
#include "jpeg.h"
-
+#include "rtl/alloc.h"
+#include "osl/diagnose.h"
struct my_error_mgr
{
@@ -86,6 +87,9 @@ void ReadJPEG( void* pJPEGReader, void*
long nWidth;
long nHeight;
long nAlignedWidth;
+ JSAMPLE * range_limit;
+ HPBYTE pScanLineBuffer = NULL;
+ long nScanLineBufferComponents = 0;
// declare bDecompCreated volatile because of gcc
// warning: variable 'bDecompCreated' might be clobbered by `longjmp' or `vfork'
volatile long bDecompCreated = 0;
@@ -111,8 +115,12 @@ void ReadJPEG( void* pJPEGReader, void*
cinfo.output_gamma = 1.0;
cinfo.raw_data_out = FALSE;
cinfo.quantize_colors = FALSE;
- if ( cinfo.jpeg_color_space != JCS_GRAYSCALE )
- cinfo.out_color_space = JCS_RGB;
+ if ( cinfo.jpeg_color_space == JCS_YCbCr )
+ cinfo.out_color_space = JCS_RGB;
+ else if ( cinfo.jpeg_color_space == JCS_YCCK )
+ cinfo.out_color_space = JCS_CMYK;
+
+ OSL_ASSERT(cinfo.out_color_space == JCS_CMYK || cinfo.out_color_space == JCS_GRAYSCALE || cinfo.out_color_space == JCS_RGB);
/* change scale for preview import */
if( nPreviewWidth || nPreviewHeight )
@@ -156,6 +164,14 @@ void ReadJPEG( void* pJPEGReader, void*
aCreateBitmapParam.bGray = cinfo.output_components == 1;
pDIB = CreateBitmap( pJPEGReader, &aCreateBitmapParam );
nAlignedWidth = aCreateBitmapParam.nAlignedWidth;
+ range_limit=cinfo.sample_range_limit;
+
+ if ( cinfo.out_color_space == JCS_CMYK )
+ {
+ nScanLineBufferComponents = cinfo.output_width * 4;
+ pScanLineBuffer = rtl_allocateMemory( nScanLineBufferComponents );
+ }
+
if( pDIB )
{
if( aCreateBitmapParam.bTopDown )
@@ -168,17 +184,37 @@ void ReadJPEG( void* pJPEGReader, void*
for ( *pLines = 0; *pLines < nHeight; (*pLines)++ )
{
+ if (pScanLineBuffer!=NULL) { // in other words cinfo.out_color_space == JCS_CMYK
+ int i;
+ int j;
+ jpeg_read_scanlines( &cinfo, (JSAMPARRAY) &pScanLineBuffer, 1 );
+ // convert CMYK to RGB
+ for( i=0, j=0; i < nScanLineBufferComponents; i+=4, j+=3 )
+ {
+ int c_=255-pScanLineBuffer[i+0];
+ int m_=255-pScanLineBuffer[i+1];
+ int y_=255-pScanLineBuffer[i+2];
+ int k_=255-pScanLineBuffer[i+3];
+ pTmp[j+0]=range_limit[ 255L - ( c_ + k_ ) ];
+ pTmp[j+1]=range_limit[ 255L - ( m_ + k_ ) ];
+ pTmp[j+2]=range_limit[ 255L - ( y_ + k_ ) ];
+ }
+ } else {
jpeg_read_scanlines( &cinfo, (JSAMPARRAY) &pTmp, 1 );
-
- /* PENDING ??? */
- if ( cinfo.err->msg_code == 113 )
- break;
-
- pTmp += nAlignedWidth;
+ }
+ /* PENDING ??? */
+ if ( cinfo.err->msg_code == 113 )
+ break;
+
+ pTmp += nAlignedWidth;
}
}
jpeg_finish_decompress( &cinfo );
+ if (pScanLineBuffer!=NULL) {
+ rtl_freeMemory( pScanLineBuffer );
+ pScanLineBuffer=NULL;
+ }
Exit:
Index: openoffice.org.spec
===================================================================
RCS file: /cvs/pkgs/rpms/openoffice.org/F-12/openoffice.org.spec,v
retrieving revision 1.2053
retrieving revision 1.2054
diff -u -p -r1.2053 -r1.2054
--- openoffice.org.spec 13 Jan 2010 15:05:02 -0000 1.2053
+++ openoffice.org.spec 14 Jan 2010 15:53:53 -0000 1.2054
@@ -189,6 +189,7 @@ Patch111: openoffice.org-3.3.0.ooo108047
Patch112: workspace.impress182.patch
Patch113: openoffice.org-3.3.0.ooo108246.svx.check-for-possible-out-of-bounds-index.patch
Patch114: workspace.sw33bf02.patch
+Patch115: openoffice.org-3.3.0.ooo80674.cmyk-for-jpeg-images.patch
%define python_py_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(0)")
%define instdir %{_libdir}
@@ -1772,6 +1773,7 @@ cat %{PATCH11} >> svtools/source/dialogs
%patch112 -p1 -b .workspace.impress182.patch
%patch113 -p1 -b .ooo108246.svx.check-for-possible-out-of-bounds-index.patch
%patch114 -p1 -b .workspace.sw33bf02.patch
+%patch115 -p1 -b .ooo80674.cmyk-for-jpeg-images.patch
%build
echo build start time is `date`, diskspace: `df -h . | tail -n 1`
@@ -4321,6 +4323,8 @@ fi
- Resolves: rhbz#553929 [abrt] crash in ColorConfigCtrl_Impl::ScrollHdl
(dtardon)
- Resolves: rhbz#549573 improve document compare (caolanm)
+- Resolves: rbhz#555257 openoffice cannot use JPEG images using CMYK
+ colorspace (dtardon)
* Tue Dec 22 2009 Caolán McNamara <caolanm at redhat.com> - 1:3.1.1-19.24
- Resolves: rhbz#545824 bustage in writer with emboldened fonts
More information about the scm-commits
mailing list