зеркало из https://github.com/mozilla/gecko-dev.git
Put my changes back in that don cone accidently removed
This commit is contained in:
Родитель
61d0494cbd
Коммит
298c50d12a
|
@ -64,12 +64,34 @@ NS_IMETHODIMP nsDeviceContextGTK::Init(nsNativeWidget aNativeWidget)
|
||||||
|
|
||||||
mWidget = aNativeWidget;
|
mWidget = aNativeWidget;
|
||||||
|
|
||||||
// this is used for something odd. who knows
|
// Compute dpi of display
|
||||||
|
float screenWidth = float(::gdk_screen_width());
|
||||||
|
float screenWidthIn = float(::gdk_screen_width_mm()) / 25.4f;
|
||||||
|
nscoord dpi = nscoord(screenWidth / screenWidthIn);
|
||||||
|
|
||||||
|
// Now for some wacky heuristics.
|
||||||
|
if (dpi < 84) dpi = 72;
|
||||||
|
else if (dpi < 108) dpi = 96;
|
||||||
|
else if (dpi < 132) dpi = 120;
|
||||||
|
|
||||||
|
mTwipsToPixels = float(dpi) / float(NSIntPointsToTwips(72));
|
||||||
|
mPixelsToTwips = 1.0f / mTwipsToPixels;
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
static PRBool once = PR_TRUE;
|
||||||
|
if (once) {
|
||||||
|
printf("GFX: dpi=%d t2p=%g p2t=%g\n", dpi, mTwipsToPixels, mPixelsToTwips);
|
||||||
|
once = PR_FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if 0
|
||||||
mTwipsToPixels = ( ((float)::gdk_screen_width()) /
|
mTwipsToPixels = ( ((float)::gdk_screen_width()) /
|
||||||
((float)::gdk_screen_width_mm()) * 25.4) /
|
((float)::gdk_screen_width_mm()) * 25.4) /
|
||||||
(float)NSIntPointsToTwips(72);
|
(float)NSIntPointsToTwips(72);
|
||||||
|
|
||||||
mPixelsToTwips = 1.0f / mTwipsToPixels;
|
mPixelsToTwips = 1.0f / mTwipsToPixels;
|
||||||
|
#endif
|
||||||
|
|
||||||
vis = gdk_rgb_get_visual();
|
vis = gdk_rgb_get_visual();
|
||||||
mDepth = vis->depth;
|
mDepth = vis->depth;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче