once again runs under linux.

This commit is contained in:
spider 1998-06-25 05:37:54 +00:00
parent edc069a0e5
commit da6cb28eba
2 changed files with 12 additions and 5 deletions

View File

@ -92,6 +92,8 @@ NS_IMPL_RELEASE(nsDeviceContextUnix)
nsresult nsDeviceContextUnix :: Init(nsNativeWidget aNativeWidget)
{
NS_ASSERTION(!(aNativeWidget == nsnull), "attempt to init devicecontext with null widget");
for (PRInt32 cnt = 0; cnt < 256; cnt++)
mGammaTable[cnt] = cnt;
@ -100,11 +102,14 @@ nsresult nsDeviceContextUnix :: Init(nsNativeWidget aNativeWidget)
mNativeWidget = aNativeWidget;
mTwipsToPixels = (((float)::XDisplayWidth(XtDisplay((Widget)mNativeWidget), DefaultScreen(XtDisplay((Widget)mNativeWidget)))) /
((float)::XDisplayWidthMM(XtDisplay((Widget)mNativeWidget),DefaultScreen(XtDisplay((Widget)mNativeWidget)) )) * 25.4) /
NS_POINTS_TO_TWIPS_FLOAT(72.0f);
if (nsnull != mNativeWidget)
{
mTwipsToPixels = (((float)::XDisplayWidth(XtDisplay((Widget)mNativeWidget), DefaultScreen(XtDisplay((Widget)mNativeWidget)))) /
((float)::XDisplayWidthMM(XtDisplay((Widget)mNativeWidget),DefaultScreen(XtDisplay((Widget)mNativeWidget)) )) * 25.4) /
NS_POINTS_TO_TWIPS_FLOAT(72.0f);
mPixelsToTwips = 1.0f / mTwipsToPixels;
mPixelsToTwips = 1.0f / mTwipsToPixels;
}
return NS_OK;
}

View File

@ -53,6 +53,8 @@ NS_IMPL_ISUPPORTS(nsFontMetricsUnix, kIFontMetricsIID)
nsresult nsFontMetricsUnix :: Init(const nsFont& aFont, nsIDeviceContext* aCX)
{
NS_ASSERTION(!(nsnull == aCX), "attempt to init fontmetrics with null device context");
char **fnames = nsnull;
PRInt32 namelen = aFont.name.Length() + 1;
char *wildstring = (char *)PR_Malloc((namelen << 1) + 200);
@ -60,7 +62,7 @@ nsresult nsFontMetricsUnix :: Init(const nsFont& aFont, nsIDeviceContext* aCX)
char altitalicization = 0;
XFontStruct *fonts;
PRInt32 dpi = NS_TO_INT_ROUND(aCX->GetTwipsToDevUnits() * 1440);
Display *dpy = XtDisplay((Widget)mContext->GetNativeWidget());
Display *dpy = XtDisplay((Widget)aCX->GetNativeWidget());
if (nsnull == wildstring)
return NS_ERROR_NOT_INITIALIZED;