Add some comments and remove unused code

This commit is contained in:
Francesco Abbate 2020-06-04 17:23:39 +02:00
parent 67124de130
commit a2a4668887
1 changed files with 4 additions and 9 deletions

View File

@ -12,6 +12,9 @@ struct RenImage {
int width, height; int width, height;
}; };
// Important: when a subpixel scale is used the width below will be the width in logical pixel.
// As each logical pixel contains 3 subpixels it means that the 'pixels' pointer
// will hold enough space for '3 * width' uint8_t values.
typedef struct { typedef struct {
uint8_t *pixels; uint8_t *pixels;
int width, height; int width, height;
@ -323,17 +326,9 @@ static void ren_draw_coverage_with_color(FontRenderer *renderer, RenCoverageImag
return; return;
} }
const int subpixel_scale = 3;
#if 0
// FIXME: find a more robust solution.
const int sub_width_rem = sub->width % subpixel_scale;
if (sub_width_rem > 0) {
sub->width += (subpixel_scale - sub_width_rem);
}
#endif
/* draw */ /* draw */
SDL_Surface *surf = SDL_GetWindowSurface(window); SDL_Surface *surf = SDL_GetWindowSurface(window);
const int subpixel_scale = 3;
uint8_t *s = image->pixels; uint8_t *s = image->pixels;
RenColor *d = (RenColor*) surf->pixels; RenColor *d = (RenColor*) surf->pixels;
s += (sub->x + sub->y * image->width) * subpixel_scale; s += (sub->x + sub->y * image->width) * subpixel_scale;