rpms/kdegraphics/F-9 kdegraphics-4.0.4-okular-fax.patch, NONE, 1.1 kdegraphics.spec, 1.143, 1.144

Lukas Tinkl (ltinkl) fedora-extras-commits at redhat.com
Sat May 31 12:32:43 UTC 2008


Author: ltinkl

Update of /cvs/extras/rpms/kdegraphics/F-9
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv2359

Modified Files:
	kdegraphics.spec 
Added Files:
	kdegraphics-4.0.4-okular-fax.patch 
Log Message:
fix fax (TIFF) printing in okular (#449134)


kdegraphics-4.0.4-okular-fax.patch:

--- NEW FILE kdegraphics-4.0.4-okular-fax.patch ---
--- kdegraphics/okular/generators/tiff/generator_tiff.cpp	2008/05/31 11:40:49	814835
+++ kdegraphics/okular/generators/tiff/generator_tiff.cpp	2008/05/31 11:41:15	814836
@@ -24,6 +24,7 @@
 #include <okular/core/document.h>
 #include <okular/core/page.h>
 #include <okular/core/fileprinter.h>
+#include <okular/core/utils.h>
 
 #include <tiff.h>
 #include <tiffio.h>
@@ -47,6 +48,28 @@
     return QDateTime::fromString( QString::fromLatin1( tiffdate ), "yyyy:MM:dd HH:mm:ss" );
 }
 
+static void adaptSizeToResolution( TIFF *tiff, ttag_t whichres, double dpi, uint32 *size )
+{
+    float resvalue = 1.0;
+    uint16 resunit = 0;
+    if ( !TIFFGetField( tiff, whichres, &resvalue )
+         || !TIFFGetField( tiff, TIFFTAG_RESOLUTIONUNIT, &resunit ) )
+        return;
+
+    float newsize = *size / resvalue;
+    switch ( resunit )
+    {
+        case RESUNIT_INCH:
+            *size = (uint32)( newsize * dpi );
+            break;
+        case RESUNIT_CENTIMETER:
+            *size = (uint32)( newsize * 10.0 / 25.4 * dpi );
+            break;
+        case RESUNIT_NONE:
+            break;
+    }
+}
+
 static KAboutData createAboutData()
 {
     KAboutData aboutData(
@@ -119,8 +142,10 @@
     if ( TIFFSetDirectory( d->tiff, mapPage( request->page()->number() ) ) )
     {
         int rotation = request->page()->rotation();
-        uint32 width = (uint32)request->page()->width();
-        uint32 height = (uint32)request->page()->height();
+        uint32 width = 1;
+        uint32 height = 1;
+        TIFFGetField( d->tiff, TIFFTAG_IMAGEWIDTH, &width );
+        TIFFGetField( d->tiff, TIFFTAG_IMAGELENGTH, &height );
         if ( rotation % 2 == 1 )
             qSwap( width, height );
 
@@ -215,6 +240,9 @@
              TIFFGetField( d->tiff, TIFFTAG_IMAGELENGTH, &height ) != 1 )
             continue;
 
+        adaptSizeToResolution( d->tiff, TIFFTAG_XRESOLUTION, Okular::Utils::dpiX(), &width );
+        adaptSizeToResolution( d->tiff, TIFFTAG_YRESOLUTION, Okular::Utils::dpiY(), &height );
+
         Okular::Page * page = new Okular::Page( realdirs, width, height, Okular::Rotation0 );
         pagesVector[ realdirs ] = page;
 


Index: kdegraphics.spec
===================================================================
RCS file: /cvs/extras/rpms/kdegraphics/F-9/kdegraphics.spec,v
retrieving revision 1.143
retrieving revision 1.144
diff -u -r1.143 -r1.144
--- kdegraphics.spec	7 May 2008 14:36:42 -0000	1.143
+++ kdegraphics.spec	31 May 2008 12:31:55 -0000	1.144
@@ -4,7 +4,7 @@
 Summary:        K Desktop Environment - Graphics Applications
 Epoch:          7
 Version:        4.0.4
-Release:        1%{?dist}
+Release:        2%{?dist}
 
 Name:           kdegraphics
 Obsoletes:      kdegraphics4 < %{version}-%{release}
@@ -18,6 +18,8 @@
 Patch0:         kdegraphics-4.0.1-system-libspectre.patch
 # necessary CMakeLists.txt changes missing in the above commit
 Patch1:         kdegraphics-4.0.1-system-libspectre-cmake.patch
+# 49134: Okular is broken for FAX, and KFAX has been removed
+Patch2:         kdegraphics-4.0.4-okular-fax.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
 BuildRequires:  kde-filesystem >= 4
@@ -90,7 +92,7 @@
 rm -rf okular/generators/spectre/libspectre
 %patch1 -p1
 %endif
-
+%patch2 -p1 -b .okular-fax
 
 %build
 
@@ -166,6 +168,9 @@
 
 
 %changelog
+* Sat May 31 2008 Lukáš Tinkl <ltinkl at redhat.com> 4.0.4-2
+- fix fax (TIFF) printing in okular (#449134)
+
 * Tue May 06 2008 Rex Dieter <rdieter at fedoraproject.org> 4.0.4-1
 - kde-4.0.4
 




More information about the scm-commits mailing list