+2012-12-01 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
+
+ * xterm.c (x_draw_relief_rect, x_draw_image_relief): Fix relief
+ display for sliced images (Bug#10500).
+
+ * w32term.c (w32_draw_relief_rect, x_draw_image_relief): Likewise.
+
2012-11-30 Juanma Barranquero <lekktu@gmail.com>
* doc.c (Fdocumentation): Re-add handling of function-documentation,
if (left_p)
for (i = 0; i < width; ++i)
w32_fill_area (f, hdc, gc.foreground,
- left_x + i, top_y + i, 1,
- bottom_y - top_y - 2 * i + 1);
+ left_x + i, top_y + (i + 1) * top_p, 1,
+ bottom_y - top_y - (i + 1) * (bot_p + top_p) + 1);
if (raised_p)
gc.foreground = f->output_data.w32->black_relief.gc->foreground;
if (right_p)
for (i = 0; i < width; ++i)
w32_fill_area (f, hdc, gc.foreground,
- right_x - i, top_y + i + 1, 1,
- bottom_y - top_y - 2 * i - 1);
+ right_x - i, top_y + (i + 1) * top_p, 1,
+ bottom_y - top_y - (i + 1) * (bot_p + top_p) + 1);
w32_set_clip_rectangle (hdc, NULL);
static void
x_draw_image_relief (struct glyph_string *s)
{
- int x0, y0, x1, y1, thick, raised_p;
+ int x1, y1, thick, raised_p, top_p, bot_p, left_p, right_p;
RECT r;
int x = s->x;
int y = s->ybase - image_ascent (s->img, s->face, &s->slice);
raised_p = s->img->relief > 0;
}
- x0 = x - thick;
- y0 = y - thick;
- x1 = x + s->slice.width + thick - 1;
- y1 = y + s->slice.height + thick - 1;
+ x1 = x + s->slice.width - 1;
+ y1 = y + s->slice.height - 1;
+ top_p = bot_p = left_p = right_p = 0;
+
+ if (s->slice.x == 0)
+ x -= thick, left_p = 1;
+ if (s->slice.y == 0)
+ y -= thick, top_p = 1;
+ if (s->slice.x + s->slice.width == s->img->width)
+ x1 += thick, right_p = 1;
+ if (s->slice.y + s->slice.height == s->img->height)
+ y1 += thick, bot_p = 1;
x_setup_relief_colors (s);
get_glyph_string_clip_rect (s, &r);
- w32_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p,
- s->slice.y == 0,
- s->slice.y + s->slice.height == s->img->height,
- s->slice.x == 0,
- s->slice.x + s->slice.width == s->img->width,
- &r);
+ w32_draw_relief_rect (s->f, x, y, x1, y1, thick, raised_p,
+ top_p, bot_p, left_p, right_p, &r);
}
for (i = (width > 1 ? 1 : 0); i < width; ++i)
XDrawLine (dpy, window, gc,
- left_x + i, top_y + i, left_x + i, bottom_y - i + 1);
+ left_x + i, top_y + (i + 1) * top_p,
+ left_x + i, bottom_y + 1 - (i + 1) * bot_p);
}
XSetClipMask (dpy, gc, None);
XClearArea (dpy, window, right_x, bottom_y, 1, 1, False);
for (i = 0; i < width; ++i)
XDrawLine (dpy, window, gc,
- right_x - i, top_y + i + 1, right_x - i, bottom_y - i);
+ right_x - i, top_y + (i + 1) * top_p,
+ right_x - i, bottom_y + 1 - (i + 1) * bot_p);
}
XSetClipMask (dpy, gc, None);
static void
x_draw_image_relief (struct glyph_string *s)
{
- int x0, y0, x1, y1, thick, raised_p;
+ int x1, y1, thick, raised_p, top_p, bot_p, left_p, right_p;
int extra_x, extra_y;
XRectangle r;
int x = s->x;
extra_x = extra_y = XINT (Vtool_bar_button_margin);
}
- x0 = x - thick - extra_x;
- y0 = y - thick - extra_y;
- x1 = x + s->slice.width + thick - 1 + extra_x;
- y1 = y + s->slice.height + thick - 1 + extra_y;
+ x1 = x + s->slice.width - 1;
+ y1 = y + s->slice.height - 1;
+ top_p = bot_p = left_p = right_p = 0;
+
+ if (s->slice.x == 0)
+ x -= thick, left_p = 1;
+ if (s->slice.y == 0)
+ y -= thick, top_p = 1;
+ if (s->slice.x + s->slice.width == s->img->width)
+ x1 += thick, right_p = 1;
+ if (s->slice.y + s->slice.height == s->img->height)
+ y1 += thick, bot_p = 1;
x_setup_relief_colors (s);
get_glyph_string_clip_rect (s, &r);
- x_draw_relief_rect (s->f, x0, y0, x1, y1, thick, raised_p,
- s->slice.y == 0,
- s->slice.y + s->slice.height == s->img->height,
- s->slice.x == 0,
- s->slice.x + s->slice.width == s->img->width,
- &r);
+ x_draw_relief_rect (s->f, x, y, x1, y1, thick, raised_p,
+ top_p, bot_p, left_p, right_p, &r);
}