Subversion Repositories Scribus

Compare Revisions

Ignore whitespace Rev 24395 → Rev 24396

/branches/Version156/Scribus/scribus/plugins/colorwheel/cwdialog.cpp
255,7 → 255,8
int y = previewLabel->height();
QList<ScColor> cols = colorWheel->colorList.values();
int xstep = x / cols.count();
QPixmap pm = QPixmap(x, y);
QPixmap pm = QPixmap(x * devicePixelRatioF(), y * devicePixelRatioF());
pm.setDevicePixelRatio(devicePixelRatioF());
QPainter *p = new QPainter(&pm);
QFontMetrics fm = p->fontMetrics();
 
/branches/Version156/Scribus/scribus/plugins/fontpreview/fontpreview.cpp
24,9 → 24,10
setupUi(this);
setModal(true);
setWindowIcon(IconManager::instance().loadIcon("AppIcon.png"));
m_Doc=doc;
m_Doc = doc;
 
sampleItem = new SampleItem();
sampleItem->setDevicePixelRatio(devicePixelRatioF());
 
languageChange();
 
46,7 → 47,7
uint srt = prefs->getUInt("sortColumn", 0);
bool extend = prefs->getBool("extendedView", false);
extendedCheckBox->setChecked(extend);
Qt::SortOrder srtOrder = (Qt::SortOrder)prefs->getUInt("sortColumnOrder", 0);
Qt::SortOrder srtOrder = (Qt::SortOrder) prefs->getUInt("sortColumnOrder", 0);
 
proxyModel->sort(srt, srtOrder);
fontList->horizontalHeader()->setSortIndicatorShown(true);
/branches/Version156/Scribus/scribus/printpreviewcreator.cpp
41,6 → 41,14
m_renderingOptionsChanged = true;
}
 
void PrintPreviewCreator::setDevicePixelRatio(double ratio)
{
if (m_devicePixelRatio == ratio)
return;
m_devicePixelRatio = ratio;
m_renderingOptionsChanged = true;
}
 
void PrintPreviewCreator::setPreviewResolution(int res)
{
if (m_previewResolution == res)
/branches/Version156/Scribus/scribus/printpreviewcreator.h
57,6 → 57,11
virtual void setAntialisingEnabled(bool enabled);
 
/**
* @brief Set device pixel ratio
*/
virtual void setDevicePixelRatio(double ratio);
 
/**
* @brief Set preview resolution (in dot per inch)
*/
virtual void setPreviewResolution(int res);
80,6 → 85,8
ScribusDoc* m_doc { nullptr };
PrintOptions m_printOptions;
 
double m_devicePixelRatio { 1.0 };
 
int m_previewResolution { 72 };
bool m_useAntialiasing { true };
bool m_showTransparency { false };
/branches/Version156/Scribus/scribus/printpreviewcreator_gdi.cpp
85,9 → 85,12
const ScPage* page = m_doc->Pages->at(pageIndex);
if ((page->orientation() == 1) && (image.width() < image.height()))
image = image.transformed( QMatrix(0, 1, -1, 0, 0, 0) );
 
image.setDevicePixelRatio(m_devicePixelRatio);
if (m_showTransparency)
{
pixmap = QPixmap(image.width(), image.height());
pixmap.setDevicePixelRatio(m_devicePixelRatio);
QPainter p;
QBrush b(QColor(205,205,205), IconManager::instance().loadPixmap("testfill.png"));
p.begin(&pixmap);
97,6 → 100,8
}
else
pixmap = QPixmap::fromImage(image);
pixmap.setDevicePixelRatio(m_devicePixelRatio);
 
return pixmap;
}
 
