Marker problems for high resolution screen

Tomaž Vajngerl quikee at gmail.com
Sun Oct 28 08:46:00 UTC 2018


Hi Regina,

On Sat, Oct 27, 2018 at 12:21 AM Regina Henschel
<rb.henschel at t-online.de> wrote:
>
> Hi all,
>
> I want to tell you, what I have found so far, so that if someone will
> actually fix the problem, can use this information.
>
> The problem: If someone has a higher resolution screen and therefore
> uses an OS scaling of e.g. 150%, the markers for resizing and rotation,
> the anchor and the crop markers are broken.
>
> What happens:
> LO generates larger images and stores them in cache/<icontheme
> name>/<scaling factor>. For 150% you get a file markers.png of size
> 175x138 instead of the original 117x92. But the method, which crops the
> desired marker out of the markers.png uses rectangles which assume
> 117x92. Therefore the wrong parts of marker.png are used. Proof:
> Exchange the enlarged markers.png with the original and the markers are
> drawn correctly. But they are too small for a high resolution screen.
>
> In
> https://opengrok.libreoffice.org/xref/core/svx/source/svdraw/svdhdl.cxx#742
> is the method BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker,
> BitmapColorIndex eIndex)
> According comment, it is designed for HiDPI. It uses single markers,
> with names of structure svx/res/marker-rect9-6.png and similar. Such
> files are contained in the image-themes in core, but not in the
> image-themes in the zip-files, which are delivered. Therefore
> ImpGetBitmapEx uses the old method with one combined markers.png file as
> fallback. Proof: If you pack an image-theme from core and add it to your
> installation, the single enlarged marker is generated and used.

Right, I extracted the markers to single files just because of that
reason. Multiple markers in one image file makes it hard - not only
for HiDPI, but also for SVG icons, and there are practically no
benefits to have them in one file (not even for the icon designers).

> For cropmarkers.png such single files are not used. Here you get the
> enlarged file with size 229x94 instead of the original size 153x63 for
> my 150% example and therefore really ugly handles.

Yes, I forgot the crop markers - it makes sense to extract them to its
own files too.

> Why do the delivered icon-themes do not contain the single markers? That
> would at least solve the problem for markers until a more general fix is
> available.

Single markers icon filename is constructed at runtime and then loaded
with vcl::bitmap::loadFromName, so the markers are not included in any
resource files (svx/inc/bitmaps.hlst for example). When packing the
icon themes together we copy only the icons that are contained in the
resource file so the single markers are left out. When I have written
that code I was not aware of this yet. So the solution is to add them
to a resource file and leave the code as is (something might complain
that the resource is not used?) or in addition also change the code to
use the resource mechanism to load the bitmap too (which means that a
huge switch file will be needed or a struct with all the parameters, a
custom hash function and every combination in an unordered_map). Only
adding them to a resource file should solve the problem I think.

> Kind regards
> Regina

Best regards, Tomaž


More information about the LibreOffice mailing list