mirror of
https://github.com/aseprite/aseprite.git
synced 2025-01-05 21:57:20 +00:00
Fixed SkinneableTheme::draw_bounds() when the rectangle is too short (in width).
This commit is contained in:
parent
a2c3517717
commit
7185d439d8
@ -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)
|
void SkinneableTheme::draw_bounds(int x1, int y1, int x2, int y2, int nw, int bg)
|
||||||
{
|
{
|
||||||
|
int cx1, cy1, cx2, cy2;
|
||||||
|
cx1 = ji_screen->cl;
|
||||||
|
cy1 = ji_screen->ct;
|
||||||
|
cx2 = ji_screen->cr-1;
|
||||||
|
cy2 = ji_screen->cb-1;
|
||||||
|
|
||||||
int x, y;
|
int x, y;
|
||||||
|
|
||||||
// top
|
// top
|
||||||
|
|
||||||
draw_sprite(ji_screen, m_part[nw], x1, y1);
|
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;
|
for (x = x1+m_part[nw]->w;
|
||||||
x < x2-m_part[nw+2]->w-m_part[nw+1]->w+1;
|
x < x2-m_part[nw+2]->w-m_part[nw+1]->w+1;
|
||||||
x += m_part[nw+1]->w) {
|
x += m_part[nw+1]->w) {
|
||||||
draw_sprite(ji_screen, m_part[nw+1], x, y1);
|
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+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);
|
draw_sprite(ji_screen, m_part[nw+2], x2-m_part[nw+2]->w+1, y1);
|
||||||
|
|
||||||
// bottom
|
// bottom
|
||||||
|
|
||||||
draw_sprite(ji_screen, m_part[nw+6], x1, y2-m_part[nw+6]->h+1);
|
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;
|
for (x = x1+m_part[nw+6]->w;
|
||||||
x < x2-m_part[nw+4]->w-m_part[nw+5]->w+1;
|
x < x2-m_part[nw+4]->w-m_part[nw+5]->w+1;
|
||||||
x += m_part[nw+5]->w) {
|
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], 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+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);
|
draw_sprite(ji_screen, m_part[nw+4], x2-m_part[nw+4]->w+1, y2-m_part[nw+4]->h+1);
|
||||||
|
|
||||||
// Sub-clip
|
if (my_add_clip_rect(ji_screen,
|
||||||
int cx1, cy1, cx2, cy2;
|
x1, y1+m_part[nw]->h,
|
||||||
|
x2, y2-m_part[nw+6]->h)) {
|
||||||
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
|
// left
|
||||||
|
|
||||||
for (y = y1+m_part[nw]->h;
|
for (y = y1+m_part[nw]->h;
|
||||||
y < y2-m_part[nw+6]->h-m_part[nw+7]->h+1;
|
y < y2-m_part[nw+6]->h-m_part[nw+7]->h+1;
|
||||||
y += m_part[nw+7]->h) {
|
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);
|
draw_sprite(ji_screen, m_part[nw+7], x1, y2-m_part[nw+6]->h-m_part[nw+7]->h+1);
|
||||||
|
|
||||||
// right
|
// right
|
||||||
|
|
||||||
for (y = y1+m_part[nw+2]->h;
|
for (y = y1+m_part[nw+2]->h;
|
||||||
y < y2-m_part[nw+4]->h-m_part[nw+3]->h+1;
|
y < y2-m_part[nw+4]->h-m_part[nw+3]->h+1;
|
||||||
y += m_part[nw+3]->h) {
|
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);
|
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);
|
set_clip(ji_screen, cx1, cy1, cx2, cy2);
|
||||||
|
|
||||||
// background
|
// background
|
||||||
|
Loading…
Reference in New Issue
Block a user