rpms/openoffice.org/F-11 openoffice.org-3.3.0.ooo80674.cmyk-for-jpeg-images.patch, NONE, 1.1 openoffice.org.spec, 1.1952, 1.1953

David Tardon dtardon at fedoraproject.org
Thu Jan 14 16:21:31 UTC 2010


Author: dtardon

Update of /cvs/pkgs/rpms/openoffice.org/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv27281

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-11/openoffice.org.spec,v
retrieving revision 1.1952
retrieving revision 1.1953
diff -u -p -r1.1952 -r1.1953
--- openoffice.org.spec	12 Jan 2010 09:26:12 -0000	1.1952
+++ openoffice.org.spec	14 Jan 2010 16:21:30 -0000	1.1953
@@ -169,6 +169,7 @@ Patch93: workspace.extmgr01.patch
 Patch94: openoffice.org-3.3.0.ooo108047.writerfilter.safer-field-context-handling.patch
 Patch95: workspace.impress182.patch
 Patch96: openoffice.org-3.3.0.ooo108246.svx.check-for-possible-out-of-bounds-index.patch
+Patch97: 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}
@@ -1696,6 +1697,7 @@ cat %{PATCH11} >> svtools/source/dialogs
 %patch94 -p1 -b .ooo108047.writerfilter.safer-field-context-handling.patch
 %patch95 -p1 -b .workspace.impress182.patch
 %patch96 -p1 -b .ooo108246.svx.check-for-possible-out-of-bounds-index.patch
+%patch97 -p1 -b .ooo80674.cmyk-for-jpeg-images.patch
 
 %build
 echo build start time is `date`, diskspace: `df -h . | tail -n 1`
@@ -4199,7 +4201,7 @@ fi
     unopkg list --shared > /dev/null 2>&1 || :
 
 %changelog
-* Fri Jan 01 2010 Caolán McNamara <caolanm at redhat.com> - 1:3.1.1-19.12-UNBUILT
+* Thu Jan 14 2010 Caolán McNamara <caolanm at redhat.com> - 1:3.1.1-19.12-UNBUILT
 - Resolves: rhbz#549890 add workspace.extmgr01.patch (dtardon)
 - Resolves: rhbz#551983 OpenOffice writer crashes when opening document
   with link in footnote (dtardon)
@@ -4207,6 +4209,8 @@ fi
   background color is changed (dtardon)
 - Resolves: rhbz#553929 [abrt] crash in ColorConfigCtrl_Impl::ScrollHdl
   (dtardon)
+- Resolves: rbhz#555257 openoffice cannot use JPEG images using CMYK
+  colorspace (dtardon)
 
 * Tue Dec 15 2009 Caolán McNamara <caolanm at redhat.com> - 1:3.1.1-19.11
 - Resolves: rhbz#529648 add workspace.fwk132.patch



More information about the scm-commits mailing list