117,7 → 122,7
options.toFile = false;
options.useColor = m_printOptions.useColor;
options.useSpotColors = false;
bool done = winPrint.gdiPrintPreview(page, &image, options, res / 72.0);
bool done = winPrint.gdiPrintPreview(page, &image, options, res / 72.0 * m_devicePixelRatio);
if (done)
image.save( ScPaths::tempFileDir() + m_tempBaseName + ".png", "PNG" );
return done;
/branches/Version156/Scribus/scribus/printpreviewcreator_pdf.cpp
74,8 → 74,9
QPixmap PrintPreviewCreator_PDF::createPreview(int pageIndex)
{
int ret = -1;
double w = m_doc->Pages->at(pageIndex)->width() * m_previewResolution / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * m_previewResolution / 72.0;
int gsRes = qRound(m_previewResolution * m_devicePixelRatio);
int w = qRound(m_doc->Pages->at(pageIndex)->width() * gsRes / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * gsRes / 72.0);
 
QPixmap pixmap;
if (m_printOptionsChanged || (m_pageIndex != pageIndex))
91,9 → 92,9
if (m_printOptionsChanged || m_renderingOptionsChanged || (m_pageIndex != pageIndex))
{
if (m_sepPreviewEnabled && m_haveTiffSep)
ret = renderPreviewSep(pageIndex, m_previewResolution);
ret = renderPreviewSep(pageIndex, gsRes);
else
ret = renderPreview(pageIndex, m_previewResolution);
ret = renderPreview(pageIndex, gsRes);
if (ret > 0)
{
imageLoadError(pixmap, pageIndex);
109,8 → 110,8
 
ScImage im;
bool mode;
int w2 = qRound(w);
int h2 = qRound(h);
int w2 = w;
int h2 = h;
image = QImage(w2, h2, QImage::Format_ARGB32);
image.fill(qRgba(0, 0, 0, 0));
306,9 → 307,11
}
}
 
image.setDevicePixelRatio(m_devicePixelRatio);
if (m_showTransparency)
{
pixmap = QPixmap(image.width(), image.height());
pixmap.setDevicePixelRatio(m_devicePixelRatio);
QPainter p;
QBrush b(QColor(205,205,205), IconManager::instance().loadPixmap("testfill.png"));
p.begin(&pixmap);
318,6 → 321,7
}
else
pixmap = QPixmap::fromImage(image);
pixmap.setDevicePixelRatio(m_devicePixelRatio);
 
m_pageIndex = pageIndex;
m_printOptionsChanged = false;
361,14 → 365,14
 
QStringList args;
QString tmp, tmp2, tmp3;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int w = qRound(m_doc->Pages->at(pageIndex)->width() * res / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * res / 72.0);
 
args.append( "-q" );
args.append( "-dNOPAUSE" );
args.append( "-dPARANOIDSAFER" );
args.append( QString("-r%1").arg(tmp.setNum(res)) );
args.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(w)), tmp3.setNum(qRound(h))) );
args.append( QString("-g%1x%2").arg(tmp2.setNum(w), tmp3.setNum(h)) );
if (m_sepPreviewEnabled)
{
if (!m_haveTiffSep)
439,14 → 443,14
QStringList args, args1, args2, args3;
 
QString tmp, tmp2, tmp3;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int w = qRound(m_doc->Pages->at(pageIndex)->width() * res / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * res / 72.0);
 
args1.append( "-q" );
args1.append( "-dNOPAUSE" );
args1.append( "-dPARANOIDSAFER" );
args1.append( QString("-r%1").arg(tmp.setNum(res)) );
args1.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(w)), tmp3.setNum(qRound(h))) );
args1.append( QString("-g%1x%2").arg(tmp2.setNum(w), tmp3.setNum(h)) );
if (m_useAntialiasing)
{
args1.append("-dTextAlphaBits=4");
/branches/Version156/Scribus/scribus/printpreviewcreator_ps.cpp
67,8 → 67,9
QPixmap PrintPreviewCreator_PS::createPreview(int pageIndex)
{
int ret = -1;
double w = m_doc->Pages->at(pageIndex)->width() * m_previewResolution / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * m_previewResolution / 72.0;
int gsRes = qRound(m_previewResolution * m_devicePixelRatio);
int w = qRound(m_doc->Pages->at(pageIndex)->width() * gsRes / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * gsRes / 72.0);
 
QPixmap pixmap;
if (m_printOptionsChanged || (m_pageIndex != pageIndex))
84,9 → 85,9
if (m_printOptionsChanged || m_renderingOptionsChanged || (m_pageIndex != pageIndex))
{
if (m_sepPreviewEnabled && m_haveTiffSep)
ret = renderPreviewSep(pageIndex, m_previewResolution);
ret = renderPreviewSep(pageIndex, gsRes);
else
ret = renderPreview(pageIndex, m_previewResolution);
ret = renderPreview(pageIndex, gsRes);
if (ret > 0)
{
imageLoadError(pixmap, pageIndex);
102,8 → 103,8
 
ScImage im;
bool mode;
int w2 = qRound(w);
int h2 = qRound(h);
int w2 = w;
int h2 = h;
if (m_doc->Pages->at(pageIndex)->orientation() == 1)
std::swap(w2, h2);
image = QImage(w2, h2, QImage::Format_ARGB32);
304,9 → 305,12
const ScPage* page = m_doc->Pages->at(pageIndex);
if ((page->orientation() == 1) && (image.width() < image.height()))
image = image.transformed( QMatrix(0, 1, -1, 0, 0, 0) );
 
image.setDevicePixelRatio(m_devicePixelRatio);
if (m_showTransparency)
{
pixmap = QPixmap(image.width(), image.height());
pixmap.setDevicePixelRatio(m_devicePixelRatio);
QPainter p;
QBrush b(QColor(205,205,205), IconManager::instance().loadPixmap("testfill.png"));
p.begin(&pixmap);
316,6 → 320,7
}
else
pixmap = QPixmap::fromImage(image);
pixmap.setDevicePixelRatio(m_devicePixelRatio);
 
m_pageIndex = pageIndex;
m_printOptionsChanged = false;
384,8 → 389,8
 
QStringList args;
QString tmp, tmp2, tmp3;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int w = qRound(m_doc->Pages->at(pageIndex)->width() * res / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * res / 72.0);
if (m_doc->Pages->at(pageIndex)->orientation() == 1)
std::swap(w, h);
 
393,7 → 398,7
args.append( "-dNOPAUSE" );
args.append( "-dPARANOIDSAFER" );
args.append( QString("-r%1").arg(tmp.setNum(res)) );
args.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(w)), tmp3.setNum(qRound(h))) );
args.append( QString("-g%1x%2").arg(tmp2.setNum(w), tmp3.setNum(h)) );
if (m_sepPreviewEnabled)
{
if (!m_haveTiffSep)
464,8 → 469,8
QStringList args, args1, args2, args3;
 
QString tmp, tmp2, tmp3;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int w = qRound(m_doc->Pages->at(pageIndex)->width() * res / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * res / 72.0);
if (m_doc->Pages->at(pageIndex)->orientation() == 1)
std::swap(w, h);
 
473,7 → 478,7
args1.append( "-dNOPAUSE" );
args1.append( "-dPARANOIDSAFER" );
args1.append( QString("-r%1").arg(tmp.setNum(res)) );
args1.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(w)), tmp3.setNum(qRound(h))) );
args1.append( QString("-g%1x%2").arg(tmp2.setNum(w), tmp3.setNum(h)) );
if (m_useAntialiasing)
{
args1.append("-dTextAlphaBits=4");
/branches/Version156/Scribus/scribus/sampleitem.cpp
290,12 → 290,17
 
UndoManager::instance()->setUndoEnabled(false); // disable undo
 
int pmWidth = qRound(width * m_devicePixelRatio);
int pmHeight = qRound(height * m_devicePixelRatio);
double frameWidth = width / PrefsManager::instance().appPrefs.displayPrefs.displayScale;
double frameHeight = height / PrefsManager::instance().appPrefs.displayPrefs.displayScale;
 
PageItem_TextFrame *previewItem = new PageItem_TextFrame(m_Doc, 0, 0, frameWidth, frameHeight, 0, "__whiteforpreviewbg__", "__whiteforpreview__");
QImage pm(width, height, QImage::Format_ARGB32);
ScPainter *painter = new ScPainter(&pm, width, height, 1.0, 0);
QImage pm(pmWidth, pmHeight, QImage::Format_ARGB32);
pm.setDevicePixelRatio(m_devicePixelRatio);
 
ScPainter *painter = new ScPainter(&pm, pmWidth, pmHeight, 1.0, 0);
painter->setZoomFactor(PrefsManager::instance().appPrefs.displayPrefs.displayScale);
 
if (m_Doc->UsedFonts.contains(m_tmpStyle.charStyle().font().scName()))
328,5 → 333,7
}
// m_Doc->docParagraphStyles.remove(tmpIndex);
UndoManager::instance()->setUndoEnabled(true);
return QPixmap::fromImage(pm);
 
