mirror of https://github.com/KLayout/klayout.git
Cross size in marked mode now scales with resolution
This commit is contained in:
parent
914ad98858
commit
3b6ef57ddc
|
|
@ -311,15 +311,22 @@ render_scanline_cross (const uint32_t *dp, unsigned int ds, const lay::Bitmap *p
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pixels > 15) {
|
// NOTE: hardcoded bar/width ratio for crosses.
|
||||||
pixels = 15;
|
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;
|
const uint32_t *dm = dp;
|
||||||
unsigned int px1 = (pixels - 1) / 2;
|
unsigned int px1 = (pixels - 1) / 2;
|
||||||
unsigned int px2 = (pixels - 1) - px1;
|
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) {
|
for (unsigned int p = 0; p < pixels; ++p) {
|
||||||
if (y + p < px1) {
|
if (y + p < px1) {
|
||||||
ps[p] = pbitmap->scanline (0);
|
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;
|
uint32_t *dpp = data;
|
||||||
dn = *(ps[px1]++);
|
for (unsigned int i = (w + lay::wordlen - 1) / lay::wordlen; i > 0; --i) {
|
||||||
|
*dpp++ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned int x = w;
|
for (unsigned int o = 0; o < pixels; ++o) {
|
||||||
while (true) {
|
|
||||||
|
|
||||||
d = dn;
|
dpp = data;
|
||||||
|
|
||||||
dn = 0;
|
unsigned int bpx1 = 0, bpx2 = 0;
|
||||||
if (x > lay::wordlen) {
|
if (o >= px1 - spx1 && o <= px1 + spx2) {
|
||||||
dn = *(ps[px1]++);
|
bpx1 = px1;
|
||||||
}
|
bpx2 = px2;
|
||||||
|
|
||||||
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;
|
|
||||||
} else {
|
} 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1692,7 +1692,7 @@ LayoutViewBase::icon_for_layer (const LayerPropertiesConstIterator &iter, unsign
|
||||||
// create text
|
// create text
|
||||||
single_bitmap_to_image (lay::ViewOp (frame_color, mode, 0, 0, 0), text, &image, dither_pattern (), line_styles (), dpr_drawing, w, h);
|
single_bitmap_to_image (lay::ViewOp (frame_color, mode, 0, 0, 0), text, &image, dither_pattern (), line_styles (), dpr_drawing, w, h);
|
||||||
// create vertex
|
// 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) {
|
if (oversampling > 1) {
|
||||||
tl::PixelBuffer subsampled (image.width () / oversampling, image.height () / oversampling);
|
tl::PixelBuffer subsampled (image.width () / oversampling, image.height () / oversampling);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue