Project

General

Profile

Bug #11780

print view page layout incorrect for landscape images when enter from darkroom view

Added by Dan Torop over 1 year ago. Updated over 1 year ago.

Status:
Fixed
Priority:
Low
Assignee:
-
Category:
Printing
Target version:
Start date:
10/23/2017
Due date:
% Done:

100%

Affected Version:
git master branch
System:
Debian
bitness:
64-bit
hardware architecture:
amd64/x86

Description

When entering the print view from darkroom view, the page orientation shown in the center view will always be portrait.

STEPS TO REPRODUCE

  1. in darkroom view select an image with landscape orientation
  2. enter print view

EXPECTED BEHAVIOR

Layout display in center view should show the page orientation as landscape.

ACTUAL BEHAVIOR

Layout display in center view incorrectly shows the page in portrait orientation.

ANALYSIS

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.

PROPOSED SOLUTIONS

  1. 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.
  2. _set_orientation() could fall back to using width/height from image metadata, which would be accurate for all but cropped images.
  3. _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.

Associated revisions

Revision 50539e1f
Added by Dan Torop over 1 year ago

print: refresh layout orientation when mipmaps are updated

This catches the case when print view is entered from darkroom mode
with an image of unknown width/height. Prior to this commit, the
layout would default to portrait mode in this case.

Fixes #11780.

History

#1 Updated by Dan Torop over 1 year ago

A fix is in PR 1546. It's #1 of the proposed solutions, piggy-backing on the code which updates the layout view when a higher res mipmap becomes available.

I'm still curious about whether there's a more elegant solution and/or a way to nicely solve #11781 at the same time.

#2 Updated by Dan Torop over 1 year ago

  • % Done changed from 0 to 100
  • Status changed from New to Fixed

#3 Updated by Roman Lebedev over 1 year ago

  • Target version set to 2.4.0

Also available in: Atom PDF