Commit a0bd9c4d authored by Oliver Sander's avatar Oliver Sander Committed by Albert Astals Cid

Make the page outline one physical pixel wide

Pages get a black rectangle around them as 'outline' after
being rendered.  This rendering was not pixel-perfect at
fractional scalings: apparently, fractional line widths and
positions get rounded differently.  The result was that
sometimes there was a small gap between outline and page.

This pages fixes the problem by making the pen for the
outline 'cosmetic', i.e., one physical pixel wide.
With that, its position can be such that it encloses
the page without any gap.
parent 9b34bfb4
......@@ -3569,8 +3569,13 @@ void PageView::drawDocumentOnPainter( const QRect & contentsRect, QPainter * p )
int itemWidth = itemGeometry.width();
int itemHeight = itemGeometry.height();
// draw simple outline
p->setPen( Qt::black );
p->drawRect( -1, -1, itemWidth + 1, itemHeight + 1 );
QPen pen( Qt::black );
p->setPen( pen );
QRectF outline( -1.0/dpr, -1.0/dpr, itemWidth + 1.0/dpr, itemHeight + 1.0/dpr );
p->drawRect( outline );
// draw bottom/right gradient
static const int levels = 2;
int r = / (levels + 2) + 6,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment