From 6ed3bace9708fad6a656a187a3b182bba21006fa Mon Sep 17 00:00:00 2001 From: Aurelien Jacobs Date: Wed, 10 Nov 2010 23:37:12 +0000 Subject: [PATCH] drop support for base-10 encoded alpha component in av_parse_color() Originally committed as revision 25719 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavfilter/avfilter.h | 2 +- libavfilter/parseutils.c | 6 +----- libavfilter/parseutils.h | 9 ++++----- 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 18feadcb60..5ee7887922 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -25,7 +25,7 @@ #include "libavutil/avutil.h" #define LIBAVFILTER_VERSION_MAJOR 1 -#define LIBAVFILTER_VERSION_MINOR 59 +#define LIBAVFILTER_VERSION_MINOR 60 #define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ diff --git a/libavfilter/parseutils.c b/libavfilter/parseutils.c index b8923eda46..6609f083ee 100644 --- a/libavfilter/parseutils.c +++ b/libavfilter/parseutils.c @@ -233,11 +233,7 @@ int av_parse_color(uint8_t *rgba_color, const char *color_string, void *log_ctx) if (!strncmp(alpha_string, "0x", 2)) { alpha = strtoul(alpha_string, &tail, 16); } else { - alpha = strtoul(alpha_string, &tail, 10); - if (*tail) { - double d = strtod(alpha_string, &tail); - alpha = d * 255; - } + alpha = 255 * strtod(alpha_string, &tail); } if (tail == alpha_string || *tail || alpha > 255) { diff --git a/libavfilter/parseutils.h b/libavfilter/parseutils.h index c9b6e46c9f..e1bd552bd4 100644 --- a/libavfilter/parseutils.h +++ b/libavfilter/parseutils.h @@ -35,11 +35,10 @@ * possibly followed by "@" and a string representing the alpha * component. * The alpha component may be a string composed by "0x" followed by an - * hexadecimal number or a base-10 number between 0 and 255, or a - * decimal number between 0.0 and 1.0, which represents the opacity - * value (0/0x00/0.0 means completely transparent, 255/0xff/1.0 - * completely opaque). - * If the alpha component is not specified then 255 is assumed. + * hexadecimal number or a decimal number between 0.0 and 1.0, which + * represents the opacity value (0x00/0.0 means completely transparent, + * 0xff/1.0 completely opaque). + * If the alpha component is not specified then 0xff is assumed. * The string "random" will result in a random color. * @return >= 0 in case of success, a negative value in case of * failure (for example if color_string cannot be parsed).