print view page layout incorrect for landscape images when enter from darkroom view
When entering the print view from darkroom view, the page orientation shown in the center view will always be portrait.
STEPS TO REPRODUCE
- in darkroom view select an image with landscape orientation
- enter print view
Layout display in center view should show the page orientation as landscape.
Layout display in center view incorrectly shows the page in portrait orientation.
Upon entering print view, the enter() routine calls _set_orientation() in views/print.c to detect the image orientation. The _set_orientation() routine requests a low-quality preview of the image from dt_mipmap_cache_get() in order to determine its orientation. _set_orientation() calls dt_mipmap_cache_get() with DT_MIPMAP_BEST_EFFORT, which will return NULL if there is no available mipmap. In that case returned image width and height are 0, which causes _set_orientation() to default to portrait.
If the user has entered from darkroom view, there will be no available mipmap, hence the layout display will always show the image in portrait mode. When entering from lighttable view, there is almost certainly a mipmap available, hence the center view layout will be correct.
The page orientation shown in the right panel combobox may be inaccurate as well. I will file a separate bug report regarding this.
- As print.c already listens for the DT_SIGNAL_DEVELOP_MIPMAP_UPDATED, when that signal is received, calling _set_orientation() will properly update the layout display. The layout display may be incorrect until the signal is received.
- _set_orientation() could fall back to using width/height from image metadata, which would be accurate for all but cropped images.
- _set_orientation() could make a blocking call to dt_mipmap_cache_get(). Unfortunately, this would hang the UI for images with lots of slow iops enabled.
I have a branch with only the first solution, as a proposed fix. Combining the first and second solution could produce the most responsive/stable UI.
#1 Updated by Dan Torop over 1 year ago
#2 Updated by Dan Torop over 1 year ago
- % Done changed from 0 to 100
- Status changed from New to Fixed
Applied in changeset darktable|50539e1fa3432d1a2909060c222d456a7aab2698.