Fix issue 396: increasing Saturation makes greyscale red

git-svn-id: svn://pulkomandy.tk/GrafX2/trunk@1658 416bcca6-2ee7-4201-b75f-2eb2f807beb1
This commit is contained in:
Yves Rizoud 2010-12-12 18:09:11 +00:00
parent dc9df9d1e9
commit 7aefad850d

View File

@ -1366,16 +1366,28 @@ void Button_Palette(void)
} }
else else
{ {
byte greys=0;
byte non_greys=0;
// Check if the range contains both greys and non-greys
for (i=block_start; i<=block_end; i++) for (i=block_start; i<=block_end; i++)
if (temp_palette[i].R==temp_palette[i].G && temp_palette[i].R == temp_palette[i].B)
non_greys=1;
else
greys=1;
for (i=block_start; i<=block_end; i++)
{
byte is_grey = temp_palette[i].R==temp_palette[i].G && temp_palette[i].R == temp_palette[i].B;
Set_HSL( Set_HSL(
temp_palette, temp_palette,
working_palette, working_palette,
i, i,
Color_max-red_slider->Position, is_grey && greys && non_greys ? 0 : Color_max-red_slider->Position,
Color_max-green_slider->Position, is_grey && greys && non_greys ? 0 : Color_max-green_slider->Position,
Color_max-blue_slider->Position Color_max-blue_slider->Position
); );
} }
}
if (red_slider->Position>Color_max) if (red_slider->Position>Color_max)
{ {
@ -1434,16 +1446,28 @@ void Button_Palette(void)
} }
else else
{ {
byte greys=0;
byte non_greys=0;
// Check if the range contains both greys and non-greys
for (i=block_start; i<=block_end; i++) for (i=block_start; i<=block_end; i++)
if (temp_palette[i].R==temp_palette[i].G && temp_palette[i].R == temp_palette[i].B)
non_greys=1;
else
greys=1;
for (i=block_start; i<=block_end; i++)
{
byte is_grey = temp_palette[i].R==temp_palette[i].G && temp_palette[i].R == temp_palette[i].B;
Set_HSL( Set_HSL(
temp_palette, temp_palette,
working_palette, working_palette,
i, i,
Color_max-red_slider->Position, is_grey && greys && non_greys ? 0 : Color_max-red_slider->Position,
Color_max-green_slider->Position, is_grey && greys && non_greys ? 0 : Color_max-green_slider->Position,
Color_max-blue_slider->Position Color_max-blue_slider->Position
); );
} }
}
if (green_slider->Position>Color_max) if (green_slider->Position>Color_max)
{ {
@ -1502,16 +1526,28 @@ void Button_Palette(void)
} }
else else
{ {
byte greys=0;
byte non_greys=0;
// Check if the range contains both greys and non-greys
for (i=block_start; i<=block_end; i++) for (i=block_start; i<=block_end; i++)
if (temp_palette[i].R==temp_palette[i].G && temp_palette[i].R == temp_palette[i].B)
non_greys=1;
else
greys=1;
for (i=block_start; i<=block_end; i++)
{
byte is_grey = temp_palette[i].R==temp_palette[i].G && temp_palette[i].R == temp_palette[i].B;
Set_HSL( Set_HSL(
temp_palette, temp_palette,
working_palette, working_palette,
i, i,
Color_max-red_slider->Position, is_grey && greys && non_greys ? 0 : Color_max-red_slider->Position,
Color_max-green_slider->Position, is_grey && greys && non_greys ? 0 : Color_max-green_slider->Position,
Color_max-blue_slider->Position Color_max-blue_slider->Position
); );
} }
}
if (blue_slider->Position>Color_max) if (blue_slider->Position>Color_max)
{ {