Skip to content

Commit

Permalink
Fixes #102 Colors in hires mode are incorrect
Browse files Browse the repository at this point in the history
  • Loading branch information
st3fan committed Dec 27, 2016
1 parent 2c2cea1 commit 2f41bae
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/scr.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,10 @@ static uint16_t hgr_line_offsets[192] = {

static SDL_Color hgr_colors[16] = {
{ 0, 0, 0, 0 }, // 0 Black
{ 0, 0, 204, 0 }, // 1 Blue
{ 128, 0, 128, 0 }, // 2 Purple
{ 0, 100, 0, 0 }, // 3 Green
{ 0, 100, 0, 0 }, // 4 Red
{ 0, 150, 255, 0 }, // 1 Light Blue
{ 255, 64, 255, 0 }, // 2 Purple
{ 0, 249, 0, 0 }, // 3 Green
{ 255, 147, 0, 0 }, // 4 Orange
{ 255, 255, 255, 0 } // 5 White
};

Expand Down Expand Up @@ -225,7 +225,7 @@ static void inline scr_render_hgr_line_color(struct scr_t *scr, int line, uint16
}
} else {
if (c & 0x80) {
pixels[x] = 4; // Red
pixels[x] = 4; // Orange
} else {
pixels[x] = 3; // Green
}
Expand All @@ -245,6 +245,14 @@ static void inline scr_render_hgr_line_color(struct scr_t *scr, int line, uint16
}
}

// Fill black pixels with same neighbours

for (int i = 0; i < (280-1); i++) {
if (pixels[i] == pixels[i+2] && pixels[i] != 0) {
pixels[i+1] = pixels[i];
}
}

// Now draw them

for (x = 0; x < 280; x++) {
Expand Down

0 comments on commit 2f41bae

Please sign in to comment.