GUAC-236: Do not resize buffers if unnecessary.

This commit is contained in:
Michael Jumper 2016-02-28 12:14:55 -08:00
parent ba9c1a2efd
commit e3d0c5e5ef

View File

@ -74,6 +74,10 @@ void guacenc_buffer_free(guacenc_buffer* buffer) {
int guacenc_buffer_resize(guacenc_buffer* buffer, int width, int height) { int guacenc_buffer_resize(guacenc_buffer* buffer, int width, int height) {
/* Ignore requests which do not change the size */
if (buffer->width == width && buffer->height == height)
return 0;
/* Simply deallocate if new image has absolutely no pixels */ /* Simply deallocate if new image has absolutely no pixels */
if (width == 0 || height == 0) { if (width == 0 || height == 0) {
guacenc_buffer_free_image(buffer); guacenc_buffer_free_image(buffer);