r13899 by jghali - #8371 : patterns with spaces/special chars in their names cause PDF corruption

scribus-commit scribus-commit at lists.scribus.net
Wed Aug 26 05:52:53 CEST 2009


Revision: 13899
Author: jghali
Date: 2009-08-23T00:01:21.400830Z
Commit message: #8371 : patterns with spaces/special chars in their names cause PDF corruption

Changeset: 
M  /trunk/Scribus/scribus/pdflib_core.cpp
M  /trunk/Scribus/scribus/pslib.cpp

Diffs:
Index: scribus/pdflib_core.cpp
===================================================================
--- scribus/pdflib_core.cpp	(revision 13898)
+++ scribus/pdflib_core.cpp	(revision 13899)
@@ -5286,9 +5286,9 @@
 		if (Options.Compress)
 			PutDoc("\n/Filter /FlateDecode");
 		PutDoc(" >>\nstream\n"+EncStream(tmp2, patObject)+"\nendstream\nendobj\n");
-		Patterns.insert("Pattern"+currItem->pattern()+QString::number(ResCount), patObject);
+		Patterns.insert("Pattern"+QString::number(patObject), patObject);
 		QString tmp = "/Pattern cs\n";
-		tmp += "/Pattern"+currItem->pattern()+QString::number(ResCount)+" scn\n";
+		tmp += "/Pattern"+QString::number(patObject)+" scn\n";
 		tmp += SetClipPath(currItem);
 		if (currItem->fillRule)
 			tmp += "h\nf*\n";
Index: scribus/pslib.cpp
===================================================================
--- scribus/pslib.cpp	(revision 13898)
+++ scribus/pslib.cpp	(revision 13899)
@@ -463,8 +463,9 @@
 					return false;
 			}
 		}
-		PutStream("/Pattern"+patterns[c]+" 8 dict def\n");
-		PutStream("Pattern"+patterns[c]+" begin\n");
+		uint patHash = qHash(patterns[c]);
+		PutStream("/Pattern"+QString::number(patHash)+" 8 dict def\n");
+		PutStream("Pattern"+QString::number(patHash)+" begin\n");
 		PutStream("/PatternType 1 def\n");
 		PutStream("/PaintType 1 def\n");
 		PutStream("/TilingType 1 def\n");
@@ -3451,12 +3452,13 @@
 			break;
 		case 8:
 			pat = &m_Doc->docPatterns[c->pattern()];
+			uint patHash = qHash(c->pattern());
 			c->patternTransform(patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation);
 			patternMatrix.translate(patternOffsetX, -patternOffsetY);
 			patternMatrix.rotate(-patternRotation);
 			patternMatrix.scale(pat->scaleX, pat->scaleY);
 			patternMatrix.scale(patternScaleX / 100.0 , patternScaleY / 100.0);
-			PutStream("Pattern"+c->pattern()+" ["+ToStr(patternMatrix.m11())+" "+ToStr(patternMatrix.m12())+" "+ToStr(patternMatrix.m21())+" "+ToStr(patternMatrix.m22())+" "+ToStr(patternMatrix.dx())+" "+ToStr(patternMatrix.dy())+"] makepattern setpattern\n");
+			PutStream("Pattern"+QString::number(patHash)+" ["+ToStr(patternMatrix.m11())+" "+ToStr(patternMatrix.m12())+" "+ToStr(patternMatrix.m21())+" "+ToStr(patternMatrix.m22())+" "+ToStr(patternMatrix.dx())+" "+ToStr(patternMatrix.dy())+"] makepattern setpattern\n");
 			if (fillRule)
 				PutStream("eofill\n");
 			else




More information about the scribus-commit mailing list