summaryrefslogtreecommitdiff
path: root/dw/image.hh
diff options
context:
space:
mode:
authorRodrigo Arias Mallo <rodarima@gmail.com>2024-08-16 17:32:51 +0200
committerRodrigo Arias Mallo <rodarima@gmail.com>2024-10-17 20:38:16 +0200
commit7823c15c4dd68faa911d3807c8133f358854eb3e (patch)
treef3f937b5b5880b91f4597a00f43924cea9f8a8ec /dw/image.hh
parenta4301a9954d4835a4b87344b9b037a816b17286d (diff)
Add support for aspect ratio in Widget
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.
Diffstat (limited to 'dw/image.hh')
-rw-r--r--dw/image.hh1
1 files changed, 0 insertions, 1 deletions
diff --git a/dw/image.hh b/dw/image.hh
index 5d890c4e..ae47f307 100644
--- a/dw/image.hh
+++ b/dw/image.hh
@@ -130,7 +130,6 @@ private:
bool isMap;
protected:
- void setReqWidth(core::Requisition *requisition, int width);
void sizeRequestSimpl (core::Requisition *requisition);
void getExtremesSimpl (core::Extremes *extremes);
void sizeAllocateImpl (core::Allocation *allocation);