mirror of
https://github.com/webmproject/libwebp.git
synced 2025-07-12 22:14:29 +02:00
add WebPMuxSetCanvasSize() to the mux API
previously, the final canvas size was adjusted tightly from the animation frames. Now, it can be specified separately (to be larger, in particular). calling WebPMuxSetCanvasSize(mux, 0, 0) triggers the 'adjust tightly' behaviour. This can be useful after calling WebPMuxCreate() if further image addition is expected. -> Fixed gif2webp accordingly. also: made WebPMuxAssemble() more robust by systematically zero-ing WebPData. Change-Id: Ib4f7eac372cf9dbf6e25cd686a77960e386a0b7f
This commit is contained in:
@ -442,14 +442,21 @@ int main(int argc, const char *argv[]) {
|
||||
gif->SWidth, gif->SHeight);
|
||||
}
|
||||
}
|
||||
// Allocate current buffer
|
||||
// Set definitive canvas size.
|
||||
err = WebPMuxSetCanvasSize(mux, gif->SWidth, gif->SHeight);
|
||||
if (err != WEBP_MUX_OK) {
|
||||
fprintf(stderr, "Invalid canvas size %d x %d\n",
|
||||
gif->SWidth, gif->SHeight);
|
||||
goto End;
|
||||
}
|
||||
// Allocate current buffer.
|
||||
frame.width = gif->SWidth;
|
||||
frame.height = gif->SHeight;
|
||||
frame.use_argb = 1;
|
||||
if (!WebPPictureAlloc(&frame)) goto End;
|
||||
WebPUtilClearPic(&frame, NULL);
|
||||
|
||||
// Initialize cache
|
||||
// Initialize cache.
|
||||
cache = WebPFrameCacheNew(frame.width, frame.height,
|
||||
kmin, kmax, allow_mixed);
|
||||
if (cache == NULL) goto End;
|
||||
|
Reference in New Issue
Block a user