rpms/poppler/F-12 poppler-0.12.3-rotated-downscale.patch, NONE, 1.1 poppler.spec, 1.111, 1.112

Marek Kašík mkasik at fedoraproject.org
Mon Feb 15 17:24:35 UTC 2010


Author: mkasik

Update of /cvs/pkgs/rpms/poppler/F-12
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv16825

Modified Files:
	poppler.spec 
Added Files:
	poppler-0.12.3-rotated-downscale.patch 
Log Message:
* Mon Feb 15 2010 Marek Kasik <mkasik at redhat.com> - 0.12.3-9
- Fix downscaling of rotated pages (#563353)


poppler-0.12.3-rotated-downscale.patch:
 CairoOutputDev.cc |   37 +++++++++++++++++++++++++++++++++++--
 1 file changed, 35 insertions(+), 2 deletions(-)

--- NEW FILE poppler-0.12.3-rotated-downscale.patch ---
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index 5ca86b8..a2a9ae5 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -1344,6 +1344,30 @@ void CairoOutputDev::endMaskClip(GfxState *state) {
   clearSoftMask(state);
 }
 
+/* Taken from cairo/doc/tutorial/src/singular.c */
+static void
+get_singular_values (const cairo_matrix_t *matrix,
+		     double               *major,
+		     double               *minor)
+{
+	double xx = matrix->xx, xy = matrix->xy;
+	double yx = matrix->yx, yy = matrix->yy;
+
+	double a = xx*xx+yx*yx;
+	double b = xy*xy+yy*yy;
+	double k = xx*xy+yx*yy;
+
+	double f = (a+b) * .5;
+	double g = (a-b) * .5;
+	double delta = sqrt (g*g + k*k);
+
+	if (major)
+		*major = sqrt (f + delta);
+	if (minor)
+		*minor = sqrt (f - delta);
+}
+
+
 cairo_surface_t *CairoOutputDev::downscaleSurface(cairo_surface_t *orig_surface) {
   cairo_surface_t *dest_surface;
   unsigned char *dest_buffer;
@@ -1356,12 +1380,21 @@ cairo_surface_t *CairoOutputDev::downscaleSurface(cairo_surface_t *orig_surface)
   if (printing)
     return NULL;
 
+
+  orig_width = cairo_image_surface_get_width (orig_surface);
+  orig_height = cairo_image_surface_get_height (orig_surface);
+
   cairo_matrix_t matrix;
   cairo_get_matrix(cairo, &matrix);
 
   /* this whole computation should be factored out */
-  double xScale = matrix.xx;
-  double yScale = matrix.yy;
+  double xScale;
+  double yScale;
+  if (orig_width > orig_height)
+    get_singular_values (&matrix, &xScale, &yScale);
+  else
+    get_singular_values (&matrix, &yScale, &xScale);
+
   int tx, tx2, ty, ty2; /* the integer co-oridinates of the resulting image */
   int scaledHeight;
   int scaledWidth;


Index: poppler.spec
===================================================================
RCS file: /cvs/pkgs/rpms/poppler/F-12/poppler.spec,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -p -r1.111 -r1.112
--- poppler.spec	28 Jan 2010 13:07:50 -0000	1.111
+++ poppler.spec	15 Feb 2010 17:24:34 -0000	1.112
@@ -2,7 +2,7 @@
 Summary: PDF rendering library
 Name: poppler
 Version: 0.12.3
-Release: 8%{?dist}
+Release: 9%{?dist}
 License: GPLv2
 Group: Development/Libraries
 URL:     http://poppler.freedesktop.org/
@@ -18,6 +18,9 @@ Patch100: poppler-0.12.1-objstream.patch
 Patch101: poppler-0.12.3-downscale.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=533992
 Patch102: poppler-0.12.3-actualize-fcconfig.patch
+# http://bugs.freedesktop.org/show_bug.cgi?id=26264
+# http://bugzilla.redhat.com/show_bug.cgi?id=563353
+Patch103: poppler-0.12.3-rotated-downscale.patch
 
 Requires: poppler-data >= 0.4.0
 BuildRequires: automake libtool
@@ -125,6 +128,7 @@ converting PDF files to a number of othe
 %patch100 -p1 -b .objstream
 %patch101 -p1 -b .downscale
 %patch102 -p1 -b .fcconfig
+%patch103 -p1 -b .rotated-downscale
 
 chmod -x goo/GooTimer.h
 
@@ -228,6 +232,9 @@ rm -rf $RPM_BUILD_ROOT
 
 
 %changelog
+* Mon Feb 15 2010 Marek Kasik <mkasik at redhat.com> - 0.12.3-9
+- Fix downscaling of rotated pages (#563353)
+
 * Thu Jan 28 2010 Marek Kasik <mkasik at redhat.com> - 0.12.3-8
 - Get current FcConfig before using it (#533992)
 



More information about the scm-commits mailing list