aboutsummaryrefslogtreecommitdiff
path: root/dw/image.cc
AgeCommit message (Collapse)Author
2024-10-17Use the aspect ratio of the content boxRodrigo Arias Mallo
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.
2024-10-17Remove aspect ratio logic from ImageRodrigo Arias Mallo
The aspect ratio is now preserved by Widget::correctRequisition(), so we don't need to do more steps after the call.
2024-10-17Add support for aspect ratio in WidgetRodrigo Arias Mallo
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.
2024-10-17Allow widgets to adjust new requisitionRodrigo Arias Mallo
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.
2024-10-17Use corrected requisition as fixed sizeRodrigo Arias Mallo
2024-10-17Preserve aspect ratio of imagesRodrigo Arias Mallo
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.
2024-08-07Use dStrdup instead of strdupRodrigo Arias Mallo
The strdup function is not available in POSIX-2001, so we use our own implementation in dlib: dStrdup. Reviewed-by: dogma
2016-04-23GROWS: new options allowDecreaseWidth and allowDecreaseHeight for size ↵Sebastian Geerken
correction.
2015-06-08SRDOP: Positions relative to multiple references; design now considers ↵Sebastian Geerken
handling conflicts.
2015-06-06SRDOP: Positions also for extremes.Sebastian Geerken
2015-05-20Size requisitions depending on positions (SRDOP): added method signatures.Sebastian Geerken
2015-01-23Simplified interrupted drawing. (Mouse events will follow.)Sebastian Geerken
2015-01-08Merge with main repo.Sebastian Geerken
2015-01-05Extremes::adjustmentWidth may now (again) be used for extremes correction.Sebastian Geerken
2015-01-04Added Extremes::adjustmentWidth; fixed Textblock::mustBeWidenedToAvailWidth.Sebastian Geerken
2015-01-02Merge with main repo.Sebastian Geerken
2014-12-21Cleaned up whitespaces etc.Sebastian Geerken
2014-12-21Merge with main repo.Sebastian Geerken
2014-12-21trim some spacescorvid
2014-10-23Changed signature of Widget::draw and friends.Sebastian Geerken
2014-10-23Removed old Widget::draw (backward compatibility is not possible anyway).Sebastian Geerken
2014-09-22Cleaned up: Style::box*() -> Widget::box*().Sebastian Geerken
2014-09-08Consider 'alt' text for image extremes.Sebastian Geerken
2014-08-12Image alt text: descent.corvid, Sebastian Geerken
2014-08-11Image: enough space for alt text (again).Sebastian Geerken
2014-08-10trim spacescorvid
...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.
2014-08-02Image aspect ratio is preserved.Sebastian Geerken
2014-07-22Fixed bug in image scaling.Sebastian Geerken
2014-07-22Fixed incomplete intrinsic extremes.Sebastian Geerken
2014-07-07Fixed bug in Widget::containerSizeChanged complex.Sebastian Geerken
2014-07-05Applied new RTFL macros (ENTER, LEAVE) to image.cc and table.cc.Sebastian Geerken
2014-07-03Widget::getExtremesImpl is now abstract; this way, getExtremes can avoid to ↵Sebastian Geerken
call sizeRequest.
2014-06-17Implemented containerSizeChangedForChildren() for all widgets.Sebastian Geerken
2014-05-30Finished work on Image::sizeRequestImpl.Sebastian Geerken
2014-05-30Simplified Textblock::calcWidgetSize. Work on Image::sizeRequestImpl.Sebastian Geerken
2014-05-14Avoid removing imgbuf and decoding the whole image again for reloads.Jorge Arellano Cid
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.
2014-05-14Avoid creation of unnecessary image bufs (at alt-text to img switch)Jorge Arellano Cid
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 | '------------------------------------------------------------------'
2013-12-21Some more RTFL messages.Sebastian Geerken
2013-12-20RTFL messages.Sebastian Geerken
2013-12-09Activated RTFL again, see <http://www.dillo.org/~sgeerken/rtfl/>.Sebastian Geerken
2013-10-22Extended ImgRenderer; new option (in the code) for drawing background images ↵Sebastian Geerken
at once.
2011-08-26rm unused argcorvid
2011-07-28wrap image alt textcorvid
2011-05-27Make sources fit in 80 columnsJorge Arellano Cid
2011-05-10straighten out free/delete/delete[]corvid
2010-04-22move generic tooltip enter/leave to Widgetcorvid
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.
2010-03-11draw image maps when image not loadedcorvid
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.)
2010-03-03fix alt text clippingcorvid
Since an image's descent is (at least currently) 0, it was less than the font's descent, causing unnecessary clipping.
2009-10-29move link signal emitter/receiver from Widget to Layoutcorvid
http://lists.auriga.wearlab.de/pipermail/dillo-dev/2009-October/006936.html
2009-10-03some tooltipscorvid