From db56a7507ee7c1e095d2eef451d5a487f614edff Mon Sep 17 00:00:00 2001 From: Stefano Sabatini Date: Tue, 20 Sep 2011 02:17:08 +0200 Subject: [PATCH] vf_drawtext: prefer int over unsigned int This avoids overflow errors when the considered x and y values are negative, as required by the incoming patches. --- libavfilter/vf_drawtext.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 9ad74014e3..42d0bce119 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -55,8 +55,8 @@ typedef struct { FT_Vector *positions; ///< positions for each element in the text size_t nb_positions; ///< number of elements of positions array char *textfile; ///< file with text to be drawn - unsigned int x; ///< x position to start drawing text - unsigned int y; ///< y position to start drawing text + int x; ///< x position to start drawing text + int y; ///< y position to start drawing text int shadowx, shadowy; unsigned int fontsize; ///< font size to use char *fontcolor_string; ///< font color as string @@ -431,8 +431,8 @@ static int command(AVFilterContext *ctx, const char *cmd, const char *arg, char }\ } -static inline int draw_glyph_yuv(AVFilterBufferRef *picref, FT_Bitmap *bitmap, unsigned int x, - unsigned int y, unsigned int width, unsigned int height, +static inline int draw_glyph_yuv(AVFilterBufferRef *picref, FT_Bitmap *bitmap, + int x, int y, int width, int height, const uint8_t yuva_color[4], int hsub, int vsub) { int r, c, alpha; @@ -462,8 +462,7 @@ static inline int draw_glyph_yuv(AVFilterBufferRef *picref, FT_Bitmap *bitmap, u } static inline int draw_glyph_rgb(AVFilterBufferRef *picref, FT_Bitmap *bitmap, - unsigned int x, unsigned int y, - unsigned int width, unsigned int height, int pixel_step, + int x, int y, int width, int height, int pixel_step, const uint8_t rgba_color[4], const uint8_t rgba_map[4]) { int r, c, alpha; @@ -485,8 +484,8 @@ static inline int draw_glyph_rgb(AVFilterBufferRef *picref, FT_Bitmap *bitmap, return 0; } -static inline void drawbox(AVFilterBufferRef *picref, unsigned int x, unsigned int y, - unsigned int width, unsigned int height, +static inline void drawbox(AVFilterBufferRef *picref, int x, int y, + int width, int height, uint8_t *line[4], int pixel_step[4], uint8_t color[4], int hsub, int vsub, int is_rgba_packed, uint8_t rgba_map[4]) {