mirror of
https://github.com/webmproject/libwebp.git
synced 2024-12-27 06:08:21 +01:00
Merge "WebPPictureAllocARGB: align argb allocation"
This commit is contained in:
commit
aebf59ac50
@ -76,13 +76,12 @@ int WebPPictureAllocARGB(WebPPicture* const picture, int width, int height) {
|
|||||||
return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION);
|
return WebPEncodingSetError(picture, VP8_ENC_ERROR_BAD_DIMENSION);
|
||||||
}
|
}
|
||||||
// allocate a new buffer.
|
// allocate a new buffer.
|
||||||
memory = WebPSafeMalloc(argb_size, sizeof(*picture->argb));
|
memory = WebPSafeMalloc(argb_size + WEBP_ALIGN_CST, sizeof(*picture->argb));
|
||||||
if (memory == NULL) {
|
if (memory == NULL) {
|
||||||
return WebPEncodingSetError(picture, VP8_ENC_ERROR_OUT_OF_MEMORY);
|
return WebPEncodingSetError(picture, VP8_ENC_ERROR_OUT_OF_MEMORY);
|
||||||
}
|
}
|
||||||
// TODO(skal): align plane to cache line?
|
|
||||||
picture->memory_argb_ = memory;
|
picture->memory_argb_ = memory;
|
||||||
picture->argb = (uint32_t*)memory;
|
picture->argb = (uint32_t*)WEBP_ALIGN(memory);
|
||||||
picture->argb_stride = width;
|
picture->argb_stride = width;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user