use scaledpixels to convert from CSS pixels to realword pixels bug=307367 r/sr=roc

This commit is contained in:
bmlk%gmx.de 2006-01-21 09:31:45 +00:00
Родитель e632e0a349
Коммит 5a36c0dda6
2 изменённых файлов: 7 добавлений и 2 удалений

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

@ -729,7 +729,7 @@ nsPresContext::Init(nsIDeviceContext* aDeviceContext)
mInitialized = PR_TRUE; mInitialized = PR_TRUE;
#endif #endif
float pixelsToTwips = PixelsToTwips(); float pixelsToTwips = ScaledPixelsToTwips();
mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THIN] = NSIntPixelsToTwips(1, pixelsToTwips); mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THIN] = NSIntPixelsToTwips(1, pixelsToTwips);
mBorderWidthTable[NS_STYLE_BORDER_WIDTH_MEDIUM] = NSIntPixelsToTwips(3, pixelsToTwips); mBorderWidthTable[NS_STYLE_BORDER_WIDTH_MEDIUM] = NSIntPixelsToTwips(3, pixelsToTwips);
mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THICK] = NSIntPixelsToTwips(5, pixelsToTwips); mBorderWidthTable[NS_STYLE_BORDER_WIDTH_THICK] = NSIntPixelsToTwips(5, pixelsToTwips);

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

@ -388,6 +388,11 @@ public:
*/ */
NS_HIDDEN_(void) SetPageDim(const nsRect& aRect); NS_HIDDEN_(void) SetPageDim(const nsRect& aRect);
/**
* Conversion from device pixels to twips.
* WARNING: The misuse of this function to convert CSS pixels to twips
* will cause problems during printing
*/
float PixelsToTwips() const { return mDeviceContext->DevUnitsToAppUnits(); } float PixelsToTwips() const { return mDeviceContext->DevUnitsToAppUnits(); }
float TwipsToPixels() const { return mDeviceContext->AppUnitsToDevUnits(); } float TwipsToPixels() const { return mDeviceContext->AppUnitsToDevUnits(); }
@ -396,7 +401,7 @@ public:
//XXX this is probably not an ideal name. MMP //XXX this is probably not an ideal name. MMP
/** /**
* Do pixels to twips conversion taking into account * Do CSS pixels to twips conversion taking into account
* differing size of a "pixel" from device to device. * differing size of a "pixel" from device to device.
*/ */
NS_HIDDEN_(float) ScaledPixelsToTwips() const; NS_HIDDEN_(float) ScaledPixelsToTwips() const;