mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-28 06:38:20 +01:00
webpmux: warn when odd frame offsets are used
offsets are stored as (x/2, y/2) Change-Id: Ic8f727ab7996a84c1f8c57f4f6dbaf8701bf8eae
This commit is contained in:
parent
6e93317f5b
commit
c072663493
@ -371,6 +371,14 @@ static void PrintHelp(void) {
|
|||||||
printf(" and is assumed to be\nvalid.\n");
|
printf(" and is assumed to be\nvalid.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void WarnAboutOddOffset(const WebPMuxFrameInfo* const info) {
|
||||||
|
if ((info->x_offset | info->y_offset) & 1) {
|
||||||
|
fprintf(stderr, "Warning: odd offsets will be snapped to even values"
|
||||||
|
" (%d, %d) -> (%d, %d)\n", info->x_offset, info->y_offset,
|
||||||
|
info->x_offset & ~1, info->y_offset & ~1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static int ReadFileToWebPData(const char* const filename,
|
static int ReadFileToWebPData(const char* const filename,
|
||||||
WebPData* const webp_data) {
|
WebPData* const webp_data) {
|
||||||
const uint8_t* data;
|
const uint8_t* data;
|
||||||
@ -444,6 +452,9 @@ static int ParseFrameArgs(const char* args, WebPMuxFrameInfo* const info) {
|
|||||||
default:
|
default:
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WarnAboutOddOffset(info);
|
||||||
|
|
||||||
// Note: The sanity of the following conversion is checked by
|
// Note: The sanity of the following conversion is checked by
|
||||||
// WebPMuxPushFrame().
|
// WebPMuxPushFrame().
|
||||||
info->dispose_method = (WebPMuxAnimDispose)dispose_method;
|
info->dispose_method = (WebPMuxAnimDispose)dispose_method;
|
||||||
@ -456,7 +467,10 @@ static int ParseFrameArgs(const char* args, WebPMuxFrameInfo* const info) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int ParseFragmentArgs(const char* args, WebPMuxFrameInfo* const info) {
|
static int ParseFragmentArgs(const char* args, WebPMuxFrameInfo* const info) {
|
||||||
return (sscanf(args, "+%d+%d", &info->x_offset, &info->y_offset) == 2);
|
const int ok =
|
||||||
|
(sscanf(args, "+%d+%d", &info->x_offset, &info->y_offset) == 2);
|
||||||
|
if (ok) WarnAboutOddOffset(info);
|
||||||
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ParseBgcolorArgs(const char* args, uint32_t* const bgcolor) {
|
static int ParseBgcolorArgs(const char* args, uint32_t* const bgcolor) {
|
||||||
|
Loading…
Reference in New Issue
Block a user