r21641 by jghali - exit early in baseline grid drawing functions when possible

scribus-commit scribus-commit at lists.scribus.net
Sun Dec 11 20:08:35 UTC 2016


Author: jghali
Date: Sun Dec 11 20:08:35 2016
New Revision: 21641

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=21641
Log:
exit early in baseline grid drawing functions when possible

Modified:
    trunk/Scribus/scribus/canvas.cpp

Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=21641&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp	(original)
+++ trunk/Scribus/scribus/canvas.cpp	Sun Dec 11 20:08:35 2016
@@ -1871,6 +1871,9 @@
  */
 void Canvas::DrawPageBaselineGridSub(ScPainter *p, ScPage *page)
 {
+	if (!m_doc->guidesPrefs().baselineGridShown)
+		return;
+
 	p->save();
 	p->setAntialiasing(false);
 	p->translate(page->xOffset(), page->yOffset());
@@ -1879,19 +1882,18 @@
 	double pageWidth = page->width();
 	p->setFillMode(ScPainter::None);
 	p->setStrokeMode(ScPainter::Solid);
-	p->setPen(Qt::black, lineWidth, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-	if (m_doc->guidesPrefs().baselineGridShown)
-	{
-		p->setPen(m_doc->guidesPrefs().baselineGridColor, lineWidth, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
-		for (double yg = m_doc->guidesPrefs().offsetBaselineGrid; yg < pageHeight; yg += m_doc->guidesPrefs().valueBaselineGrid)
-			p->drawLine(FPoint(0, yg), FPoint(pageWidth, yg));
-	}
+	p->setPen(m_doc->guidesPrefs().baselineGridColor, lineWidth, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+	for (double yg = m_doc->guidesPrefs().offsetBaselineGrid; yg < pageHeight; yg += m_doc->guidesPrefs().valueBaselineGrid)
+		p->drawLine(FPoint(0, yg), FPoint(pageWidth, yg));
 	p->setAntialiasing(true);
 	p->restore();
 }
 
 void Canvas::DrawPageBaselineGrid(ScPainter *p, QRectF clip, bool master)
 {
+	if (!m_doc->guidesPrefs().baselineGridShown)
+		return;
+
 	if (master)
 	{
 		ScPage *page = m_doc->currentPage();




More information about the scribus-commit mailing list