aboutsummaryrefslogtreecommitdiff
path: root/dw/image.cc
diff options
context:
space:
mode:
authorJorge Arellano Cid <jcid@dillo.org>2014-05-14 20:21:27 -0400
committerJorge Arellano Cid <jcid@dillo.org>2014-05-14 20:21:27 -0400
commitc039ea12dd95e358b2aff826971d73fa0c170d63 (patch)
tree8959df77b99c4fce37f5d89ceed14a7f4f11b1f1 /dw/image.cc
parent4681bc69ac265fae7f6f84cb834ec87ea5bec271 (diff)
Avoid removing imgbuf and decoding the whole image again for reloads.
Using the same testing files as the previous patch, the results are: .---------------------------------------------. |imgbufs | No patch | Patch #1 | Patch #2 | |---------------------------------------------- |1imgA.html | 2/1 | 1/1 | 1/0 | |2imgSA.html | 3/2 | 1/2 | 1/0 | |3imgSA.html | 4/3 | 1/3 | 1/0 | |---------------------------------------------- |2imgA.html | 4/2 | 2/2 | 2/0 | |3imgA.html | 6/3 | 3/3 | 3/0 | '---------------------------------------------' n1/n2 means: n1 imgbufs were created for first load (empty cache) n2 imgbufs were created for reload (cached image) Notes: * Rendering is much faster. Easy to notice with Back operation. * Between four to five times on www.welt.de. * Corner cases can be more than ten times. Usually, it *feels* faster.
Diffstat (limited to 'dw/image.cc')
-rw-r--r--dw/image.cc4
1 files changed, 1 insertions, 3 deletions
diff --git a/dw/image.cc b/dw/image.cc
index 5df6b93e..e71c8f2f 100644
--- a/dw/image.cc
+++ b/dw/image.cc
@@ -425,9 +425,6 @@ void Image::setBuffer (core::Imgbuf *buffer, bool resize)
{
core::Imgbuf *oldBuf = this->buffer;
- if (resize)
- queueResize (0, true);
-
if (wasAllocated () && needsResize () &&
getContentWidth () > 0 && getContentHeight () > 0) {
// Don't create a new buffer for the transition from alt text to img,
@@ -438,6 +435,7 @@ void Image::setBuffer (core::Imgbuf *buffer, bool resize)
this->buffer = buffer;
buffer->ref ();
}
+ queueResize (0, true);
DBG_OBJ_ASSOC_CHILD (this->buffer);