[haiku-bugs] Re: [Haiku] #11644: [Screenshot] aspect ratio is not always correct

  • From: "TwoFx" <trac@xxxxxxxxxxxx>
  • Date: Sat, 25 Jul 2015 18:42:35 -0000

#11644: [Screenshot] aspect ratio is not always correct
---------------------------------------+----------------------------
Reporter: diver | Owner: nobody
Type: bug | Status: new
Priority: normal | Milestone: R1
Component: Applications/Screenshot | Version: R1/Development
Resolution: | Keywords:
Blocked By: | Blocking:
Has a Patch: 1 | Platform: All
---------------------------------------+----------------------------

Comment (by TwoFx):

I have attached a patch that fixes the issue. The problem was that for
some reason, the height of the preview panel was always assumed to be 150
pixels, which is of course wrong, since it actually depends on what the
BLayoutBuilder suggests. Instead, the height is now always preserved, and
the width of the preview is calculated based on that. Additionally, only
SetPreferredMinSize was set, which was usually smaller than the size that
was set by the layout, resulting in the aspect ration calculations
actually having no effect at all. I added a call to SetExplicitMaxSize so
that the size is always set, however I assume there is a more idiomatic
way of setting the exact size of the preview. The call to this->Layout()
is necessary to initially set the size of the preview window so it knows
what height to keep when _UpdatePreviewPanel is called (otherwise it is 0
when the method is first called).

--
Ticket URL: <https://dev.haiku-os.org/ticket/11644#comment:2>
Haiku <https://dev.haiku-os.org>
Haiku - the operating system.

Other related posts: