diff options
Diffstat (limited to 'dw/image.cc')
-rw-r--r-- | dw/image.cc | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/dw/image.cc b/dw/image.cc index 603f2964..9adf17f1 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -402,22 +402,6 @@ void Image::sizeRequestSimpl (core::Requisition *requisition) DBG_OBJ_LEAVE (); } -void Image::setReqWidth(core::Requisition *requisition, int width) -{ - /* If we have the image buffer, try to set the height to preserve the image - * ratio */ - if (buffer) { - int w = buffer->getRootWidth(); - int h = buffer->getRootHeight(); - float ratio = (float) h / (float) w; - int height = (float) width * ratio; - /* Preserve descent */ - requisition->ascent = height - requisition->descent; - } - - requisition->width = width; -} - void Image::getExtremesSimpl (core::Extremes *extremes) { int contentWidth; @@ -682,6 +666,9 @@ void Image::setBuffer (core::Imgbuf *buffer, bool resize) } queueResize (0, true); + if (bufWidth) + this->ratio = (float) bufWidth / (float) bufHeight; + DBG_OBJ_ASSOC_CHILD (this->buffer); DBG_OBJ_SET_NUM ("bufWidth", bufWidth); DBG_OBJ_SET_NUM ("bufHeight", bufHeight); |