diff options
author | Jorge Arellano Cid <jcid@dillo.org> | 2009-01-11 08:50:21 -0300 |
---|---|---|
committer | Jorge Arellano Cid <jcid@dillo.org> | 2009-01-11 08:50:21 -0300 |
commit | 6ec79d6f2b27071aa89a5e9de57989f9f698b955 (patch) | |
tree | e250a1e64912a79f458dc48f430db0ea29a9048a /dw/image.cc | |
parent | 0d8837f13b0a5557dbe449ba4b9898341ef52a05 (diff) |
Implemented natural image scaling when only one dimenssion is given. Part #2
Diffstat (limited to 'dw/image.cc')
-rw-r--r-- | dw/image.cc | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/dw/image.cc b/dw/image.cc index 56d6a4ec..2d3d6337 100644 --- a/dw/image.cc +++ b/dw/image.cc @@ -207,10 +207,9 @@ void Image::sizeAllocateImpl (core::Allocation *allocation) " = %d - %d = %d\n", this->getHeight(), getStyle()->boxDiffHeight(), this->getHeight() - getStyle()->boxDiffHeight()); #endif - if (buffer != NULL && - /* It may be, that the image is allocated at zero content size. In this - * case, we simply wait. */ - getContentWidth () > 0 && getContentHeight () > 0) { + if (buffer && (getContentWidth () > 0 || getContentHeight () > 0)) { + // Zero content size : simply wait... + // Only one dimension: naturally scale oldBuffer = buffer; buffer = oldBuffer->getScaledBuf (allocation->width - dx, allocation->ascent @@ -355,11 +354,10 @@ void Image::setBuffer (core::Imgbuf *buffer, bool resize) if (resize) queueResize (0, true); - // If the image has not yet been allocated, or is allocated at zero - // content size, the first part is useless. if (wasAllocated () && getContentWidth () > 0 && getContentHeight () > 0) { - this->buffer = - buffer->getScaledBuf (getContentWidth (), getContentHeight ()); + // Only scale when both dimensions are known. + this->buffer = + buffer->getScaledBuf (getContentWidth (), getContentHeight ()); } else { this->buffer = buffer; buffer->ref (); |