Fixes issue 212 (segfault in gradrect). The operation is now cancelled if the rectangle is fully out of the picture.
git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1011 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
parent
d6bf9413bf
commit
dcbbd07f8a
@ -365,9 +365,10 @@ static const T_Help_table helptable_credits[] =
|
||||
HELP_TEXT (" HoraK-FDF iLKke Jamon ")
|
||||
HELP_TEXT (" keito kusma Lord Graga ")
|
||||
HELP_TEXT (" MagerValp mind MooZ ")
|
||||
HELP_TEXT (" the Peach richienyhus tape.wyrm ")
|
||||
HELP_TEXT (" TeeEmCee tempest Timo Kurrpa ")
|
||||
HELP_TEXT (" titus^Rab Tobé 00ai99 ")
|
||||
HELP_TEXT (" the Peach petter richienyhus ")
|
||||
HELP_TEXT (" tape.wyrm TeeEmCee tempest ")
|
||||
HELP_TEXT (" Timo Kurrpa titus^Rab Tobé ")
|
||||
HELP_TEXT (" 00ai99")
|
||||
HELP_TEXT ("")
|
||||
HELP_TEXT (" ... posted the annoying bug reports.")
|
||||
HELP_TEXT ("")
|
||||
|
||||
52
operatio.c
52
operatio.c
@ -4582,25 +4582,49 @@ void Grad_rectangle_0_5(void)
|
||||
Paintbrush_Y = ray;
|
||||
Hide_cursor();
|
||||
|
||||
width = abs(rbx-rax);
|
||||
height = abs(rby-ray);
|
||||
width = abs(rbx - rax);
|
||||
height = abs(rby - ray);
|
||||
|
||||
if (Max(rax,rbx)-Main_offset_X > Min(Main_image_width,Main_magnifier_mode?Main_separator_position:Screen_width)) // Tous les clippings à gérer sont là
|
||||
offset_width = Max(rax,rbx) - Min(Main_image_width,Main_magnifier_mode?Main_separator_position:Screen_width);
|
||||
// Check if the rectangle is not fully outside the picture
|
||||
if (Min(rax, rbx) > Main_image_width || Min(ray, rby) > Main_image_height)
|
||||
{
|
||||
Operation_pop(&rby); // reset the stack
|
||||
return; // cancel the operation
|
||||
}
|
||||
|
||||
if (Max(ray,rby)-Main_offset_Y > Min(Main_image_height,Menu_Y))
|
||||
offset_height = Max(ray,rby) - Min(Main_image_height,Menu_Y);
|
||||
// Handle clipping
|
||||
if (Max(rax, rbx)-Main_offset_X > Min(Main_image_width,
|
||||
Main_magnifier_mode?Main_separator_position:Screen_width))
|
||||
{
|
||||
offset_width = Max(rax, rbx) - Min(Main_image_width,
|
||||
Main_magnifier_mode?Main_separator_position:Screen_width);
|
||||
}
|
||||
|
||||
// Dessin dans la zone de dessin normale
|
||||
Horizontal_XOR_line(Min(rax,rbx)-Main_offset_X,Min(ray,rby)-Main_offset_Y,width - offset_width);
|
||||
if(offset_height == 0)
|
||||
Horizontal_XOR_line(Min(rax,rbx)-Main_offset_X,Max(ray,rby)-1-Main_offset_Y,width - offset_width);
|
||||
if (Max(ray, rby)-Main_offset_Y > Min(Main_image_height, Menu_Y))
|
||||
offset_height = Max(ray, rby) - Min(Main_image_height, Menu_Y);
|
||||
|
||||
Vertical_XOR_line(Min(rax,rbx)-Main_offset_X,Min(ray,rby)-Main_offset_Y,height-offset_height);
|
||||
if (offset_width == 0) // Sinon cette ligne est en dehors de la zone image, inutile de la dessiner
|
||||
Vertical_XOR_line(Max(rax,rbx)-1-Main_offset_X,Min(ray,rby)-Main_offset_Y,height-offset_height);
|
||||
// Dessin dans la zone de dessin normale
|
||||
Horizontal_XOR_line(Min(rax, rbx)-Main_offset_X,
|
||||
Min(ray, rby) - Main_offset_Y, width - offset_width);
|
||||
|
||||
Update_rect(Min(rax,rbx)-Main_offset_X,Min(ray,rby)-Main_offset_Y,width+1-offset_width,height+1-offset_height);
|
||||
// If not, this line is out of the picture so there is no need to draw it
|
||||
if (offset_height == 0)
|
||||
{
|
||||
Horizontal_XOR_line(Min(rax, rbx) - Main_offset_X, Max(ray, rby) - 1
|
||||
- Main_offset_Y, width - offset_width);
|
||||
}
|
||||
|
||||
Vertical_XOR_line(Min(rax, rbx)-Main_offset_X, Min(ray, rby)
|
||||
- Main_offset_Y, height - offset_height);
|
||||
|
||||
if (offset_width == 0)
|
||||
{
|
||||
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);
|
||||
|
||||
// Dessin dans la zone zoomée
|
||||
if(Main_magnifier_mode && Min(rax,rbx)<Limit_visible_right_zoom && Max(rax,rbx)>Limit_left_zoom && Min(ray,rby)<Limit_visible_bottom_zoom && Max(ray,rby)>Limit_top_zoom )
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user