diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-07-14 14:15:39 +0900 |
---|---|---|
committer | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2015-07-17 08:50:38 +0900 |
commit | 9827eaeac51149c9c26abc4a8cca6f2029274ee5 (patch) | |
tree | e25e055227d1be3a6585c2e7990528d53b39d93b | |
parent | 2a19bb85cbe83aa031871a3689b9ff03629da548 (diff) |
force a specific DPI with SAL_FORCEDPI (GTK2 & GTK3 backends only)
Change-Id: I2c154e4df060ade36744c6aa2fbffa8c6e665629
-rw-r--r-- | vcl/unx/generic/gdi/salgdi.cxx | 8 | ||||
-rw-r--r-- | vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx | 8 |
2 files changed, 16 insertions, 0 deletions
diff --git a/vcl/unx/generic/gdi/salgdi.cxx b/vcl/unx/generic/gdi/salgdi.cxx index ee68a0cac9da..556125047455 100644 --- a/vcl/unx/generic/gdi/salgdi.cxx +++ b/vcl/unx/generic/gdi/salgdi.cxx @@ -278,6 +278,14 @@ bool X11SalGraphics::GetDitherPixmap( SalColor nSalColor ) void X11SalGraphics::GetResolution( sal_Int32 &rDPIX, sal_Int32 &rDPIY ) // const { + char* pForceDpi; + if ((pForceDpi = getenv("SAL_FORCEDPI"))) + { + OString sForceDPI(pForceDpi); + rDPIX = rDPIY = sForceDPI.toInt32(); + return; + } + const SalDisplay *pDisplay = GetDisplay(); if (!pDisplay) { diff --git a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx index 0e3b0f627887..c593559e744e 100644 --- a/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx +++ b/vcl/unx/gtk3/gdi/gtk3salnativewidgets-gtk.cxx @@ -2102,6 +2102,14 @@ cairo_t* GtkSalGraphics::getCairoContext() const void GtkSalGraphics::GetResolution(sal_Int32& rDPIX, sal_Int32& rDPIY) { + char* pForceDpi; + if ((pForceDpi = getenv("SAL_FORCEDPI"))) + { + OString sForceDPI(pForceDpi); + rDPIX = rDPIY = sForceDPI.toInt32(); + return; + } + GdkScreen* pScreen = gtk_widget_get_screen(mpWindow); double fResolution = -1.0; g_object_get(pScreen, "resolution", &fResolution, nullptr); |