restore mux API compatibility

protect WebPMuxSetCanvasSize w/a WEBP_MUX_ABI_VERSION check

Change-Id: I6b01af55ebb4cc4c860d3cbf43be722077896748
This commit is contained in:
James Zern 2014-07-23 16:13:56 -07:00
parent d713a69644
commit 862d296cf9
3 changed files with 7 additions and 1 deletions

View File

@ -449,6 +449,7 @@ int main(int argc, const char *argv[]) {
gif->SWidth, gif->SHeight); gif->SWidth, gif->SHeight);
} }
} }
#if WEBP_MUX_ABI_VERSION > 0x0101
// Set definitive canvas size. // Set definitive canvas size.
err = WebPMuxSetCanvasSize(mux, gif->SWidth, gif->SHeight); err = WebPMuxSetCanvasSize(mux, gif->SWidth, gif->SHeight);
if (err != WEBP_MUX_OK) { if (err != WEBP_MUX_OK) {
@ -456,6 +457,7 @@ int main(int argc, const char *argv[]) {
gif->SWidth, gif->SHeight); gif->SWidth, gif->SHeight);
goto End; goto End;
} }
#endif
// Allocate current buffer. // Allocate current buffer.
frame.width = gif->SWidth; frame.width = gif->SWidth;
frame.height = gif->SHeight; frame.height = gif->SHeight;

View File

@ -362,6 +362,7 @@ WebPMuxError WebPMuxSetAnimationParams(WebPMux* mux,
return MuxSet(mux, kChunks[IDX_ANIM].tag, 1, &anim, 1); return MuxSet(mux, kChunks[IDX_ANIM].tag, 1, &anim, 1);
} }
#if WEBP_MUX_ABI_VERSION > 0x0101
WebPMuxError WebPMuxSetCanvasSize(WebPMux* mux, WebPMuxError WebPMuxSetCanvasSize(WebPMux* mux,
int width, int height) { int width, int height) {
WebPMuxError err; WebPMuxError err;
@ -387,6 +388,7 @@ WebPMuxError WebPMuxSetCanvasSize(WebPMux* mux,
mux->canvas_height_ = height; mux->canvas_height_ = height;
return WEBP_MUX_OK; return WEBP_MUX_OK;
} }
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Delete API(s). // Delete API(s).

View File

@ -55,7 +55,7 @@
extern "C" { extern "C" {
#endif #endif
#define WEBP_MUX_ABI_VERSION 0x0102 // MAJOR(8b) + MINOR(8b) #define WEBP_MUX_ABI_VERSION 0x0101 // MAJOR(8b) + MINOR(8b)
// Note: forward declaring enumerations is not allowed in (strict) C and C++, // Note: forward declaring enumerations is not allowed in (strict) C and C++,
// the types are left here for reference. // the types are left here for reference.
@ -310,6 +310,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetAnimationParams(
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Misc Utilities. // Misc Utilities.
#if WEBP_MUX_ABI_VERSION > 0x0101
// Sets the canvas size for the mux object. The width and height can be // Sets the canvas size for the mux object. The width and height can be
// specified explicitly or left as zero (0, 0). // specified explicitly or left as zero (0, 0).
// * When width and height are specified explicitly, then this frame bound is // * When width and height are specified explicitly, then this frame bound is
@ -327,6 +328,7 @@ WEBP_EXTERN(WebPMuxError) WebPMuxGetAnimationParams(
// WEBP_MUX_OK - on success. // WEBP_MUX_OK - on success.
WEBP_EXTERN(WebPMuxError) WebPMuxSetCanvasSize(WebPMux* mux, WEBP_EXTERN(WebPMuxError) WebPMuxSetCanvasSize(WebPMux* mux,
int width, int height); int width, int height);
#endif
// Gets the canvas size from the mux object. // Gets the canvas size from the mux object.
// Note: This method assumes that the VP8X chunk, if present, is up-to-date. // Note: This method assumes that the VP8X chunk, if present, is up-to-date.