Fix y coordinate orientation in font rendering call

This commit is contained in:
Francesco Abbate 2020-05-29 09:27:00 +02:00
parent 31d7cb5ce0
commit 4a8df09829
2 changed files with 2 additions and 3 deletions

View File

@ -21,6 +21,6 @@ int FontRendererDrawText(FontRenderer *fr_, RenColor *pixels, int width, int hei
font_renderer_lcd *font_renderer = (font_renderer_lcd *) fr_;
agg::rendering_buffer ren_buf((agg::int8u *) pixels, width, height, -pitch);
const agg::rgba8 agg_color(color.r, color.g, color.b);
double new_x = font_renderer->render_text(ren_buf, (double) text_size, agg_color, (double) x, (double) y, text);
double new_x = font_renderer->render_text(ren_buf, (double) text_size, agg_color, (double) x, (double) (height - y), text);
return int(new_x);
}

View File

@ -335,9 +335,8 @@ void ren_draw_image(RenImage *image, RenRect *sub, int x, int y, RenColor color)
int ren_draw_text(RenFont *font, const char *text, int x, int y, RenColor color) {
SDL_Surface *surf = SDL_GetWindowSurface(window);
// FIXME: pixels are arranged in bgra order while AGG::fontrender use rgb
RenColor *pixels = (RenColor*) surf->pixels;
return FontRendererDrawText(font->renderer, pixels, surf->w, surf->h, surf->pitch, text, font->height, x, y, color);
return FontRendererDrawText(font->renderer, pixels, surf->w, surf->h, surf->pitch, text, font->height * 0.8, x, y, color);
#if 0
RenRect rect;
const char *p = text;