r23988 by jghali - #16198: Remove rulers' OPTION_SMOOTH_MARKERS code
scribus-commit
scribus-commit at lists.scribus.net
Wed Aug 19 19:25:54 UTC 2020
Author: jghali
Date: Wed Aug 19 19:25:53 2020
New Revision: 23988
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23988
Log:
#16198: Remove rulers' OPTION_SMOOTH_MARKERS code
Modified:
trunk/Scribus/scribus/ui/hruler.cpp
trunk/Scribus/scribus/ui/vruler.cpp
Modified: trunk/Scribus/scribus/ui/hruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23988&path=/trunk/Scribus/scribus/ui/hruler.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/hruler.cpp (original)
+++ trunk/Scribus/scribus/ui/hruler.cpp Wed Aug 19 19:25:53 2020
@@ -589,54 +589,14 @@
void Hruler::drawMarker(QPainter& p)
{
+ // draw slim marker
QPolygon cr;
-#ifdef OPTION_SMOOTH_MARKERS
- // draw new marker to pixmap
- static const int SCALE = 16;
- static const QColor BACKGROUND(255, 255, 255);
- static QPixmap pix( 4*SCALE, 16*SCALE );
- static bool initpix = true;
- if (initpix)
- {
- initpix = false;
- QPainter pp( &pix );
- pp.setBrush( BACKGROUND );
- pp.drawRect( 0, 0, 4*SCALE, 16*SCALE );
-
- pp.setPen(Qt::red);
- pp.setBrush(Qt::red);
- cr.setPoints(3, 2*SCALE, 16*SCALE, 4*SCALE, 0, 0, 0);
- pp.drawPolygon(cr);
- }
- // draw pixmap
- p.save();
- p.translate(-m_view->contentsX(), 0);
- p.scale(1.0 / SCALE, 1.0 / (SCALE + 1));
- p.drawPixmap((m_whereToDraw - 2) * SCALE, 1, pix);
- p.restore();
- // restore marks
- const QPalette& palette = this->palette();
- const QColor& textColor = palette.color(QPalette::Text);
- p.setBrush(textColor);
- p.setPen(textColor);
- p.setFont(font());
- double sc = m_view->scale();
- double cc = width() / sc;
- double firstMark = ceil(m_offset / m_iter) * m_iter - m_offset;
- while (firstMark < cc)
- {
- p.drawLine(qRound(firstMark * sc), 10, qRound(firstMark * sc), 16);
- firstMark += m_iter;
- }
-#else
- // draw slim marker
p.resetTransform();
p.translate(-m_view->contentsX(), 0);
p.setPen(Qt::red);
p.setBrush(Qt::red);
- cr.setPoints(5, m_whereToDraw, 5, m_whereToDraw, 16, m_whereToDraw, 5, m_whereToDraw + 2, 0, m_whereToDraw-2, 0);
+ cr.setPoints(5, m_whereToDraw, 5, m_whereToDraw, 16, m_whereToDraw, 5, m_whereToDraw + 2, 0, m_whereToDraw - 2, 0);
p.drawPolygon(cr);
-#endif
}
Modified: trunk/Scribus/scribus/ui/vruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23988&path=/trunk/Scribus/scribus/ui/vruler.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/vruler.cpp (original)
+++ trunk/Scribus/scribus/ui/vruler.cpp Wed Aug 19 19:25:53 2020
@@ -150,51 +150,13 @@
p.restore();
if (m_drawMark)
{
+ // draw slim marker
QPolygon cr;
-#ifdef OPTION_SMOOTH_MARKERS
- // draw new marker to pixmap
- static const int SCALE = 16;
- static const QColor BACKGROUND(255, 255, 255);
- static QPixmap pix( 16*SCALE, 4*SCALE );
- static bool initpix = true;
- if (initpix)
- {
- initpix = false;
- QPainter pp( &pix );
- pp.setBrush( BACKGROUND );
- pp.drawRect( 0, 0, 16*SCALE, 4*SCALE );
-
- pp.setPen(Qt::red);
- pp.setBrush(Qt::red);
- cr.setPoints(3, 16*SCALE, 2*SCALE, 0, 4*SCALE, 0, 0);
- pp.drawPolygon(cr);
- }
- // draw pixmap
- p.save();
- p.translate(0, -m_view->contentsY());
- p.scale(1.0 / (SCALE + 1), 1.0 / SCALE);
- p.drawPixmap(0, (m_whereToDraw - 2) * SCALE, pix);
- p.restore();
- // repaint marks
- p.setBrush(textColor);
- p.setPen(textColor);
- p.setFont(font());
- double sc = m_view->scale();
- double cc = height() / sc;
- double firstMark = ceil(m_offset / m_iter) * m_iter - m_offset;
- while (firstMark < cc)
- {
- p.drawLine(10, qRound(firstMark * sc), 16, qRound(firstMark * sc));
- firstMark += m_iter;
- }
-#else
- // draw slim marker
p.translate(0, -m_view->contentsY());
p.setPen(Qt::red);
p.setBrush(Qt::red);
cr.setPoints(5, 5, m_whereToDraw, 16, m_whereToDraw, 5, m_whereToDraw, 0, m_whereToDraw + 2, 0, m_whereToDraw - 2);
p.drawPolygon(cr);
-#endif
}
p.end();
}
More information about the scribus-commit
mailing list