From fc486062d83ec04098223bea9d71733d1f4409c6 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Feb 2019 10:23:47 +0100 Subject: [PATCH 1/2] Fixed issue-234 by enhancing the drawing algorithm. --- src/laybasic/laybasic/layGridNet.cc | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/laybasic/laybasic/layGridNet.cc b/src/laybasic/laybasic/layGridNet.cc index 97e76d75f..5f45f0128 100644 --- a/src/laybasic/laybasic/layGridNet.cc +++ b/src/laybasic/laybasic/layGridNet.cc @@ -350,8 +350,8 @@ public: continue; } - const uint32_t *dc = ff.data () + size_t (ch - ff.first_char ()) * ff.height (); - for (unsigned int i = 0; i < ff.height (); ++i, ++dc) { + const uint32_t *dc = ff.data () + size_t (ch - ff.first_char ()) * ff.height () * ff.stride (); + for (unsigned int i = 0; i < ff.height (); ++i, dc += ff.stride ()) { int iy = y - ff.height () + i + 1; if (iy >= 0 || iy < mp_img->height ()) { @@ -359,10 +359,21 @@ public: uint32_t *d = (uint32_t *) mp_img->scanLine (y - ff.height () + i); uint32_t m = 1; int ix = x; - for (unsigned int j = 0; j < ff.width (); ++j, m <<= 1, ++ix) { - if (*dc & m && ix >= 0 && ix < mp_img->width ()) { + const uint32_t *ds = dc; + + for (unsigned int j = 0; j < ff.width (); ++j, ++ix) { + + if ((*ds & m) && ix >= 0 && ix < mp_img->width ()) { d[ix] = c.rgb (); } + + m <<= 1; + // word wrap + if (m == 0) { + ++ds; + m = 1; + } + } } From 60a2ce60377c71cda5114e95593088b26872b93b Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sat, 23 Feb 2019 18:13:49 +0100 Subject: [PATCH 2/2] Another fix for issue-234: linewidth parameter of save_image_with_options did not have any effect. --- src/lay/lay/layMainWindow.cc | 2 +- src/laybasic/laybasic/layLayoutCanvas.cc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/lay/lay/layMainWindow.cc b/src/lay/lay/layMainWindow.cc index 383a48d5b..3a0c96d9c 100644 --- a/src/lay/lay/layMainWindow.cc +++ b/src/lay/lay/layMainWindow.cc @@ -2066,7 +2066,7 @@ MainWindow::cm_print () text_rect.setBottom (text_rect.bottom () - hh / 2); text_rect.setTop (text_rect.top () + hh / 2); - QImage img = current_view ()->get_image_with_options (page_rect.width (), page_rect.height () - 4 * hh, 2, 1, 1.0 / 3.0, Qt::white, Qt::black, Qt::black, db::DBox (), false); + QImage img = current_view ()->get_image_with_options (page_rect.width (), page_rect.height () - 4 * hh, 1, 1, 1.0 / 3.0, Qt::white, Qt::black, Qt::black, db::DBox (), false); painter.drawImage (QPoint (page_rect.left (), page_rect.top () + hh * 2), img); painter.setFont (header_font); diff --git a/src/laybasic/laybasic/layLayoutCanvas.cc b/src/laybasic/laybasic/layLayoutCanvas.cc index 6c86e300c..ace668031 100644 --- a/src/laybasic/laybasic/layLayoutCanvas.cc +++ b/src/laybasic/laybasic/layLayoutCanvas.cc @@ -844,7 +844,7 @@ LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int l do_render_bg (vp, vo_canvas); // paint the layout bitmaps - rd_canvas.to_image (m_view_ops, dither_pattern (), line_styles (), background, foreground, active, this, vo_canvas.bg_image (), vp.width (), vp.height ()); + rd_canvas.to_image (view_ops, dither_pattern (), line_styles (), background, foreground, active, this, vo_canvas.bg_image (), vp.width (), vp.height ()); // subsample current image to provide the background for the foreground objects vo_canvas.make_background (); @@ -860,7 +860,7 @@ LayoutCanvas::image_with_options (unsigned int width, unsigned int height, int l // TODO: Painting of background objects??? // paint the layout bitmaps - rd_canvas.to_image (m_view_ops, dither_pattern (), line_styles (), background, foreground, active, this, vo_canvas.bg_image (), vp.width (), vp.height ()); + rd_canvas.to_image (view_ops, dither_pattern (), line_styles (), background, foreground, active, this, vo_canvas.bg_image (), vp.width (), vp.height ()); }