implement C64 HiRes constraints.
As they are almost the same as ZX Spectrum, that was easy.
This commit is contained in:
parent
06f7b95b0f
commit
ebb5a6e430
21
src/graph.c
21
src/graph.c
@ -3321,7 +3321,8 @@ static void Pixel_in_screen_thomson_with_opt_preview(word x,word y,byte color,in
|
|||||||
|
|
||||||
/// Paint a pixel with 8x8 block constraints
|
/// Paint a pixel with 8x8 block constraints
|
||||||
///
|
///
|
||||||
/// only 2 colors in a 8x8 block, and for the ZX Spectrum both must be either bight or not.
|
/// Used for ZX Spectrum and C64 HiRes modes.
|
||||||
|
/// Only 2 colors in a 8x8 block, and for the ZX Spectrum both must be either bight or not.
|
||||||
static void Pixel_in_screen_zx_with_opt_preview(word x,word y,byte color,int preview)
|
static void Pixel_in_screen_zx_with_opt_preview(word x,word y,byte color,int preview)
|
||||||
{
|
{
|
||||||
word start = x & 0xFFF8;
|
word start = x & 0xFFF8;
|
||||||
@ -3330,8 +3331,7 @@ static void Pixel_in_screen_zx_with_opt_preview(word x,word y,byte color,int pre
|
|||||||
uint8_t c1, c2;
|
uint8_t c1, c2;
|
||||||
|
|
||||||
// The color we are going to replace
|
// The color we are going to replace
|
||||||
c1 = *(Main.backups->Pages->Image[Main.current_layer].Pixels
|
c1 = Read_pixel_from_current_layer(x, y);
|
||||||
+ x + y * Main.image_width);
|
|
||||||
|
|
||||||
// Pixel is already of the wanted color: nothing to do
|
// Pixel is already of the wanted color: nothing to do
|
||||||
if (c1 == color)
|
if (c1 == color)
|
||||||
@ -3341,8 +3341,7 @@ static void Pixel_in_screen_zx_with_opt_preview(word x,word y,byte color,int pre
|
|||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
for (y2 = 0; y2 < 8; y2++)
|
for (y2 = 0; y2 < 8; y2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main.backups->Pages->Image[Main.current_layer].Pixels
|
c2 = Read_pixel_from_current_layer(x2 + start, y2 + starty);
|
||||||
+ (x2 + start) + (y2 + starty) * Main.image_width);
|
|
||||||
// Pixel is already of the color we are going to add, it is no problem
|
// Pixel is already of the color we are going to add, it is no problem
|
||||||
if (c2 == color)
|
if (c2 == color)
|
||||||
continue;
|
continue;
|
||||||
@ -3357,7 +3356,8 @@ done:
|
|||||||
// There was only one color, so we can add a second one
|
// There was only one color, so we can add a second one
|
||||||
|
|
||||||
// First make sure we have a single brightness
|
// First make sure we have a single brightness
|
||||||
if ((c2 & 8) != (color & 8))
|
if (Main.backups->Pages->Image_mode == IMAGE_MODE_ZX
|
||||||
|
&& (c2 & 8) != (color & 8))
|
||||||
{
|
{
|
||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
for (y2 = 0; y2 < 8; y2++)
|
for (y2 = 0; y2 < 8; y2++)
|
||||||
@ -3374,14 +3374,11 @@ done:
|
|||||||
for (x2 = 0; x2 < 8; x2++)
|
for (x2 = 0; x2 < 8; x2++)
|
||||||
for (y2 = 0; y2 < 8; y2++)
|
for (y2 = 0; y2 < 8; y2++)
|
||||||
{
|
{
|
||||||
c2 = *(Main.backups->Pages->Image[Main.current_layer].Pixels
|
c2 = Read_pixel_from_current_layer(x2 + start, y2 + starty);
|
||||||
+ (x2 + start) + (y2 + starty) * Main.image_width);
|
if (c2 == c1)
|
||||||
if (c2 == c1) {
|
|
||||||
Pixel_in_screen_layered_with_opt_preview(x2+start,y2+starty,color,preview);
|
Pixel_in_screen_layered_with_opt_preview(x2+start,y2+starty,color,preview);
|
||||||
} else {
|
else if (Main.backups->Pages->Image_mode == IMAGE_MODE_ZX) // Force the brightness bit
|
||||||
// Force the brightness bit
|
|
||||||
Pixel_in_screen_layered_with_opt_preview(x2+start,y2+starty,(c2 & ~8) | (color & 8),preview);
|
Pixel_in_screen_layered_with_opt_preview(x2+start,y2+starty,(c2 & ~8) | (color & 8),preview);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user