From b8637a900e0d85edf7eeacc7898995740fedb313 Mon Sep 17 00:00:00 2001 From: artemp Date: Mon, 15 Apr 2013 18:04:27 +0100 Subject: [PATCH] + fix crop width/height calc --- src/webp_reader.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/webp_reader.cpp b/src/webp_reader.cpp index 52941fd2c..1b0ffe6f3 100644 --- a/src/webp_reader.cpp +++ b/src/webp_reader.cpp @@ -129,8 +129,8 @@ void webp_reader::read(unsigned x0, unsigned y0,image_data_32& image) config.options.use_cropping = 1; config.options.crop_left = x0; config.options.crop_top = y0; - config.options.crop_width = image.width(); - config.options.crop_height = image.height(); + config.options.crop_width = std::min(width_ - x0, image.width()); + config.options.crop_height = std::min(height_ - y0, image.height()); if (WebPGetFeatures(data_, size_, &config.input) != VP8_STATUS_OK) {