Fixed painting of rulers and grids in the presence of oversampling. Now the ruler/grid do not change with oversampling. (#1007)

This commit is contained in:
Matthias Köfferlein 2022-02-13 10:06:01 +01:00 committed by GitHub
parent b3d17cff97
commit 72bf152735
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -473,7 +473,7 @@ GridNet::render_bg (const lay::Viewport &vp, ViewObjectCanvas &canvas)
// compute major grid and switch to secondary style if necessary
int s = 0;
while (dgrid < fw * 4 / bmp_canvas->resolution ()) {
while (dgrid < fw * 4) {
if (s == 0) {
dgrid *= 2.0;
} else if (s == 1) {
@ -502,9 +502,9 @@ GridNet::render_bg (const lay::Viewport &vp, ViewObjectCanvas &canvas)
if (m_show_ruler && dgrid < vp.width () * 0.2) {
int rh = int (floor (0.5 + fw * 0.8 / bmp_canvas->resolution ()));
int xoffset = int (floor (0.5 + fw * 2.5 / bmp_canvas->resolution ()));
int yoffset = int (floor (0.5 + fw * 2.5 / bmp_canvas->resolution ()));
int rh = int (floor (0.5 + fw * 0.8));
int xoffset = int (floor (0.5 + fw * 2.5));
int yoffset = int (floor (0.5 + fw * 2.5));
painter.fill_rect (QPoint (xoffset, vp.height () - yoffset - rh / 2),
QPoint (xoffset + int (floor (0.5 + dgrid)), vp.height () - yoffset + rh / 2),