QPixmap pixmap = QPixmap::fromImage(pm);
return pixmap;
}
/branches/Version156/Scribus/scribus/sampleitem.h
30,6 → 30,9
SampleItem();
~SampleItem();
 
/*! \brief Set device pixel ratio */
void setDevicePixelRatio(double ratio) { m_devicePixelRatio = ratio; }
 
/*! \brief Set sample text.
\param aText QString to set. */
void setText(const QString& aText);
106,6 → 109,8
ScribusDoc *m_Doc;
//! \brief Is the doc created used only? true = used
int m_bgShade;
//! \brief Device pixel ratio
double m_devicePixelRatio { 1.0 };
};
 
#endif
/branches/Version156/Scribus/scribus/scribuscore.cpp
23,10 → 23,12
 
#include <cassert>
#include <iostream>
 
#include <QByteArray>
#include <QDebug>
#include <QGlobalStatic>
#include <QMessageBox>
#include <QScreen>
 
#include "colormgmt/sccolormgmtenginefactory.h"
#include "commonstrings.h"
208,7 → 210,20
m_SplashScreen = nullptr;
if (!showSplash)
return;
 
QScreen* primaryScreeen = qApp->primaryScreen();
double pixelRatio = primaryScreeen ? primaryScreeen->devicePixelRatio() : 1.0;
QPixmap pix = IconManager::instance().loadPixmap("scribus_splash.png", true);
if (pixelRatio != 1.0)
{
int w = qRound(pix.width() * pixelRatio);
int h = qRound(pix.height() * pixelRatio);
double integralPart = 0;
bool isIntegerRatio = (modf(pixelRatio, &integralPart) == 0.0);
pix = pix.scaled(w, h, Qt::IgnoreAspectRatio, isIntegerRatio ? Qt::FastTransformation : Qt::SmoothTransformation);
pix.setDevicePixelRatio(pixelRatio);
}
 
m_SplashScreen = new ScSplashScreen(pix, Qt::WindowStaysOnTopHint);
if (m_SplashScreen != nullptr)
{
/branches/Version156/Scribus/scribus/ui/about.cpp
106,9 → 106,24
tabLayout1 = new QVBoxLayout( tab );
tabLayout1->setSpacing( 6 );
tabLayout1->setMargin( 15 );
 
double pixelRatio = devicePixelRatioF();
QPixmap splashPixmap = IconManager::instance().loadPixmap("scribus_splash.png", true);
double splashPixmapW = splashPixmap.width();
double splashPixmapH = splashPixmap.height();
if (pixelRatio != 1.0)
{
int w = qRound(splashPixmap.width() * pixelRatio);
int h = qRound(splashPixmap.height() * pixelRatio);
double integralPart = 0;
bool isIntegerRatio = (modf(pixelRatio, &integralPart) == 0.0);
splashPixmap = splashPixmap.scaled(w, h, Qt::IgnoreAspectRatio, isIntegerRatio ? Qt::FastTransformation : Qt::SmoothTransformation);
splashPixmap.setDevicePixelRatio(pixelRatio);
}
 
pixmapLabel1 = new QLabel( tab );
pixmapLabel1->setPixmap(IconManager::instance().loadPixmap("scribus_splash.png", true));
pixmapLabel1->setFixedSize(QSize(pixmapLabel1->pixmap()->width(), pixmapLabel1->pixmap()->height()));
pixmapLabel1->setPixmap(splashPixmap);
pixmapLabel1->setFixedSize(QSize(splashPixmapW, splashPixmapH));
pixmapLabel1->setAlignment(Qt::AlignCenter);
tabLayout1->addWidget( pixmapLabel1 );
buildID = new QLabel( tab );
/branches/Version156/Scribus/scribus/ui/arcwidget.cpp
63,20 → 63,29
 
void ArcWidget::updatePreview()
{
QPixmap pm = QPixmap(Preview->width() - 5, Preview->height() - 5);
int arcWidth = Preview->width() - 11;
int arcHeight = Preview->height() - 11;
int pixWidth = Preview->width() - 5;
int pixHeight = Preview->height() - 5;
 
QPixmap pm = QPixmap(pixWidth * devicePixelRatioF(), pixHeight * devicePixelRatioF());
pm.setDevicePixelRatio(devicePixelRatioF());
pm.fill(Qt::white);
 
QPainter p;
p.begin(&pm);
p.setRenderHint(QPainter::Antialiasing, true);
p.setBrush(Qt::NoBrush);
p.setPen(Qt::black);
QPainterPath path;
path.moveTo(pm.width() / 2.0, pm.height() / 2.0);
path.moveTo(pixWidth / 2.0, pixHeight / 2.0);
double nSweep = endAngle->value() - startAngle->value();
if (nSweep < 0)
nSweep += 360;
path.arcTo(3.0, 3.0, pm.width() - 6, pm.height() - 6, startAngle->value(), nSweep);
path.arcTo(3.0, 3.0, arcWidth, arcHeight, startAngle->value(), nSweep);
path.closeSubpath();
p.strokePath(path, p.pen());
p.end();
 
Preview->setPixmap(pm);
}
/branches/Version156/Scribus/scribus/ui/fontcombo.cpp
501,8 → 501,11
 
void FontFamilyDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
{
double pixelRatio = painter->device()->devicePixelRatioF();
int pixmapW = qRound(pixelRatio * option.rect.width());
int pixmapH = qRound(pixelRatio * option.rect.height());
QString text(index.data(Qt::DisplayRole).toString());
QString wh=QString("-w%1h%2").arg(option.rect.width()).arg(option.rect.height());
QString wh = QString("-w%1h%2").arg(pixmapW).arg(pixmapH);
QPixmap cachedPixmap;
QString cacheKey = text + wh;
if (option.state & QStyle::State_Selected)
516,8 → 519,11
QFontDatabase& fontDb = ScQApp->qtFontDatabase();
const ScFace& scFace = getScFace(this->parent()->metaObject()->className(), text);
 
QPixmap pixmap(option.rect.width(), option.rect.height());
QPixmap invPixmap(option.rect.width(), option.rect.height());
QPixmap pixmap(pixmapW, pixmapH);
QPixmap invPixmap(pixmapW, pixmapH);
pixmap.setDevicePixelRatio(pixelRatio);
invPixmap.setDevicePixelRatio(pixelRatio);
 
QPainter pixPainter(&pixmap);
QPainter invpixPainter(&invPixmap);
 
/branches/Version156/Scribus/scribus/ui/outputpreview_pdf.cpp
265,8 → 265,9
QPixmap OutputPreview_PDF::createPreview(int pageIndex, int res)
{
int ret = -1;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int gsRes = qRound(res * devicePixelRatioF());
int w = qRound(m_doc->Pages->at(pageIndex)->width() * gsRes / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * gsRes / 72.0);
 
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
 
284,9 → 285,9
if (optionsHaveChanged(pageIndex))
{
if (m_optionsUi->enableCMYK->isChecked() && m_haveTiffSep)
ret = renderPreviewSep(pageIndex, res);
ret = renderPreviewSep(pageIndex, gsRes);
else
ret = renderPreview(pageIndex, res);
ret = renderPreview(pageIndex, gsRes);
if (ret > 0)
{
imageLoadError(pixmap);
302,8 → 303,8
 
ScImage im;
bool mode;
int w2 = qRound(w);
int h2 = qRound(h);
int w2 = w;
int h2 = h;
image = QImage(w2, h2, QImage::Format_ARGB32);
image.fill(qRgba(0, 0, 0, 0));
499,9 → 500,11
}
}
 
image.setDevicePixelRatio(devicePixelRatioF());
if (m_optionsUi->showTransparency->isChecked())
{
pixmap = QPixmap(image.width(), image.height());
pixmap.setDevicePixelRatio(devicePixelRatioF());
QPainter p;
QBrush b(QColor(205,205,205), IconManager::instance().loadPixmap("testfill.png"));
p.begin(&pixmap);
511,6 → 514,7
}
else
pixmap = QPixmap::fromImage(image);
pixmap.setDevicePixelRatio(devicePixelRatioF());
 
qApp->restoreOverrideCursor();
updateOptionsFromUI();
576,13 → 580,14
 
QStringList args;
QString tmp, tmp2, tmp3;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int w = qRound(m_doc->Pages->at(pageIndex)->width() * res / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * res / 72.0);
args.append( "-q" );
args.append( "-dNOPAUSE" );
args.append( "-dPARANOIDSAFER" );
args.append( QString("-r%1").arg(tmp.setNum(res)) );
args.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(w)), tmp3.setNum(qRound(h))) );
args.append( QString("-g%1x%2").arg(tmp2.setNum(w), tmp3.setNum(h)) );
if (m_optionsUi->enableCMYK->isChecked())
{
if (!m_haveTiffSep)
653,14 → 658,14
QStringList args, args1, args2, args3;
 
QString tmp, tmp2, tmp3;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int w = qRound(m_doc->Pages->at(pageIndex)->width() * res / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * res / 72.0);
 
args1.append( "-q" );
args1.append( "-dNOPAUSE" );
args1.append( "-dPARANOIDSAFER" );
args1.append( QString("-r%1").arg(tmp.setNum(res)) );
args1.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(w)), tmp3.setNum(qRound(h))) );
args1.append( QString("-g%1x%2").arg(tmp2.setNum(w), tmp3.setNum(h)) );
if (m_optionsUi->antiAliasing->isChecked())
{
args1.append("-dTextAlphaBits=4");
884,7 → 889,7
{
if (m_currentPage != pageIndex)
return true;
if (m_scaleFactor != m_uiBase->scaleBox->currentIndex())
if (m_scaleMode != m_uiBase->scaleBox->currentIndex())
return true;
if (m_cmykPreviewMode != m_optionsUi->enableCMYK->isChecked())
return true;
1050,7 → 1055,7
m_convertSpots = m_optionsUi->convertSpots->isChecked();
 
m_currentPage = m_uiBase->pageSelector->getCurrentPage() - 1;
m_scaleFactor = m_uiBase->scaleBox->currentIndex();
m_scaleMode = m_uiBase->scaleBox->currentIndex();
m_cmykPreviewMode = m_optionsUi->enableCMYK->isChecked();
m_useAntialiasing = m_optionsUi->antiAliasing->isChecked();
m_showTransparency = m_optionsUi->showTransparency->isChecked();
/branches/Version156/Scribus/scribus/ui/outputpreview_ps.cpp
292,8 → 292,9
QPixmap OutputPreview_PS::createPreview(int pageIndex, int res)
{
int ret = -1;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int gsRes = qRound(res * devicePixelRatioF());
int w = qRound(m_doc->Pages->at(pageIndex)->width() * gsRes / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * gsRes / 72.0);
 
qApp->setOverrideCursor(QCursor(Qt::WaitCursor));
 
311,9 → 312,9
if (optionsHaveChanged(pageIndex))
{
if (m_optionsUi->enableCMYK->isChecked() && m_haveTiffSep)
ret = renderPreviewSep(pageIndex, res);
ret = renderPreviewSep(pageIndex, gsRes);
else
ret = renderPreview(pageIndex, res);
ret = renderPreview(pageIndex, gsRes);
if (ret > 0)
{
imageLoadError(pixmap);
329,8 → 330,8
 
ScImage im;
bool mode;
int w2 = qRound(w);
int h2 = qRound(h);
int w2 = w;
int h2 = h;
if (m_doc->Pages->at(pageIndex)->orientation() == 1)
std::swap(w2, h2);
image = QImage(w2, h2, QImage::Format_ARGB32);
531,9 → 532,12
const ScPage* page = m_doc->Pages->at(pageIndex);
if ((page->orientation() == 1) && (image.width() < image.height()))
image = image.transformed( QMatrix(0, 1, -1, 0, 0, 0) );
 
image.setDevicePixelRatio(devicePixelRatioF());
if (m_optionsUi->showTransparency->isChecked())
{
pixmap = QPixmap(image.width(), image.height());
pixmap.setDevicePixelRatio(devicePixelRatioF());
QPainter p;
QBrush b(QColor(205,205,205), IconManager::instance().loadPixmap("testfill.png"));
p.begin(&pixmap);
543,6 → 547,7
}
else
pixmap = QPixmap::fromImage(image);
pixmap.setDevicePixelRatio(devicePixelRatioF());
 
qApp->restoreOverrideCursor();
updateOptionsFromUI();
609,8 → 614,8
 
QStringList args;
QString tmp, tmp2, tmp3;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int w = qRound(m_doc->Pages->at(pageIndex)->width() * res / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * res / 72.0);
if (m_doc->Pages->at(pageIndex)->orientation() == 1)
std::swap(w, h);
 
618,7 → 623,7
args.append( "-dNOPAUSE" );
args.append( "-dPARANOIDSAFER" );
args.append( QString("-r%1").arg(tmp.setNum(res)) );
args.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(w)), tmp3.setNum(qRound(h))) );
args.append( QString("-g%1x%2").arg(tmp2.setNum(w), tmp3.setNum(h)) );
if (m_optionsUi->enableCMYK->isChecked())
{
if (!m_haveTiffSep)
689,8 → 694,8
QStringList args, args1, args2, args3;
 
QString tmp, tmp2, tmp3;
double w = m_doc->Pages->at(pageIndex)->width() * res / 72.0;
double h = m_doc->Pages->at(pageIndex)->height() * res / 72.0;
int w = qRound(m_doc->Pages->at(pageIndex)->width() * res / 72.0);
int h = qRound(m_doc->Pages->at(pageIndex)->height() * res / 72.0);
if (m_doc->Pages->at(pageIndex)->orientation() == 1)
std::swap(w, h);
 
698,7 → 703,7
args1.append( "-dNOPAUSE" );
args1.append( "-dPARANOIDSAFER" );
args1.append( QString("-r%1").arg(tmp.setNum(res)) );
args1.append( QString("-g%1x%2").arg(tmp2.setNum(qRound(w)), tmp3.setNum(qRound(h))) );
args1.append( QString("-g%1x%2").arg(tmp2.setNum(w), tmp3.setNum(h)) );
if (m_optionsUi->antiAliasing->isChecked())
{
args1.append("-dTextAlphaBits=4");
821,7 → 826,7
{
if (m_currentPage != pageIndex)
return true;
if (m_scaleFactor != m_uiBase->scaleBox->currentIndex())
if (m_scaleMode != m_uiBase->scaleBox->currentIndex())
return true;
if (m_cmykPreviewMode != m_optionsUi->enableCMYK->isChecked())
return true;
930,7 → 935,7
m_enableGCR = m_optionsUi->enableGCR->isChecked();
 
m_currentPage = m_uiBase->pageSelector->getCurrentPage() - 1;
m_scaleFactor = m_uiBase->scaleBox->currentIndex();
m_scaleMode = m_uiBase->scaleBox->currentIndex();
m_cmykPreviewMode = m_optionsUi->enableCMYK->isChecked();
m_useAntialiasing = m_optionsUi->antiAliasing->isChecked();
m_showTransparency = m_optionsUi->showTransparency->isChecked();
/branches/Version156/Scribus/scribus/ui/polygonwidget.cpp
209,13 → 209,22
}
double roundness = curvatureSpinBox->value() / 100.0;
double innerround = outerCurvatureSpinBox->value() / 100.0;
QPixmap pm = QPixmap(Preview->width() - 5, Preview->height() - 5);
 
int polyWidth = Preview->width() - 6;
int polyHeight = Preview->height() - 6;
int pixWidth = (Preview->width() - 5) * devicePixelRatioF();
int pixHeight = (Preview->height() - 5) * devicePixelRatioF();
 
QPixmap pm(pixWidth, pixHeight);
pm.setDevicePixelRatio(devicePixelRatioF());
pm.fill(Qt::white);
 
QPainter p;
p.begin(&pm);
p.setRenderHint(QPainter::Antialiasing, true);
p.setBrush(Qt::NoBrush);
p.setPen(Qt::black);
QPainterPath pp = regularPolygonPath(Preview->width() - 6, Preview->height() - 6, cornersSpinBox->value(), applyConvexGroupBox->isChecked(), GetFactor(), rotationSlider->value(), roundness, innerRotationSpinBox->value(), innerround);
QPainterPath pp = regularPolygonPath(polyWidth, polyHeight, cornersSpinBox->value(), applyConvexGroupBox->isChecked(), GetFactor(), rotationSlider->value(), roundness, innerRotationSpinBox->value(), innerround);
QRectF br = pp.boundingRect();
if (br.x() < 0)
{
230,15 → 239,16
pp = pp * m;
}
br = pp.boundingRect();
if ((br.height() > Preview->height() - 6) || (br.width() > Preview->width() - 6))
if ((br.height() > polyHeight) || (br.width() > polyWidth))
{
QTransform ma;
double sca = static_cast<double>(qMax(Preview->height() - 6, Preview->width() - 6)) / static_cast<double>(qMax(br.width(), br.height()));
double sca = static_cast<double>(qMax(polyHeight, polyWidth)) / static_cast<double>(qMax(br.width(), br.height()));
ma.scale(sca, sca);
pp = pp * ma;
}
p.strokePath(pp, p.pen());
p.end();
 
Preview->setPixmap(pm);
}
 
/branches/Version156/Scribus/scribus/ui/prefs_itemtools.cpp
371,6 → 371,7
return;
 
SampleItem si;
si.setDevicePixelRatio(devicePixelRatioF());
si.setText( tr("Woven silk pyjamas exchanged for blue quartz"));
if (textFrameFillColorComboBox->currentText() != CommonStrings::tr_NoneColor)
{
380,8 → 381,8
}
else
{
PrefsManager& prefsManager=PrefsManager::instance();
ColorList* colorList=prefsManager.colorSetPtr();
PrefsManager& prefsManager = PrefsManager::instance();
ColorList* colorList = prefsManager.colorSetPtr();
si.setBgColor((*colorList)[textFrameFillColorComboBox->currentText()].getRawRGBColor());
}
si.setBgShade(textFrameFillShadingSpinBox->value());
397,8 → 398,8
}
else
{
PrefsManager& prefsManager=PrefsManager::instance();
ColorList* colorList=prefsManager.colorSetPtr();
PrefsManager& prefsManager = PrefsManager::instance();
ColorList* colorList = prefsManager.colorSetPtr();
si.setTxColor((*colorList)[textColorComboBox->currentText()].getRawRGBColor());
}
si.setTxShade(textColorShadingSpinBox->value());
/branches/Version156/Scribus/scribus/ui/printpreview.cpp
97,6 → 97,7
m_ui->printLanguageCombo->setCurrentLanguage(engine);
 
m_previewCreator = PrintPreviewCreatorFactory::create(docu, m_ui->printLanguageCombo->currentLanguage());
m_previewCreator->setDevicePixelRatio(devicePixelRatioF());
 
m_useGhostscript = m_previewCreator->isGhostscriptBased();
m_haveTiffSep = ScCore->haveTIFFSep() && (m_ui->printLanguageCombo->hasPDF() || m_ui->printLanguageCombo->hasPostscript());
431,6 → 432,8
m_previewCreator = PrintPreviewCreatorFactory::create(m_doc, newPrnLanguage);
m_useGhostscript = m_previewCreator->isGhostscriptBased();
 
m_previewCreator->setDevicePixelRatio(devicePixelRatioF());
 
m_ui->antiAliasing->setEnabled(m_useGhostscript);
m_ui->showTransparency->setEnabled(m_useGhostscript);
 
534,6 → 537,7
m_previewCreator->setPrintOptions(options);
}
 
m_previewCreator->setDevicePixelRatio(devicePixelRatioF());
m_previewCreator->setPreviewResolution(res);
m_previewCreator->setAntialisingEnabled(m_ui->antiAliasing->isChecked());
m_previewCreator->setShowTransparency(m_ui->showTransparency->isChecked());
/branches/Version156/Scribus/scribus/ui/spiralwidget.cpp
67,15 → 67,25
{
startAngle->setMaximum(endAngle->value() - 1);
endAngle->setMinimum(startAngle->value() + 1);
QPixmap pm = QPixmap(Preview->width() - 5, Preview->height() - 5);
int spiralWidth = Preview->width() - 11;
int spiralHeight = Preview->height() - 11;
int pixWidth = (Preview->width() - 5) * devicePixelRatioF();
int pixHeight = (Preview->height() - 5) * devicePixelRatioF();
 
QPixmap pm(pixWidth, pixHeight);
pm.setDevicePixelRatio(devicePixelRatioF());
pm.fill(Qt::white);
 
QPainter p;
p.begin(&pm);
p.setRenderHint(QPainter::Antialiasing, true);
p.setBrush(Qt::NoBrush);
p.setPen(Qt::black);
QPainterPath path = spiralPath(pm.width() - 6, pm.height() - 6, startAngle->value(), endAngle->value(), (static_cast<int>(arcFactor->value()) + 100) / 100.0);
QPainterPath path = spiralPath(spiralWidth, spiralHeight, startAngle->value(), endAngle->value(), (static_cast<int>(arcFactor->value()) + 100) / 100.0);
path.translate(3, 3);
p.strokePath(path, p.pen());
p.end();
 
Preview->setPixmap(pm);
}