Am 20.03.2015 um 23:45 schrieb Enrico Forestieri <for...@lyx.org>: > On Fri, Mar 20, 2015 at 10:15:18AM +0100, Stephan Witt wrote: >> >> Ok, here's the patch to improve the display of icons on Mac. I made a >> snapshot of the resulting on-screen display. >> >> The GraphicsLoader.cpp change needs hard coded values. I didn't find a better >> solution, ATM. Any comments are welcome. > > So, the trick is rendering the svg icons at double resolution, if I > undestand correctly. Does it mean that you actually have to use the > larger sizes to have resonably sized icons?
Yes, the QIcon e.g. needs higher physical resolution pixmaps for HiDPI on mac. The logical resolution is the lower one in this scenario. > >> diff --git a/src/graphics/GraphicsLoader.cpp >> b/src/graphics/GraphicsLoader.cpp >> index 23ebb62..6b53774 100644 >> --- a/src/graphics/GraphicsLoader.cpp >> +++ b/src/graphics/GraphicsLoader.cpp >> @@ -460,6 +460,10 @@ void Loader::Impl::createPixmap() >> if (idx != string::npos && idx > 3) { >> if (filename.substr(idx - 3, 3) == "@2x") { >> params_.pixel_ratio = 2.0; >> + } else if (cached_item_->filename().extension() == >> "svgz") { >> + params_.pixel_ratio = 2.0; >> + } else if (cached_item_->filename().extension() == >> "svg") { >> + params_.pixel_ratio = 2.0; > > Here you set params_.pixel_ratio simply based on the extension. Should not > you check whether the display is actually a HiDPI one? In fact the pixel_ratio of an real vector based SVG image is infinite. A proper value would be the result of theGuiApp()->pixelRatio(). But I don't know how to get this information from inside the GraphicsLoader. Perhaps it isn't the best solution to make this decision here. Stephan