r23170 by jghali - #15797: PDFs imported and duplicated in image frames wrongly scaled on PDF export
scribus-commit
scribus-commit at lists.scribus.net
Mon Sep 2 02:32:01 UTC 2019
Author: jghali
Date: Mon Sep 2 02:32:01 2019
New Revision: 23170
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23170
Log:
#15797: PDFs imported and duplicated in image frames wrongly scaled on PDF export
Modified:
trunk/Scribus/scribus/pdflib_core.cpp
trunk/Scribus/scribus/pdflib_core.h
Modified: trunk/Scribus/scribus/pdflib_core.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23170&path=/trunk/Scribus/scribus/pdflib_core.cpp
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.cpp (original)
+++ trunk/Scribus/scribus/pdflib_core.cpp Mon Sep 2 02:32:01 2019
@@ -10280,8 +10280,6 @@
bool found = false;
bool alphaM = false;
bool realCMYK = false;
- bool bitmapFromGS = false;
- bool isEmbeddedPDF = false;
bool hasGrayProfile = false;
bool avoidPDFXOutputIntentProf = false;
QString profInUse = Profil;
@@ -10290,16 +10288,10 @@
int origWidth = 1;
int origHeight = 1;
ShIm ImInfo;
- ImInfo.ResNum = 0;
- ImInfo.sxa = 0;
- ImInfo.sya = 0;
if (Options.RecalcPic)
ImInfo.reso = Options.PicRes / 72.0;
else
ImInfo.reso = Options.Resolution / 72.0;
- ImInfo.Width = 0;
- ImInfo.Height = 0;
- ImInfo.Page = 0;
ImInfo.xa = x;
ImInfo.ya = y;
ImInfo.origXsc = c->imageXScale();
@@ -10346,7 +10338,7 @@
}
else
imageLoaded = PDF_EmbeddedPDF(c, fn, sx, sy, x, y, fromAN, ImInfo, fatalError);
- isEmbeddedPDF = true;
+ ImInfo.isEmbeddedPDF = true;
ImInfo.Page = c->pixm.imgInfo.actualPageNumber;
}
if (!imageLoaded && extensionIndicatesPDF(ext) && c->effectsInUse.count() == 0 && Options.embedPDF)
@@ -10364,7 +10356,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);
@@ -10898,27 +10890,13 @@
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;
- */
}
QByteArray embedPre;
- if ((bitmapFromGS) || (isEmbeddedPDF)) // compensate gsResolution setting
- {
- if (isEmbeddedPDF)
+ if (ImInfo.isBitmapFromGS || ImInfo.isEmbeddedPDF) // compensate gsResolution setting
+ {
+ if (ImInfo.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";*/
embedPre = "0 g 0 G";
embedPre += " 1 w 0 J 0 j [] 0 d\n"; // add default graphics stack parameters pdftex relies on them
}
@@ -10948,7 +10926,6 @@
else
embedPre += FToStr(ImInfo.Width*ImInfo.sxa)+" 0 0 "+FToStr(ImInfo.Height*ImInfo.sya)+" "+FToStr(x*sx)+" "+FToStr((-ImInfo.Height*ImInfo.sya+y*sy))+" cm\n";
*output = embedPre + Pdf::toName(ResNam+"I"+Pdf::toPdf(ImInfo.ResNum)) + " Do\n";
-// *output = QString(embedPre + FToStr(ImInfo.Width*ImInfo.sxa)+" 0 0 "+FToStr(ImInfo.Height*ImInfo.sya)+" "+FToStr(x*sx)+" "+FToStr((-ImInfo.Height*ImInfo.sya+y*sy))+" cm\n/"+ResNam+"I"+Pdf::toPdf(ImInfo.ResNum)+" Do\n");
}
else if (output)
*output = QByteArray("");
Modified: trunk/Scribus/scribus/pdflib_core.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23170&path=/trunk/Scribus/scribus/pdflib_core.h
==============================================================================
--- trunk/Scribus/scribus/pdflib_core.h (original)
+++ trunk/Scribus/scribus/pdflib_core.h Mon Sep 2 02:32:01 2019
@@ -74,17 +74,19 @@
private:
struct ShIm
{
- PdfId ResNum;
- int Width;
- int Height;
- int Page;
- double reso;
- double sxa;
- double sya;
- double xa;
- double ya;
- double origXsc;
- double origYsc;
+ PdfId ResNum = 0;
+ int Width = 0;
+ int Height = 0;
+ int Page = 0;
+ double reso = 1.0;
+ double sxa = 0;
+ double sya = 0;
+ double xa = 0;
+ double ya = 0;
+ double origXsc = 1.0;
+ double origYsc = 1.0;
+ bool isBitmapFromGS = false;
+ bool isEmbeddedPDF = false;
QMap<int, ImageLoadRequest> RequestProps;
};
More information about the scribus-commit
mailing list