Harley Acheson e3036cc3d5 Fix #124390: Slightly Improved Icon Rendering at Non-Integral Interface Sizes
Size icons to subpixel precision to give slightly better results when used
with fractional resolution scales.

---

This change is very subtle. So you might have to trust me or get your reading glasses on...

Our icons are designed for small sizes.  When the Blender resolution scale is set to exactly 1.0 then the icons are aligned perfectly to a 14x14 grid and features like lines are exactly one pixel wide.  So these one-pixel wide lines are perfectly aligned to the pixel grid.  Change the scale to 2.0x and they also align perfectly, just with lines that are two pixels wide.

But what happens at 1.25x scale?  Now the icon is 17.5 pixels and lines in it are a pixel and a quarter wide .  The best that can be is a solid pixel and one next to it that is quarter-opacity. But it can get worse than that as it could potentially touch three adjacent pixels.

Our old icon code took an icon bitmap that was rendered larger and scaled it into the desired size.  Because this was done by the opengl shader, this scaling was done to subpixel size. So at 1.25 scale you got an icon that was 17.5 pixels.

The new icon code is truncating the sizes to integer before rendering. I thought this was best, but I was wrong.

The following image has three rows.  The top is the old icon code, with UI scale from 1.0, 1.25, 1.5, 1.75, and 2.0. The second row is current code. The third is with this PR:

![image](/attachments/f809b30f-df6f-48b1-8745-40d9e897ebc7)

The first and last columns are identical, obviously because the design perfectly fits the pixel grid.

The left green area, at 1.25 scale, current code is forcing the design into an integer size, while (bottom) gives a more pleasing result as it is properly spread over 17.5 pixels.

The right green area is more interesting.  With both the old code and new code, the 1.75 pixel wide line is spread over three pixels. The PR nicely spreads it over two pixels.

Hard to tell;  Just squint.  This is just very slightly more pleasing rendering of icons.

Pull Request: https://projects.blender.org/blender/blender/pulls/124436
2024-07-10 03:08:58 +02:00
2024-06-14 15:48:27 +02:00
2024-07-08 18:27:52 +10:00
2023-12-08 13:28:13 +11:00

Blender

Blender is the free and open source 3D creation suite. It supports the entirety of the 3D pipeline-modeling, rigging, animation, simulation, rendering, compositing, motion tracking and video editing.

Blender screenshot

Project Pages

Development

License

Blender as a whole is licensed under the GNU General Public License, Version 3. Individual files may have a different, but compatible license.

See blender.org/about/license for details.

Description
No description provided
Readme 841 MiB
Languages
C++ 78%
Python 14.9%
C 2.9%
GLSL 1.9%
CMake 1.2%
Other 0.9%