r23270 by jghali - Backport #15797 fix: PDFs imported and duplicated in image frames wrongly scaled on PDF export

scribus-commit scribus-commit at lists.scribus.net
Tue Oct 22 02:24:54 UTC 2019


Author: jghali
Date: Tue Oct 22 02:24:54 2019
New Revision: 23270

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23270
Log:
Backport #15797 fix: PDFs imported and duplicated in image frames wrongly scaled on PDF export

Modified:
    branches/Version14x/Scribus/scribus/pdflib_core.cpp
    branches/Version14x/Scribus/scribus/pdflib_core.h

Modified: branches/Version14x/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23270&path=/branches/Version14x/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- branches/Version14x/Scribus/scribus/pdflib_core.cpp	(original)
+++ branches/Version14x/Scribus/scribus/pdflib_core.cpp	Tue Oct 22 02:24:54 2019
@@ -7014,8 +7014,6 @@
 	bool   found = false;
 	bool   alphaM = false;
 	bool   realCMYK = false;
-	bool   bitmapFromGS = false;
-	bool   isEmbeddedPDF = false;
 	bool   hasGrayProfile = false;
 	QString profInUse = Profil;
 	int    afl = Options.Resolution;
@@ -7037,6 +7035,8 @@
 	ImInfo.ya = y;
 	ImInfo.origXsc = c->imageXScale();
 	ImInfo.origYsc = c->imageYScale();
+	ImInfo.isBitmapFromGS = false;
+	ImInfo.isEmbeddedPDF = false;
 	ShIm   ImInfo2;
 	ImInfo2.origXsc = c->imageXScale();
 	ImInfo2.origYsc = c->imageYScale();
@@ -7075,7 +7075,7 @@
 			}
 			else
 				imageLoaded = PDF_EmbeddedPDF(c, fn, sx, sy, x, y, fromAN, Profil, Embedded, Intent, ImInfo, output);
-			isEmbeddedPDF = true;
+			ImInfo.isEmbeddedPDF = true;
 			ImInfo.Page = c->pixm.imgInfo.actualPageNumber;
 		}
 		if(!imageLoaded && extensionIndicatesPDF(ext) && c->effectsInUse.count() == 0 && Options.embedPDF)
@@ -7085,7 +7085,7 @@
 		{ 
 			if ((extensionIndicatesPDF(ext) || extensionIndicatesEPSorPS(ext)) && (c->pixm.imgInfo.type != ImageType7))
 			{
-				bitmapFromGS = true;
+				ImInfo.isBitmapFromGS = true;
 				if (Options.RecalcPic)
 				{
 					afl = qMin(Options.PicRes, Options.Resolution);
@@ -7588,27 +7588,12 @@
 		ImInfo = SharedImages[fn];
 		ImInfo.sxa *= sx / ImInfo.xa;
 		ImInfo.sya *= sy / ImInfo.ya;
-		/*
-		ImRes = SharedImages[fn].ResNum;
-		ImWid = SharedImages[fn].Width;
-		ImHei = SharedImages[fn].Height;
-		aufl = SharedImages[fn].reso;
-		sxn = SharedImages[fn].sxa * sx / SharedImages[fn].xa;
-		syn = SharedImages[fn].sya * sy / SharedImages[fn].ya;
-		*/
 	}
 	QString embedPre = "";
-	if ((bitmapFromGS) || (isEmbeddedPDF)) // compensate gsResolution setting
-	{
-		if (isEmbeddedPDF)
-		{
-			// #9268 : per specs default color space is grayscale
-			/*if (Options.isGrayscale)
-				embedPre = "0 g 0 G";
-			else if (Options.UseRGB)
-				embedPre = "0 0 0 rg 0 0 0 RG";
-			else
-				embedPre = "0 0 0 0 k 0 0 0 0 K";*/
+	if ((ImInfo.isBitmapFromGS) || (ImInfo.isEmbeddedPDF)) // compensate gsResolution setting
+	{
+		if (ImInfo.isEmbeddedPDF)
+		{
 			embedPre  = "0 g 0 G";
 			embedPre += " 1 w 0 J 0 j [] 0 d\n"; // add default graphics stack parameters pdftex relies on them
 		}

Modified: branches/Version14x/Scribus/scribus/pdflib_core.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23270&path=/branches/Version14x/Scribus/scribus/pdflib_core.h
==============================================================================
--- branches/Version14x/Scribus/scribus/pdflib_core.h	(original)
+++ branches/Version14x/Scribus/scribus/pdflib_core.h	Tue Oct 22 02:24:54 2019
@@ -66,10 +66,10 @@
 private:
 	struct ShIm
 	{
-		int ResNum;
-		int Width;
-		int Height;
-		int Page;
+		int  ResNum;
+		int  Width;
+		int  Height;
+		int  Page;
 		double reso;
 		double sxa;
 		double sya;
@@ -77,6 +77,8 @@
 		double ya;
 		double origXsc;
 		double origYsc;
+		bool isBitmapFromGS;
+		bool isEmbeddedPDF;
 		QMap<int, ImageLoadRequest> RequestProps;
 	};
 




More information about the scribus-commit mailing list