Support for HiDPI in OpenGL on Linux / GTK3.

wxGTK3 HiDPI support seems to emulate what OSX does quite closely,
thus the changes are relatively minimal.

Also fixed an ugly rounding issue when populating the ImGUI font map
with image thumbnails.

Fixes Gtk3 issue on 4k+ screens #4135
Fixes HiDPI screens with Wayland on Fedora 30 cause Plater view to be too small. #3245
This commit is contained in:
Vojtech Bubnik 2020-12-15 12:14:30 +01:00
parent 43581059ff
commit a13b35ce92
4 changed files with 20 additions and 6 deletions

View file

@ -963,6 +963,8 @@ void ImGuiWrapper::init_font(bool compress)
// Fill rectangles from the SVG-icons
for (auto icon : font_icons) {
if (const ImFontAtlas::CustomRect* rect = io.Fonts->GetCustomRectByIndex(rect_id)) {
assert(rect->Width == icon_sz);
assert(rect->Height == icon_sz);
std::vector<unsigned char> raw_data = load_svg(icon.second, icon_sz, icon_sz);
const ImU32* pIn = (ImU32*)raw_data.data();
for (int y = 0; y < icon_sz; y++) {
@ -973,10 +975,12 @@ void ImGuiWrapper::init_font(bool compress)
}
rect_id++;
}
icon_sz = lround(32 * font_scale); // default size of large icon is 32 px
icon_sz *= 2; // default size of large icon is 32 px
for (auto icon : font_icons_large) {
if (const ImFontAtlas::CustomRect* rect = io.Fonts->GetCustomRectByIndex(rect_id)) {
assert(rect->Width == icon_sz);
assert(rect->Height == icon_sz);
std::vector<unsigned char> raw_data = load_svg(icon.second, icon_sz, icon_sz);
const ImU32* pIn = (ImU32*)raw_data.data();
for (int y = 0; y < icon_sz; y++) {