Fixed a bug in gradrect xor lines drawing where they could sometime get to draw over the menu or even outside the screen.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1265 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
ae873551ff
commit
450b64ca10
@ -3404,7 +3404,9 @@ void Grad_rectangle_0_5(void)
|
||||
height = abs(rby - ray);
|
||||
|
||||
// Check if the rectangle is not fully outside the picture
|
||||
if (Min(rax, rbx) > Main_image_width || Min(ray, rby) > Main_image_height)
|
||||
if (Min(rax, rbx) > Main_image_width // Rectangle at right of picture
|
||||
|| Min(ray, rby) > Main_image_height // Rectangle below picture
|
||||
|| Min(ray, rby) - 1 - Main_offset_Y > Menu_Y ) // Rectangle below viewport
|
||||
{
|
||||
Operation_pop(&rby); // reset the stack
|
||||
return; // cancel the operation
|
||||
@ -3426,12 +3428,13 @@ void Grad_rectangle_0_5(void)
|
||||
Min(ray, rby) - Main_offset_Y, width - offset_width);
|
||||
|
||||
// If not, this line is out of the picture so there is no need to draw it
|
||||
if (offset_height == 0)
|
||||
if (offset_height == 0 || Max(ray, rby) - 1 > Menu_Y + Main_offset_Y )
|
||||
{
|
||||
Horizontal_XOR_line(Min(rax, rbx) - Main_offset_X, Max(ray, rby) - 1
|
||||
- Main_offset_Y, width - offset_width);
|
||||
}
|
||||
|
||||
if (height > offset_height) {
|
||||
Vertical_XOR_line(Min(rax, rbx)-Main_offset_X, Min(ray, rby)
|
||||
- Main_offset_Y, height - offset_height);
|
||||
|
||||
@ -3440,6 +3443,7 @@ void Grad_rectangle_0_5(void)
|
||||
Vertical_XOR_line(Max(rax, rbx) - 1 - Main_offset_X, Min(ray, rby)
|
||||
- Main_offset_Y, height - offset_height);
|
||||
}
|
||||
}
|
||||
|
||||
Update_rect(Min(rax, rbx) - Main_offset_X, Min(ray, rby) - Main_offset_Y,
|
||||
width + 1 - offset_width, height + 1 - offset_height);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user