Age | Commit message (Collapse) | Author |
|
The requisition box includes the margin, padding and border. To compute
the aspect ratio of the image we need to remove them to get the content
box. Once the adjustment is done, we add the borders again.
|
|
The aspect ratio is now preserved by Widget::correctRequisition(), so we
don't need to do more steps after the call.
|
|
Images should preserve their own aspect ratio, which is determined by
the image buffer size, also known as the intrinsic size. Currently, when
a child requests a requisition to be corrected by correctRequisition(),
only the size was adjusted, ignoring the aspect ratio.
The new Widget ratio variable holds the desired aspect ratio for the
widget, and will only be taken into account when non-zero. In that case,
then correcting the requisition, a naive algorithm tries to first
increase the length of the small size to fill the preferred aspect
ratio. In the case that it is not enough, the larger size is then
decreased to fit the aspect ratio. And if that doesn't work either, the
aspect ratio is not enforced and the widget will be distorted.
There are special cases for correctRequisition() depending if the parent
exists or not. The same approach is taken for both cases, but using the
viewport size instead of the parent size.
|
|
When a widget calls the parent to correct its own requisition, let the
child widget perform adjustments on the requisition. This allows images
to control the height when the parent changes the width, so the image
can preserve its own aspect ratio.
|
|
|
|
When posible, change the image size so the aspect ratio is always
preserved. This is only posible when one or both dimensions have some
room to play. When both dimensions are not fixed, a naive algorithm
tries to satisfy all {min,max}-{width,height} and aspect ratio
constraints, but it may fail. In that case, the aspect ratio is not
preserved.
Fixes the HTML tests img-aspect-ratio and img-max-bounds.
|
|
The strdup function is not available in POSIX-2001, so we use our own
implementation in dlib: dStrdup.
Reviewed-by: dogma
|
|
correction.
|
|
handling conflicts.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
...now that floats and grows are in the repo and I won't be making
Sebastian's life difficult with a bunch of whitespace changes.
|
|
|
|
|
|
|
|
|
|
|
|
call sizeRequest.
|
|
|
|
|
|
|
|
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.
|
|
This is the first of a patch series for image code bugs that have
severe impact on performance.
With these testing files:
1imgA.html = <img src="maj00s.png" alt="img1">
2imgSA.html = <img src="maj00s.png" alt="img1">
<img src="maj00s.png" alt="img12">
3imgSA.html = <img src="maj00s.png" alt="img1">
<img src="maj00s.png" alt="img12">
<img src="maj00s.png" alt="img123">
2imgA.html = <img src="maj00s.png" alt="img1">
<img src="maj21s.png" alt="img12">
3imgA.html = <img src="maj00s.png" alt="img1">
<img src="maj21s.png" alt="img12">
<img src="c10s.png" alt="img123">
This are the results:
.------------------------------------------------------------------.
|imgbufs | No patch | Patched #1 |
| | first time | upon reload | first time | upon reload |
|-------------------------------------------------------------------
|1imgA.html | 2 | 1 | 1 | 1 |
|2imgSA.html | 3 | 2 | 1 | 2 |
|3imgSA.html | 4 | 3 | 1 | 3 |
|-------------------------------------------------------------------
|2imgA.html | 4 | 2 | 2 | 2 |
|3imgA.html | 6 | 3 | 3 | 3 |
'------------------------------------------------------------------'
|
|
|
|
|
|
|
|
at once.
|
|
|
|
|
|
|
|
|
|
Technically, Textblock's notifyImpl()s should probably call the Widget
one as well. It doesn't matter currently, since we don't look
for title attrs on elements that correspond to entire Textblocks.
|
|
http://lists.auriga.wearlab.de/pipermail/dillo-dev/2010-March/007393.html
(Johannes has already fixed the Rectangle clipping problem. Why the polygons
aren't shown initially isn't known yet.)
|
|
Since an image's descent is (at least currently) 0, it was less than
the font's descent, causing unnecessary clipping.
|
|
http://lists.auriga.wearlab.de/pipermail/dillo-dev/2009-October/006936.html
|
|
|