Fixed SkinneableTheme::draw_bounds() when the rectangle is too short (in width).

This commit is contained in:
David Capello 2010-03-24 22:08:07 -03:00
parent a2c3517717
commit 7185d439d8

View File

@ -1678,41 +1678,54 @@ BITMAP* SkinneableTheme::get_toolicon(const char* tool_id) const
void SkinneableTheme::draw_bounds(int x1, int y1, int x2, int y2, int nw, int bg)
{
int x, y;
// top
draw_sprite(ji_screen, m_part[nw], x1, y1);
for (x = x1+m_part[nw]->w;
x < x2-m_part[nw+2]->w-m_part[nw+1]->w+1;
x += m_part[nw+1]->w) {
draw_sprite(ji_screen, m_part[nw+1], x, y1);
}
draw_sprite(ji_screen, m_part[nw+1], x2-m_part[nw+2]->w-m_part[nw+1]->w+1, y1);
draw_sprite(ji_screen, m_part[nw+2], x2-m_part[nw+2]->w+1, y1);
// bottom
draw_sprite(ji_screen, m_part[nw+6], x1, y2-m_part[nw+6]->h+1);
for (x = x1+m_part[nw+6]->w;
x < x2-m_part[nw+4]->w-m_part[nw+5]->w+1;
x += m_part[nw+5]->w) {
draw_sprite(ji_screen, m_part[nw+5], x, y2-m_part[nw+5]->h+1);
}
draw_sprite(ji_screen, m_part[nw+5], x2-m_part[nw+4]->w-m_part[nw+5]->w+1, y2-m_part[nw+5]->h+1);
draw_sprite(ji_screen, m_part[nw+4], x2-m_part[nw+4]->w+1, y2-m_part[nw+4]->h+1);
// Sub-clip
int cx1, cy1, cx2, cy2;
cx1 = ji_screen->cl;
cy1 = ji_screen->ct;
cx2 = ji_screen->cr-1;
cy2 = ji_screen->cb-1;
if (my_add_clip_rect(ji_screen, x1, y1+m_part[nw]->h, x2, y2-m_part[nw+6]->h)) {
// left
int x, y;
// top
draw_sprite(ji_screen, m_part[nw], x1, y1);
if (my_add_clip_rect(ji_screen,
x1+m_part[nw]->w, y1,
x2-m_part[nw+2]->w, y2)) {
for (x = x1+m_part[nw]->w;
x < x2-m_part[nw+2]->w-m_part[nw+1]->w+1;
x += m_part[nw+1]->w) {
draw_sprite(ji_screen, m_part[nw+1], x, y1);
}
draw_sprite(ji_screen, m_part[nw+1], x2-m_part[nw+2]->w-m_part[nw+1]->w+1, y1);
}
set_clip(ji_screen, cx1, cy1, cx2, cy2);
draw_sprite(ji_screen, m_part[nw+2], x2-m_part[nw+2]->w+1, y1);
// bottom
draw_sprite(ji_screen, m_part[nw+6], x1, y2-m_part[nw+6]->h+1);
if (my_add_clip_rect(ji_screen,
x1+m_part[nw+6]->w, y1,
x2-m_part[nw+4]->w, y2)) {
for (x = x1+m_part[nw+6]->w;
x < x2-m_part[nw+4]->w-m_part[nw+5]->w+1;
x += m_part[nw+5]->w) {
draw_sprite(ji_screen, m_part[nw+5], x, y2-m_part[nw+5]->h+1);
}
draw_sprite(ji_screen, m_part[nw+5], x2-m_part[nw+4]->w-m_part[nw+5]->w+1, y2-m_part[nw+5]->h+1);
}
set_clip(ji_screen, cx1, cy1, cx2, cy2);
draw_sprite(ji_screen, m_part[nw+4], x2-m_part[nw+4]->w+1, y2-m_part[nw+4]->h+1);
if (my_add_clip_rect(ji_screen,
x1, y1+m_part[nw]->h,
x2, y2-m_part[nw+6]->h)) {
// left
for (y = y1+m_part[nw]->h;
y < y2-m_part[nw+6]->h-m_part[nw+7]->h+1;
y += m_part[nw+7]->h) {
@ -1721,7 +1734,6 @@ void SkinneableTheme::draw_bounds(int x1, int y1, int x2, int y2, int nw, int bg
draw_sprite(ji_screen, m_part[nw+7], x1, y2-m_part[nw+6]->h-m_part[nw+7]->h+1);
// right
for (y = y1+m_part[nw+2]->h;
y < y2-m_part[nw+4]->h-m_part[nw+3]->h+1;
y += m_part[nw+3]->h) {
@ -1729,7 +1741,6 @@ void SkinneableTheme::draw_bounds(int x1, int y1, int x2, int y2, int nw, int bg
}
draw_sprite(ji_screen, m_part[nw+3], x2-m_part[nw+3]->w+1, y2-m_part[nw+4]->h-m_part[nw+3]->h+1);
}
set_clip(ji_screen, cx1, cy1, cx2, cy2);
// background