changeset 1075:aa4a7eb7c4f3

fix image scaling on reload with border, margin, or padding > 0 On reload images have their buffer set already from cache when Image::sizeAllocateImpl() is called. In that case the widget is still at size 1x1. In that case getContentHeight() and getContentWidth() return values <= 0 when border + margin + padding > 0. To fix the issue use the new size given in allocation instead of the current widget dimensions to determine whether to scale the buffer. (report and initial analysis by furaisanjin <furaisanjin@gmail.com>)
author Johannes Hofmann <Johannes.Hofmann@gmx.de>
date Wed, 06 May 2009 22:54:03 +0200
parents 701bb85f3ce1
children 0dc447948944
files dw/image.cc
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/dw/image.cc	Tue May 05 14:20:41 2009 +0000
+++ b/dw/image.cc	Wed May 06 22:54:03 2009 +0200
@@ -209,7 +209,9 @@
        " = %d - %d = %d\n", this->getHeight(), getStyle()->boxDiffHeight(),
        this->getHeight() - getStyle()->boxDiffHeight());
 #endif
-   if (buffer && (getContentWidth () > 0 || getContentHeight () > 0)) {
+   if (buffer &&
+       (allocation->width - dx > 0 ||
+        allocation->ascent + allocation->descent - dy > 0)) {
       // Zero content size : simply wait...
       // Only one dimension: naturally scale
       oldBuffer = buffer;