diff --git a/src/laybasic/laybasic/layBitmapsToImage.cc b/src/laybasic/laybasic/layBitmapsToImage.cc index 17e062233..b4cc038f1 100644 --- a/src/laybasic/laybasic/layBitmapsToImage.cc +++ b/src/laybasic/laybasic/layBitmapsToImage.cc @@ -311,15 +311,22 @@ render_scanline_cross (const uint32_t *dp, unsigned int ds, const lay::Bitmap *p return; } - if (pixels > 15) { - pixels = 15; + // NOTE: hardcoded bar/width ratio for crosses. + unsigned int lw = std::min ((unsigned int) 6, pixels / 9); + + const int max_pixels = 31; + if (pixels > max_pixels) { + pixels = max_pixels; } const uint32_t *dm = dp; unsigned int px1 = (pixels - 1) / 2; unsigned int px2 = (pixels - 1) - px1; - const uint32_t *ps[16]; + unsigned int spx1 = (lw - 1) / 2; + unsigned int spx2 = (lw - 1) - spx1; + + const uint32_t *ps[max_pixels + 1]; for (unsigned int p = 0; p < pixels; ++p) { if (y + p < px1) { ps[p] = pbitmap->scanline (0); @@ -330,56 +337,94 @@ render_scanline_cross (const uint32_t *dp, unsigned int ds, const lay::Bitmap *p } } - uint32_t d, dd = 0, dn; - dn = *(ps[px1]++); + uint32_t *dpp = data; + for (unsigned int i = (w + lay::wordlen - 1) / lay::wordlen; i > 0; --i) { + *dpp++ = 0; + } - unsigned int x = w; - while (true) { + for (unsigned int o = 0; o < pixels; ++o) { - d = dn; + dpp = data; - dn = 0; - if (x > lay::wordlen) { - dn = *(ps[px1]++); - } - - uint32_t d0 = d; - if (d0 != 0) { - for (unsigned int p = 1; p <= px1; ++p) { - d |= (d0 >> p); - } - for (unsigned int p = 1; p <= px2; ++p) { - d |= (d0 << p); - } - } - if (dn != 0) { - for (unsigned int p = 1; p <= px1; ++p) { - d |= (dn << (32 - p)); - } - } - if (dd != 0) { - for (unsigned int p = 1; p <= px2; ++p) { - d |= (dd >> (32 - p)); - } - } - for (unsigned int p = 0; p < px1; ++p) { - d |= *(ps[p]++); - } - for (unsigned int p = px1 + 1; p < pixels; ++p) { - d |= *(ps[p]++); - } - - dd = d0; - - *data++ = d & *dm++; - if (dm == dp + ds) { - dm = dp; - } - - if (x > lay::wordlen) { - x -= lay::wordlen; + unsigned int bpx1 = 0, bpx2 = 0; + if (o >= px1 - spx1 && o <= px1 + spx2) { + bpx1 = px1; + bpx2 = px2; } else { - break; + bpx1 = spx1; + bpx2 = spx2; + } + + if (bpx1 > 0 || bpx2 > 0) { + + uint32_t d, dd = 0, dn; + dn = *(ps[o]++); + + unsigned int x = w; + while (true) { + + d = dn; + + dn = 0; + if (x > lay::wordlen) { + dn = *(ps[o]++); + } + + uint32_t d0 = d; + if (d0 != 0) { + for (unsigned int p = 1; p <= bpx1; ++p) { + d |= (d0 >> p); + } + for (unsigned int p = 1; p <= bpx2; ++p) { + d |= (d0 << p); + } + } + if (dn != 0) { + for (unsigned int p = 1; p <= bpx1; ++p) { + d |= (dn << (32 - p)); + } + } + if (dd != 0) { + for (unsigned int p = 1; p <= bpx2; ++p) { + d |= (dd >> (32 - p)); + } + } + + dd = d0; + + *dpp++ |= d & *dm++; + if (dm == dp + ds) { + dm = dp; + } + + if (x > lay::wordlen) { + x -= lay::wordlen; + } else { + break; + } + + } + + } else { + + unsigned int x = w; + while (true) { + + uint32_t d = *(ps[o]++); + + *dpp++ |= d & *dm++; + if (dm == dp + ds) { + dm = dp; + } + + if (x > lay::wordlen) { + x -= lay::wordlen; + } else { + break; + } + + } + } } diff --git a/src/laybasic/laybasic/layLayoutViewBase.cc b/src/laybasic/laybasic/layLayoutViewBase.cc index dc176a9e5..b6051a571 100644 --- a/src/laybasic/laybasic/layLayoutViewBase.cc +++ b/src/laybasic/laybasic/layLayoutViewBase.cc @@ -1692,7 +1692,7 @@ LayoutViewBase::icon_for_layer (const LayerPropertiesConstIterator &iter, unsign // create text single_bitmap_to_image (lay::ViewOp (frame_color, mode, 0, 0, 0), text, &image, dither_pattern (), line_styles (), dpr_drawing, w, h); // create vertex - single_bitmap_to_image (lay::ViewOp (frame_color, mode, 0, 0, 0, lay::ViewOp::Cross, iter->marked (true) ? 9/*mark size*/ : 0), vertex, &image, dither_pattern (), line_styles (), dpr_drawing, w, h); + single_bitmap_to_image (lay::ViewOp (frame_color, mode, 0, 0, 0, lay::ViewOp::Cross, iter->marked (true) ? int (9 * dpr_drawing + 0.5) : 0), vertex, &image, dither_pattern (), line_styles (), dpr_drawing, w, h); if (oversampling > 1) { tl::PixelBuffer subsampled (image.width () / oversampling, image.height () / oversampling);