Bug 211092. Don't force pixel->twip ratio to be an integer for print devices. r+sr=dbaron,a=asa

This commit is contained in:
roc+%cs.cmu.edu 2003-09-06 17:28:42 +00:00
Родитель 88c394e664
Коммит b83c093c14
1 изменённых файлов: 5 добавлений и 3 удалений

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

@ -167,9 +167,6 @@ void nsDeviceContextWin :: CommonInit(HDC aDC)
{
int rasterCaps = ::GetDeviceCaps(aDC, RASTERCAPS);
mPixelsToTwips = NSToIntRound((float)NSIntPointsToTwips(72) / ((float)::GetDeviceCaps(aDC, LOGPIXELSY)));
mTwipsToPixels = 1.0 / mPixelsToTwips;
mDepth = (PRUint32)::GetDeviceCaps(aDC, BITSPIXEL);
mPaletteInfo.isPaletteDevice = RC_PALETTE == (rasterCaps & RC_PALETTE);
mPaletteInfo.sizePalette = (PRUint16)::GetDeviceCaps(aDC, SIZEPALETTE);
@ -178,8 +175,12 @@ void nsDeviceContextWin :: CommonInit(HDC aDC)
mWidth = ::GetDeviceCaps(aDC, HORZRES);
mHeight = ::GetDeviceCaps(aDC, VERTRES);
mPixelsToTwips = (float)NSIntPointsToTwips(72) / ((float)::GetDeviceCaps(aDC, LOGPIXELSY));
if (::GetDeviceCaps(aDC, TECHNOLOGY) == DT_RASDISPLAY)
{
// Ensure that, for screens, pixels-to-twips is an integer
mPixelsToTwips = NSToIntRound(mPixelsToTwips);
// init the screen manager and compute our client rect based on the
// screen objects. We'll save the result
nsresult ignore;
@ -187,6 +188,7 @@ void nsDeviceContextWin :: CommonInit(HDC aDC)
if ( !sNumberOfScreens )
mScreenManager->GetNumberOfScreens(&sNumberOfScreens);
} // if this dc is not a print device
mTwipsToPixels = 1.0 / mPixelsToTwips;
DeviceContextImpl::CommonInit();
}