drop support for base-10 encoded alpha component in av_parse_color()

Originally committed as revision 25719 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Aurelien Jacobs 2010-11-10 23:37:12 +00:00
parent 119a34f716
commit 6ed3bace97
3 changed files with 6 additions and 11 deletions

View File

@ -25,7 +25,7 @@
#include "libavutil/avutil.h" #include "libavutil/avutil.h"
#define LIBAVFILTER_VERSION_MAJOR 1 #define LIBAVFILTER_VERSION_MAJOR 1
#define LIBAVFILTER_VERSION_MINOR 59 #define LIBAVFILTER_VERSION_MINOR 60
#define LIBAVFILTER_VERSION_MICRO 0 #define LIBAVFILTER_VERSION_MICRO 0
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \

View File

@ -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)) { if (!strncmp(alpha_string, "0x", 2)) {
alpha = strtoul(alpha_string, &tail, 16); alpha = strtoul(alpha_string, &tail, 16);
} else { } else {
alpha = strtoul(alpha_string, &tail, 10); alpha = 255 * strtod(alpha_string, &tail);
if (*tail) {
double d = strtod(alpha_string, &tail);
alpha = d * 255;
}
} }
if (tail == alpha_string || *tail || alpha > 255) { if (tail == alpha_string || *tail || alpha > 255) {

View File

@ -35,11 +35,10 @@
* possibly followed by "@" and a string representing the alpha * possibly followed by "@" and a string representing the alpha
* component. * component.
* The alpha component may be a string composed by "0x" followed by an * 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 * hexadecimal number or a decimal number between 0.0 and 1.0, which
* decimal number between 0.0 and 1.0, which represents the opacity * represents the opacity value (0x00/0.0 means completely transparent,
* value (0/0x00/0.0 means completely transparent, 255/0xff/1.0 * 0xff/1.0 completely opaque).
* completely opaque). * If the alpha component is not specified then 0xff is assumed.
* If the alpha component is not specified then 255 is assumed.
* The string "random" will result in a random color. * The string "random" will result in a random color.
* @return >= 0 in case of success, a negative value in case of * @return >= 0 in case of success, a negative value in case of
* failure (for example if color_string cannot be parsed). * failure (for example if color_string cannot be parsed).