r18982 by fschmid - Fixed Bug #12184: PDF images imported with low resolution

scribus-commit scribus-commit at lists.scribus.net
Thu Apr 3 10:22:18 UTC 2014


Author: fschmid
Date: Thu Apr  3 10:22:18 2014
New Revision: 18982

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=18982
Log:
Fixed Bug #12184: PDF images imported with low resolution

Modified:
    trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
    trunk/Scribus/scribus/scpainter.cpp

Modified: trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18982&path=/trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp (original)
+++ trunk/Scribus/scribus/plugins/import/pdf/slaoutput.cpp Thu Apr  3 10:22:18 2014
@@ -2403,16 +2403,20 @@
 	{
 		mm.reset();
 		mm.rotate(-tline.angle());
+		res = res.transformed(mm);
 	}
 	else
 	{
-		mm.reset();
-		if (sx < 0)
-			mm.scale(-1, 1);
-		if (sy < 0)
-			mm.scale(1, -1);
-	}
-	res = res.transformed(mm);
+		if ((sx < 0) || (sy < 0))
+		{
+			mm.reset();
+			if (sx < 0)
+				mm.scale(-1, 1);
+			if (sy < 0)
+				mm.scale(1, -1);
+			res = res.transformed(mm);
+		}
+	}
 	if (res.isNull())
 	{
 		delete imgStr;
@@ -2535,16 +2539,19 @@
 	{
 		mm.reset();
 		mm.rotate(-tline.angle());
+		res = res.transformed(mm);
 	}
 	else
 	{
-//		mm.reset();
-		if (sx < 0)
-			mm.scale(-1, 1);
-		if (sy < 0)
-			mm.scale(1, -1);
-	}
-	res = res.transformed(mm);
+		if ((sx < 0) || (sy < 0))
+		{
+			if (sx < 0)
+				mm.scale(-1, 1);
+			if (sy < 0)
+				mm.scale(1, -1);
+			res = res.transformed(mm);
+		}
+	}
 	int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor + trect.x(), yCoor + trect.y(), trect.width(), trect.height(), 0, CommonStrings::None, CommonStrings::None, true);
 	PageItem* ite = m_doc->Items->at(z);
 	ite->SetRectFrame();
@@ -2670,16 +2677,19 @@
 	{
 		mm.reset();
 		mm.rotate(-tline.angle());
+		res = res.transformed(mm);
 	}
 	else
 	{
-//		mm.reset();
-		if (sx < 0)
-			mm.scale(-1, 1);
-		if (sy < 0)
-			mm.scale(1, -1);
-	}
-	res = res.transformed(mm);
+		if ((sx < 0) || (sy < 0))
+		{
+			if (sx < 0)
+				mm.scale(-1, 1);
+			if (sy < 0)
+				mm.scale(1, -1);
+			res = res.transformed(mm);
+		}
+	}
 	int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor + trect.x(), yCoor + trect.y(), trect.width(), trect.height(), 0, CommonStrings::None, CommonStrings::None, true);
 	PageItem* ite = m_doc->Items->at(z);
 	ite->SetRectFrame();
@@ -2809,21 +2819,25 @@
 	QRectF trect = m_ctm.mapRect(crect);
 	double sx = m_ctm.m11();
 	double sy = m_ctm.m22();
+	QImage img = image->copy();
 	QTransform mm = QTransform(ctm[0] / width, ctm[1] / width, -ctm[2] / height, -ctm[3] / height, 0, 0);
 	if ((mm.type() == QTransform::TxShear) || (mm.type() == QTransform::TxRotate))
 	{
 		mm.reset();
 		mm.rotate(-tline.angle());
+		img = image->transformed(mm);
 	}
 	else
 	{
-//		mm.reset();
-		if (sx < 0)
-			mm.scale(-1, 1);
-		if (sy < 0)
-			mm.scale(1, -1);
-	}
-	QImage img = image->transformed(mm);
+		if ((sx < 0) || (sy < 0))
+		{
+			if (sx < 0)
+				mm.scale(-1, 1);
+			if (sy < 0)
+				mm.scale(1, -1);
+			img = image->transformed(mm);
+		}
+	}
 	int z = m_doc->itemAdd(PageItem::ImageFrame, PageItem::Unspecified, xCoor + trect.x(), yCoor + trect.y(), trect.width(), trect.height(), 0, CommonStrings::None, CommonStrings::None, true);
 	PageItem* ite = m_doc->Items->at(z);
 	ite->SetRectFrame();

Modified: trunk/Scribus/scribus/scpainter.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=18982&path=/trunk/Scribus/scribus/scpainter.cpp
==============================================================================
--- trunk/Scribus/scribus/scpainter.cpp (original)
+++ trunk/Scribus/scribus/scpainter.cpp Thu Apr  3 10:22:18 2014
@@ -1718,17 +1718,17 @@
 	cairo_surface_t *image2  = cairo_image_surface_create_for_data ((uchar*)image->bits(), CAIRO_FORMAT_RGB24, image->width(), image->height(), image->width()*4);
 	cairo_surface_t *image3 = cairo_image_surface_create_for_data ((uchar*)image->bits(), CAIRO_FORMAT_ARGB32, image->width(), image->height(), image->width()*4);
 	cairo_set_source_surface (m_cr, image2, 0, 0);
-	cairo_pattern_set_filter(cairo_get_source(m_cr), CAIRO_FILTER_FAST);
+	cairo_pattern_set_filter(cairo_get_source(m_cr), CAIRO_FILTER_GOOD);
     cairo_mask_surface (m_cr, image3, 0, 0);
 	cairo_surface_destroy (image2);
 	cairo_surface_destroy (image3);
 	cairo_pop_group_to_source (m_cr);
-	cairo_pattern_set_filter(cairo_get_source(m_cr), CAIRO_FILTER_FAST);
+	cairo_pattern_set_filter(cairo_get_source(m_cr), CAIRO_FILTER_GOOD);
 	setRasterOp(m_blendModeFill);
 	if (maskMode > 0)
 	{
 		cairo_pattern_t *patM = getMaskPattern();
-		cairo_pattern_set_filter(patM, CAIRO_FILTER_FAST);
+		cairo_pattern_set_filter(patM, CAIRO_FILTER_GOOD);
 		cairo_mask(m_cr, patM);
 		if ((maskMode == 2) || (maskMode == 4) || (maskMode == 5) || (maskMode == 6))
 			cairo_surface_destroy(imageMask);




More information about the scribus-commit mailing list