aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-05-06 22:54:03 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-05-06 22:54:03 +0200
commit7671dd333a8da8251b0e94f586310ab3e2c523ee (patch)
treecffbcb5cb82ed4810743217a8cff7f06a3a72263
parent066253c8ec7541a2beaae92d502392f1ca0456e6 (diff)
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>)
-rw-r--r--dw/image.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/dw/image.cc b/dw/image.cc
index 0a690999..a76d999b 100644
--- a/dw/image.cc
+++ b/dw/image.cc
@@ -209,7 +209,9 @@ void Image::sizeAllocateImpl (core::Allocation *allocation)
" = %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;