This commit is contained in:
Honza Bambas 2009-09-29 17:32:54 +02:00
Родитель 3b52ab7413
Коммит 463479c660
1 изменённых файлов: 10 добавлений и 5 удалений

Просмотреть файл

@ -685,11 +685,16 @@ nsThebesDeviceContext::SetDPI()
if (dotsArePixels) {
if (prefDevPixelsPerCSSPixel <= 0) {
// Round down to multiple of 96, which is the number of dev pixels
// per CSS pixel. Then, divide that into AppUnitsPerCSSPixel()
// to get the number of app units per dev pixel. The PR_MAXes are
// to make sure we don't end up dividing by zero.
PRUint32 roundedDPIScaleFactor = dpi/96;
// First figure out the closest multiple of 96, which is the number of
// dev pixels per CSS pixel. Then, divide that into AppUnitsPerCSSPixel()
// to get the number of app units per dev pixel. The PR_MAXes are to
// make sure we don't end up dividing by zero.
PRUint32 roundedDPIScaleFactor = (dpi + 48)/96;
#ifdef MOZ_WIDGET_GTK2
// be more conservative about activating scaling on GTK2, since the dpi
// information is more likely to be wrong
roundedDPIScaleFactor = dpi/96;
#endif
mAppUnitsPerDevNotScaledPixel =
PR_MAX(1, AppUnitsPerCSSPixel() / PR_MAX(1, roundedDPIScaleFactor));
} else {