r19030 by fschmid - Fixed loading of patterns.
scribus-commit
scribus-commit at lists.scribus.net
Thu Apr 10 19:18:58 UTC 2014
Author: fschmid
Date: Thu Apr 10 19:18:57 2014
New Revision: 19030
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19030
Log:
Fixed loading of patterns.
Modified:
trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
trunk/Scribus/scribus/scpattern.cpp
trunk/Scribus/scribus/scpattern.h
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19030&path=/trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus134format/scribus134format.cpp Thu Apr 10 19:18:57 2014
@@ -2211,9 +2211,7 @@
uint itemCount2 = m_Doc->Items->count();
if (itemCount2 > itemCount1)
{
- PageItem* currItem = doc->Items->at(itemCount1), *newItem;
- pat.pattern = currItem->DrawObj_toImage(qMax(pat.width, pat.height));
- pat.pattern = pat.pattern.copy(-pat.xoffset, -pat.yoffset, pat.width, pat.height);
+ PageItem* newItem;
for (uint as = itemCount1; as < itemCount2; ++as)
{
newItem = doc->Items->takeAt(itemCount1);
@@ -2222,6 +2220,7 @@
newItem->gYpos += pat.yoffset;
pat.items.append(newItem);
}
+ pat.createPreview();
}
doc->docPatterns.insert(patternName, pat);
Modified: trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19030&path=/trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ trunk/Scribus/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Thu Apr 10 19:18:57 2014
@@ -4282,8 +4282,6 @@
if (itemCount2 > itemCount1)
{
PageItem* currItem = doc->Items->at(itemCount1), *newItem;
- pat.pattern = currItem->DrawObj_toImage(qMax(pat.width, pat.height));
- pat.pattern = pat.pattern.copy(-pat.xoffset, -pat.yoffset, pat.width, pat.height);
double minx = std::numeric_limits<double>::max();
double miny = std::numeric_limits<double>::max();
double maxx = -std::numeric_limits<double>::max();
@@ -4311,6 +4309,7 @@
newItem->gYpos += pat.yoffset;
pat.items.append(newItem);
}
+ pat.createPreview();
}
doc->docPatterns.insert(patternName, pat);
Modified: trunk/Scribus/scribus/scpattern.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19030&path=/trunk/Scribus/scribus/scpattern.cpp
==============================================================================
--- trunk/Scribus/scribus/scpattern.cpp (original)
+++ trunk/Scribus/scribus/scpattern.cpp Thu Apr 10 19:18:57 2014
@@ -24,6 +24,7 @@
#include <QString>
#include "scpattern.h"
+#include "scpainter.h"
#include "pageitem.h"
#include "pageitem_imageframe.h"
#include "scribusdoc.h"
@@ -84,3 +85,28 @@
pattern = QImage();
m_doc->setLoading(false);
}
+
+void ScPattern::createPreview()
+{
+ double sc = 500.0 / qMax(width, height);
+ bool savedFlag = m_doc->guidesPrefs().framesShown;
+ m_doc->guidesPrefs().framesShown = false;
+ pattern = QImage(qRound(width * sc), qRound(height * sc), QImage::Format_ARGB32_Premultiplied);
+ pattern.fill( qRgba(0, 0, 0, 0) );
+ ScPainter *painter = new ScPainter(&pattern, pattern.width(), pattern.height(), 1, 0);
+ painter->setZoomFactor(sc);
+ for (int em = 0; em < items.count(); ++em)
+ {
+ PageItem* embedded = items.at(em);
+ painter->save();
+ painter->translate(embedded->gXpos, embedded->gYpos);
+ embedded->isEmbedded = true;
+ embedded->invalid = true;
+ embedded->DrawObj(painter, QRectF());
+ embedded->isEmbedded = false;
+ painter->restore();
+ }
+ painter->end();
+ delete painter;
+ m_doc->guidesPrefs().framesShown = savedFlag;
+}
Modified: trunk/Scribus/scribus/scpattern.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19030&path=/trunk/Scribus/scribus/scpattern.h
==============================================================================
--- trunk/Scribus/scribus/scpattern.h (original)
+++ trunk/Scribus/scribus/scpattern.h Thu Apr 10 19:18:57 2014
@@ -41,6 +41,7 @@
QImage* getPattern();
void setDoc(ScribusDoc *doc);
void setPattern(QString file);
+ void createPreview();
double scaleX;
double scaleY;
double height;
More information about the scribus-commit
mailing list