kwo pushed a commit to branch master. http://git.enlightenment.org/legacy/imlib2.git/commit/?id=755dc017f26e4756fed3402abaeac3598afc6817
commit 755dc017f26e4756fed3402abaeac3598afc6817 Author: Kim Woelders <k...@woelders.dk> Date: Sat Nov 9 07:23:09 2019 +0100 Use pixel instead of r,b,g,a in __imlib_render_str() --- src/lib/api.c | 4 +--- src/lib/font.h | 3 +-- src/lib/font_draw.c | 11 ++++------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/lib/api.c b/src/lib/api.c index 062a71b..3476aa1 100644 --- a/src/lib/api.c +++ b/src/lib/api.c @@ -3299,9 +3299,7 @@ imlib_text_draw_with_return_metrics(int x, int y, const char *text, if (ctx->direction == IMLIB_TEXT_TO_ANGLE && ctx->angle == 0.0) dir = IMLIB_TEXT_TO_RIGHT; - __imlib_render_str(im, fn, x, y, text, (DATA8) ctx->color.red, - (DATA8) ctx->color.green, (DATA8) ctx->color.blue, - (DATA8) ctx->color.alpha, (char)dir, + __imlib_render_str(im, fn, x, y, text, ctx->pixel, dir, ctx->angle, width_return, height_return, 0, horizontal_advance_return, vertical_advance_return, ctx->operation, diff --git a/src/lib/font.h b/src/lib/font.h index 8b94141..af791c3 100644 --- a/src/lib/font.h +++ b/src/lib/font.h @@ -104,8 +104,7 @@ int __imlib_font_query_text_at_pos(ImlibFont * fn, Imlib_Font_Glyph *__imlib_font_cache_glyph_get(ImlibFont * fn, FT_UInt index); void __imlib_render_str(ImlibImage * im, ImlibFont * f, int drx, int dry, const char *text, - DATA8 r, DATA8 g, DATA8 b, DATA8 a, - char dir, double angle, + DATA32 pixel, int dir, double angle, int *retw, int *reth, int blur, int *nextx, int *nexty, ImlibOp op, int clx, int cly, int clw, int clh); diff --git a/src/lib/font_draw.c b/src/lib/font_draw.c index 7faac47..ea49e14 100644 --- a/src/lib/font_draw.c +++ b/src/lib/font_draw.c @@ -68,14 +68,14 @@ __imlib_font_cache_glyph_get(ImlibFont * fn, FT_UInt index) void __imlib_render_str(ImlibImage * im, ImlibFont * fn, int drx, int dry, - const char *text, DATA8 r, DATA8 g, DATA8 b, DATA8 a, - char dir, double angle, int *retw, int *reth, int blur, + const char *text, DATA32 pixel, int dir, double angle, + int *retw, int *reth, int blur, int *nextx, int *nexty, ImlibOp op, int clx, int cly, int clw, int clh) { int w, h, ascent; ImlibImage *im2; - DATA32 *data, col; + DATA32 *data; int nx, ny; __imlib_font_query_advance(fn, text, &w, NULL); @@ -95,12 +95,9 @@ __imlib_render_str(ImlibImage * im, ImlibFont * fn, int drx, int dry, } SET_FLAG(im2->flags, F_HAS_ALPHA); - /* TODO check for endianess */ - col = PIXEL_ARGB(a, r, g, b); - ascent = __imlib_font_max_ascent_get(fn); - __imlib_font_draw(im2, col, fn, 0, ascent, text, &nx, &ny, 0, 0, w, h); + __imlib_font_draw(im2, pixel, fn, 0, ascent, text, &nx, &ny, 0, 0, w, h); /* OK, now we have small ImlibImage with text rendered, * have to blend it on im */ --