mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Inline getters and setters for scaling factors on nsIDeviceContext. Bug 233103, r+sr=dbaron.
This commit is contained in:
parent
bc9a61e011
commit
433c389ddf
@ -829,11 +829,11 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
|
||||
// DEVICE CONTEXT INFORMATION from PresContext
|
||||
nsIDeviceContext *dx = mPresContext->DeviceContext();
|
||||
printf("DeviceContext of Presentation Context(%x)\n", dx);
|
||||
dx->GetDevUnitsToTwips(a1);
|
||||
dx->GetTwipsToDevUnits(a2);
|
||||
a1 = dx->DevUnitsToTwips();
|
||||
a2 = dx->TwipsToDevUnits();
|
||||
printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2);
|
||||
dx->GetAppUnitsToDevUnits(a1);
|
||||
dx->GetDevUnitsToAppUnits(a2);
|
||||
a1 = dx->AppUnitsToDevUnits();
|
||||
a2 = dx->DevUnitsToAppUnits();
|
||||
printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2);
|
||||
dx->GetCanonicalPixelScale(a1);
|
||||
printf(" GetCanonicalPixelScale = %f\n",a1);
|
||||
@ -849,11 +849,11 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
|
||||
|
||||
// DEVICE CONTEXT INFORMATION
|
||||
printf("DeviceContext created for print(%x)\n",mPrt->mPrintDC);
|
||||
mPrt->mPrintDC->GetDevUnitsToTwips(a1);
|
||||
mPrt->mPrintDC->GetTwipsToDevUnits(a2);
|
||||
a1 = mPrt->mPrintDC->DevUnitsToTwips();
|
||||
a2 = mPrt->mPrintDC->TwipsToDevUnits();
|
||||
printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2);
|
||||
mPrt->mPrintDC->GetAppUnitsToDevUnits(a1);
|
||||
mPrt->mPrintDC->GetDevUnitsToAppUnits(a2);
|
||||
a1 = mPrt->mPrintDC->AppUnitsToDevUnits();
|
||||
a2 = mPrt->mPrintDC->DevUnitsToAppUnits();
|
||||
printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2);
|
||||
mPrt->mPrintDC->GetCanonicalPixelScale(a1);
|
||||
printf(" GetCanonicalPixelScale = %f\n",a1);
|
||||
|
@ -1411,7 +1411,7 @@ nsEventStateManager::GenerateDragGesture(nsIPresContext* aPresContext,
|
||||
// Do we need to do this conversion every time?
|
||||
// Will the pres context really change on us or can we cache it?
|
||||
float pixelsToTwips;
|
||||
aPresContext->DeviceContext()->GetDevUnitsToTwips(pixelsToTwips);
|
||||
pixelsToTwips = aPresContext->DeviceContext()->DevUnitsToTwips();
|
||||
|
||||
nscoord thresholdX = NSIntPixelsToTwips(pixelThresholdX, pixelsToTwips);
|
||||
nscoord thresholdY = NSIntPixelsToTwips(pixelThresholdY, pixelsToTwips);
|
||||
|
@ -4392,10 +4392,10 @@ nsDocShell::EnsureDeviceContext()
|
||||
|
||||
mDeviceContext->Init(widget->GetNativeData(NS_NATIVE_WIDGET));
|
||||
float dev2twip;
|
||||
mDeviceContext->GetDevUnitsToTwips(dev2twip);
|
||||
dev2twip = mDeviceContext->DevUnitsToTwips();
|
||||
mDeviceContext->SetDevUnitsToAppUnits(dev2twip);
|
||||
float twip2dev;
|
||||
mDeviceContext->GetTwipsToDevUnits(twip2dev);
|
||||
twip2dev = mDeviceContext->TwipsToDevUnits();
|
||||
mDeviceContext->SetAppUnitsToDevUnits(twip2dev);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -231,7 +231,7 @@ ScreenImpl::GetRect(nsRect& aRect)
|
||||
context->GetRect(aRect);
|
||||
|
||||
float devUnits;
|
||||
context->GetDevUnitsToAppUnits(devUnits);
|
||||
devUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
aRect.x = NSToIntRound(float(aRect.x) / devUnits);
|
||||
aRect.y = NSToIntRound(float(aRect.y) / devUnits);
|
||||
@ -256,7 +256,7 @@ ScreenImpl::GetAvailRect(nsRect& aRect)
|
||||
context->GetClientRect(aRect);
|
||||
|
||||
float devUnits;
|
||||
context->GetDevUnitsToAppUnits(devUnits);
|
||||
devUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
aRect.x = NSToIntRound(float(aRect.x) / devUnits);
|
||||
aRect.y = NSToIntRound(float(aRect.y) / devUnits);
|
||||
|
@ -100,15 +100,6 @@ public:
|
||||
NS_IMETHOD CreateRenderingContext(nsDrawingSurface aSurface, nsIRenderingContext *&aContext);
|
||||
NS_IMETHOD CreateRenderingContextInstance(nsIRenderingContext *&aContext);
|
||||
|
||||
NS_IMETHOD GetDevUnitsToTwips(float &aDevUnitsToTwips) const;
|
||||
NS_IMETHOD GetTwipsToDevUnits(float &aTwipsToDevUnits) const;
|
||||
|
||||
NS_IMETHOD SetAppUnitsToDevUnits(float aAppUnits);
|
||||
NS_IMETHOD SetDevUnitsToAppUnits(float aDevUnits);
|
||||
|
||||
NS_IMETHOD GetAppUnitsToDevUnits(float &aAppUnits) const;
|
||||
NS_IMETHOD GetDevUnitsToAppUnits(float &aDevUnits) const;
|
||||
|
||||
NS_IMETHOD GetCanonicalPixelScale(float &aScale) const;
|
||||
NS_IMETHOD SetCanonicalPixelScale(float aScale);
|
||||
|
||||
@ -161,10 +152,6 @@ protected:
|
||||
PRBool aForceAlias);
|
||||
void GetLocaleLangGroup(void);
|
||||
|
||||
float mTwipsToPixels;
|
||||
float mPixelsToTwips;
|
||||
float mAppUnitsToDevUnits;
|
||||
float mDevUnitsToAppUnits;
|
||||
nsFontCache *mFontCache;
|
||||
nsCOMPtr<nsIAtom> mLocaleLangGroup; // XXX temp fix for performance bug - erik
|
||||
float mZoom;
|
||||
|
@ -263,17 +263,15 @@ public:
|
||||
/**
|
||||
* Obtain the size of a device unit relative to a Twip. A twip is 1/20 of
|
||||
* a point (which is 1/72 of an inch).
|
||||
* @param aDevUnitsToTwips out parameter for conversion value
|
||||
* @return error status
|
||||
* @return conversion value
|
||||
*/
|
||||
NS_IMETHOD GetDevUnitsToTwips(float &aDevUnitsToTwips) const = 0;
|
||||
float DevUnitsToTwips() const { return mPixelsToTwips; }
|
||||
|
||||
/**
|
||||
* Obtain the size of a Twip relative to a device unit.
|
||||
* @param aTwipsToDevUnits out parameter for conversion value
|
||||
* @return error status
|
||||
* @return conversion value
|
||||
*/
|
||||
NS_IMETHOD GetTwipsToDevUnits(float &aTwipsToDevUnits) const = 0;
|
||||
float TwipsToDevUnits() const { return mTwipsToPixels; }
|
||||
|
||||
/**
|
||||
* Set the scale factor to convert units used by the application
|
||||
@ -285,9 +283,11 @@ public:
|
||||
* to convert device units <-> app units.
|
||||
* @param aAppUnits scale value to convert from application defined
|
||||
* units to device units.
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD SetAppUnitsToDevUnits(float aAppUnits) = 0;
|
||||
void SetAppUnitsToDevUnits(float aAppUnits)
|
||||
{
|
||||
mAppUnitsToDevUnits = aAppUnits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the scale factor to convert device units to units
|
||||
@ -295,17 +295,18 @@ public:
|
||||
* 1.0f / the value passed into SetAppUnitsToDevUnits().
|
||||
* @param aDevUnits scale value to convert from device units to
|
||||
* application defined units
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD SetDevUnitsToAppUnits(float aDevUnits) = 0;
|
||||
void SetDevUnitsToAppUnits(float aDevUnits)
|
||||
{
|
||||
mDevUnitsToAppUnits = aDevUnits;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the scale factor to convert from application defined
|
||||
* units to device units.
|
||||
* @param aAppUnits out paramater for scale value
|
||||
* @return error status
|
||||
* @param aAppUnits scale value
|
||||
*/
|
||||
NS_IMETHOD GetAppUnitsToDevUnits(float &aAppUnits) const = 0;
|
||||
float AppUnitsToDevUnits() const { return mAppUnitsToDevUnits; }
|
||||
|
||||
/**
|
||||
* Get the scale factor to convert from device units to
|
||||
@ -313,7 +314,7 @@ public:
|
||||
* @param aDevUnits out paramater for scale value
|
||||
* @return error status
|
||||
*/
|
||||
NS_IMETHOD GetDevUnitsToAppUnits(float &aDevUnits) const = 0;
|
||||
float DevUnitsToAppUnits() const { return mDevUnitsToAppUnits; }
|
||||
|
||||
/**
|
||||
* Get the value used to scale a "standard" pixel to a pixel
|
||||
@ -553,6 +554,11 @@ public:
|
||||
NS_IMETHOD SetUseAltDC(PRUint8 aValue, PRBool aOn) = 0;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
float mTwipsToPixels;
|
||||
float mPixelsToTwips;
|
||||
float mAppUnitsToDevUnits;
|
||||
float mDevUnitsToAppUnits;
|
||||
};
|
||||
|
||||
#endif /* nsIDeviceContext_h___ */
|
||||
|
@ -122,8 +122,8 @@ NS_IMETHODIMP nsFontMetricsBeOS::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
float app2dev, app2twip;
|
||||
aContext->GetAppUnitsToDevUnits(app2dev);
|
||||
aContext->GetDevUnitsToTwips(app2twip);
|
||||
app2dev = aContext->AppUnitsToDevUnits();
|
||||
app2twip = aContext->DevUnitsToTwips();
|
||||
|
||||
app2twip *= app2dev;
|
||||
float rounded = ((float)NSIntPointsToTwips(NSTwipsToFloorIntPoints(nscoord(mFont->size * app2twip)))) / app2twip;
|
||||
@ -244,7 +244,7 @@ NS_IMETHODIMP nsFontMetricsBeOS::Destroy()
|
||||
void nsFontMetricsBeOS::RealizeFont(nsIDeviceContext* aContext)
|
||||
{
|
||||
float f;
|
||||
aContext->GetDevUnitsToAppUnits(f);
|
||||
f = aContext->DevUnitsToAppUnits();
|
||||
|
||||
struct font_height height;
|
||||
mFontHandle.GetHeight( &height );
|
||||
|
@ -116,9 +116,9 @@ NS_IMETHODIMP nsRenderingContextBeOS::CommonInit() {
|
||||
if (!mTranMatrix)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
mP2T = mContext->DevUnitsToAppUnits();
|
||||
float app2dev;
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mContext->AppUnitsToDevUnits();
|
||||
mTranMatrix->AddScale(app2dev, app2dev);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1451,7 +1451,7 @@ NS_IMETHODIMP nsFontMetricsGTK::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
mDeviceContext = aContext;
|
||||
|
||||
float app2dev;
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mDeviceContext->AppUnitsToDevUnits();
|
||||
|
||||
mPixelSize = NSToIntRound(app2dev * mFont->size);
|
||||
// Make sure to clamp the pixel size to something reasonable so we
|
||||
@ -1550,7 +1550,7 @@ NS_IMETHODIMP nsFontMetricsGTK::Destroy()
|
||||
void nsFontMetricsGTK::RealizeFont()
|
||||
{
|
||||
float f;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
if (mWesternFont->IsFreeTypeFont()) {
|
||||
nsFreeTypeFont *ft = (nsFreeTypeFont *)mWesternFont;
|
||||
@ -1636,7 +1636,7 @@ void nsFontMetricsGTK::RealizeFont()
|
||||
}
|
||||
nsXFont *xFont = mWesternFont->GetXFont();
|
||||
XFontStruct *fontInfo = xFont->GetXFontStruct();
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
nscoord lineSpacing = nscoord((fontInfo->ascent + fontInfo->descent) * f);
|
||||
mEmHeight = PR_MAX(1, nscoord(mWesternFont->mSize * f));
|
||||
@ -3488,7 +3488,7 @@ nsFontMetricsGTK::GetWidth (const char* aString, PRUint32 aLength,
|
||||
}
|
||||
|
||||
float f;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
aWidth = NSToCoordRound(rawWidth * f);
|
||||
|
||||
return NS_OK;
|
||||
@ -3553,7 +3553,7 @@ nsFontMetricsGTK::GetWidth (const PRUnichar* aString, PRUint32 aLength,
|
||||
}
|
||||
|
||||
float f;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
aWidth = NSToCoordRound(rawWidth * f);
|
||||
|
||||
if (nsnull != aFontID)
|
||||
@ -3842,7 +3842,7 @@ nsFontMetricsGTK::GetBoundingMetrics(const char *aString, PRUint32 aLength,
|
||||
}
|
||||
|
||||
float P2T;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(P2T);
|
||||
P2T = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
aBoundingMetrics.leftBearing =
|
||||
NSToCoordRound(aBoundingMetrics.leftBearing * P2T);
|
||||
@ -3932,7 +3932,7 @@ nsFontMetricsGTK::GetBoundingMetrics(const PRUnichar *aString,
|
||||
|
||||
// convert to app units
|
||||
float P2T;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(P2T);
|
||||
P2T = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
aBoundingMetrics.leftBearing =
|
||||
NSToCoordRound(aBoundingMetrics.leftBearing * P2T);
|
||||
@ -4020,7 +4020,7 @@ nsFontMetricsGTK::GetTextDimensions (const PRUnichar* aString,
|
||||
}
|
||||
|
||||
float P2T;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(P2T);
|
||||
P2T = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
aDimensions.width = NSToCoordRound(rawWidth * P2T);
|
||||
aDimensions.ascent = NSToCoordRound(rawAscent * P2T);
|
||||
@ -4450,7 +4450,7 @@ nsFontMetricsGTK::GetTextDimensions (const PRUnichar* aString,
|
||||
offsets.AppendElement((void*)aString);
|
||||
|
||||
float f;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
BreakGetTextDimensionsData data = { f, aAvailWidth,
|
||||
aBreaks, aNumBreaks,
|
||||
spaceWidth, aveCharWidth,
|
||||
|
@ -198,7 +198,7 @@ public:
|
||||
PRInt16 mBaselineAdjust;
|
||||
|
||||
// these values are not in app units, they need to be scaled with
|
||||
// nsIDeviceContext::GetDevUnitsToAppUnits()
|
||||
// nsIDeviceContext::DevUnitsToAppUnits()
|
||||
PRInt16 mMaxAscent;
|
||||
PRInt16 mMaxDescent;
|
||||
|
||||
|
@ -402,7 +402,7 @@ nsFontMetricsXft::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
|
||||
// pixels -> twips ; twips -> points
|
||||
float dev2app;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mDeviceContext->DevUnitsToAppUnits();
|
||||
nscoord screenTwips = NSIntPixelsToTwips(gdk_screen_height(), dev2app);
|
||||
nscoord screenPoints = NSTwipsToIntPoints(screenTwips);
|
||||
|
||||
@ -459,7 +459,7 @@ nsFontMetricsXft::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
|
||||
// convert the minimum size into points
|
||||
float P2T;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(P2T);
|
||||
P2T = mDeviceContext->DevUnitsToAppUnits();
|
||||
minimum = NSTwipsToIntPoints(NSFloatPixelsToTwips(minimum, P2T));
|
||||
|
||||
if (mPointSize < minimum)
|
||||
@ -547,7 +547,7 @@ nsFontMetricsXft::GetWidth(const char* aString, PRUint32 aLength,
|
||||
aLength, &glyphInfo);
|
||||
|
||||
float f;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
aWidth = NSToCoordRound(glyphInfo.xOff * f);
|
||||
|
||||
return NS_OK;
|
||||
@ -567,7 +567,7 @@ nsFontMetricsXft::GetWidth(const PRUnichar* aString, PRUint32 aLength,
|
||||
gint rawWidth = RawGetWidth(aString, aLength);
|
||||
|
||||
float f;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
aWidth = NSToCoordRound(rawWidth * f);
|
||||
|
||||
if (aFontID)
|
||||
@ -597,7 +597,7 @@ nsFontMetricsXft::GetTextDimensions(const PRUnichar* aString,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
float P2T;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(P2T);
|
||||
P2T = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
aDimensions.width = NSToCoordRound(aDimensions.width * P2T);
|
||||
aDimensions.ascent = NSToCoordRound(aDimensions.ascent * P2T);
|
||||
@ -658,7 +658,7 @@ nsFontMetricsXft::DrawString(const char *aString, PRUint32 aLength,
|
||||
data.y = aY;
|
||||
data.spacing = aSpacing;
|
||||
data.context = aContext;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(data.p2t);
|
||||
data.p2t = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
PrepareToDraw(aContext, aSurface, &data.draw, data.color);
|
||||
|
||||
@ -687,7 +687,7 @@ nsFontMetricsXft::DrawString(const PRUnichar* aString, PRUint32 aLength,
|
||||
data.y = aY;
|
||||
data.spacing = aSpacing;
|
||||
data.context = aContext;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(data.p2t);
|
||||
data.p2t = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
// set up our colors and clip regions
|
||||
PrepareToDraw(aContext, aSurface, &data.draw, data.color);
|
||||
@ -724,7 +724,7 @@ nsFontMetricsXft::GetBoundingMetrics(const char *aString, PRUint32 aLength,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
float P2T;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(P2T);
|
||||
P2T = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
aBoundingMetrics.leftBearing =
|
||||
NSToCoordRound(aBoundingMetrics.leftBearing * P2T);
|
||||
@ -762,7 +762,7 @@ nsFontMetricsXft::GetBoundingMetrics(const PRUnichar *aString,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
float P2T;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(P2T);
|
||||
P2T = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
aBoundingMetrics.leftBearing =
|
||||
NSToCoordRound(aBoundingMetrics.leftBearing * P2T);
|
||||
@ -818,7 +818,7 @@ nsFontMetricsXft::CacheFontMetrics(void)
|
||||
// Get our scale factor
|
||||
float f;
|
||||
float val;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
// Get our font face
|
||||
FT_Face face;
|
||||
|
@ -191,9 +191,9 @@ NS_IMETHODIMP nsRenderingContextGTK::Init(nsIDeviceContext* aContext,
|
||||
|
||||
NS_IMETHODIMP nsRenderingContextGTK::CommonInit()
|
||||
{
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
mP2T = mContext->DevUnitsToAppUnits();
|
||||
float app2dev;
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mContext->AppUnitsToDevUnits();
|
||||
mTranMatrix->AddScale(app2dev, app2dev);
|
||||
|
||||
return NS_OK;
|
||||
|
@ -303,7 +303,7 @@ ATSUTextLayout nsATSUIToolkit::GetTextLayout(short aFontNum, short aSize, PRBool
|
||||
float dev2app;
|
||||
short fontsize = aSize;
|
||||
|
||||
mContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mContext->DevUnitsToAppUnits();
|
||||
// Fixed size = FloatToFixed( roundf(float(fontsize) / dev2app));
|
||||
Fixed size = FloatToFixed( (float) rint(float(fontsize) / dev2app));
|
||||
if( FixRound ( size ) < 9 && !nsFontUtils::DisplayVerySmallFonts())
|
||||
|
@ -275,7 +275,7 @@ NS_IMETHODIMP nsDeviceContextMac :: GetSystemFont(nsSystemFontID aID, nsFont *aF
|
||||
case eSystemFont_Tooltips:
|
||||
case eSystemFont_Widget:
|
||||
float dev2app;
|
||||
GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = DevUnitsToAppUnits();
|
||||
|
||||
aFont->style = NS_FONT_STYLE_NORMAL;
|
||||
aFont->weight = NS_FONT_WEIGHT_NORMAL;
|
||||
|
@ -95,7 +95,7 @@ NS_IMETHODIMP nsFontMetricsMac::Init(const nsFont& aFont, nsIAtom* aLangGroup, n
|
||||
GetFontInfo(&fInfo);
|
||||
|
||||
float dev2app;
|
||||
mContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mContext->DevUnitsToAppUnits();
|
||||
|
||||
mLeading = NSToCoordRound(float(fInfo.leading) * dev2app);
|
||||
mEmAscent = NSToCoordRound(float(fInfo.ascent) * dev2app);
|
||||
@ -274,7 +274,7 @@ NS_IMETHODIMP
|
||||
nsFontMetricsMac :: GetSuperscriptOffset(nscoord& aResult)
|
||||
{
|
||||
float dev2app;
|
||||
mContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mContext->DevUnitsToAppUnits();
|
||||
aResult = NSToCoordRound(float(mMaxAscent / 2) - dev2app);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -283,7 +283,7 @@ NS_IMETHODIMP
|
||||
nsFontMetricsMac :: GetSubscriptOffset(nscoord& aResult)
|
||||
{
|
||||
float dev2app;
|
||||
mContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mContext->DevUnitsToAppUnits();
|
||||
aResult = NSToCoordRound(float(mMaxAscent / 2) - dev2app);
|
||||
return NS_OK;
|
||||
}
|
||||
@ -292,7 +292,7 @@ NS_IMETHODIMP
|
||||
nsFontMetricsMac :: GetStrikeout(nscoord& aOffset, nscoord& aSize)
|
||||
{
|
||||
float dev2app;
|
||||
mContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mContext->DevUnitsToAppUnits();
|
||||
aOffset = NSToCoordRound(float(mMaxAscent / 2) - dev2app);
|
||||
aSize = NSToCoordRound(dev2app);
|
||||
return NS_OK;
|
||||
@ -302,7 +302,7 @@ NS_IMETHODIMP
|
||||
nsFontMetricsMac :: GetUnderline(nscoord& aOffset, nscoord& aSize)
|
||||
{
|
||||
float dev2app;
|
||||
mContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mContext->DevUnitsToAppUnits();
|
||||
aOffset = -NSToCoordRound( dev2app );
|
||||
aSize = NSToCoordRound( dev2app );
|
||||
return NS_OK;
|
||||
|
@ -69,7 +69,7 @@ nsFontUtils::GetNativeTextStyle(nsIFontMetrics& inMetrics,
|
||||
inMetrics.GetFontHandle(fontNum);
|
||||
|
||||
float dev2app;
|
||||
inDevContext.GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = inDevContext.DevUnitsToAppUnits();
|
||||
short textSize = float(aFont->size) / dev2app;
|
||||
|
||||
if (textSize < 9 && !nsFontUtils::DisplayVerySmallFonts())
|
||||
|
@ -238,12 +238,12 @@ void nsRenderingContextMac::SelectDrawingSurface(nsDrawingSurfaceMac* aSurface,
|
||||
((nsDeviceContextMac *)mContext)->InstallColormap();
|
||||
#endif
|
||||
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
mP2T = mContext->DevUnitsToAppUnits();
|
||||
|
||||
if (mGS->mTMatrix.GetType() == MG_2DIDENTITY) {
|
||||
// apply the new scaling
|
||||
float app2dev;
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mContext->AppUnitsToDevUnits();
|
||||
mGS->mTMatrix.AddScale(app2dev, app2dev);
|
||||
}
|
||||
|
||||
|
@ -113,42 +113,6 @@ void DeviceContextImpl::CommonInit(void)
|
||||
obs->AddObserver(this, "memory-pressure", PR_TRUE);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetTwipsToDevUnits(float &aTwipsToDevUnits) const
|
||||
{
|
||||
aTwipsToDevUnits = mTwipsToPixels;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetDevUnitsToTwips(float &aDevUnitsToTwips) const
|
||||
{
|
||||
aDevUnitsToTwips = mPixelsToTwips;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::SetAppUnitsToDevUnits(float aAppUnits)
|
||||
{
|
||||
mAppUnitsToDevUnits = aAppUnits;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::SetDevUnitsToAppUnits(float aDevUnits)
|
||||
{
|
||||
mDevUnitsToAppUnits = aDevUnits;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetAppUnitsToDevUnits(float &aAppUnits) const
|
||||
{
|
||||
aAppUnits = mAppUnitsToDevUnits;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetDevUnitsToAppUnits(float &aDevUnits) const
|
||||
{
|
||||
aDevUnits = mDevUnitsToAppUnits;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP DeviceContextImpl::GetCanonicalPixelScale(float &aScale) const
|
||||
{
|
||||
aScale = mCPixelScale;
|
||||
|
@ -113,7 +113,7 @@ void
|
||||
nsRegressionTestFontMetrics::RealizeFont()
|
||||
{
|
||||
float dev2app;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mDeviceContext->DevUnitsToAppUnits();
|
||||
nscoord onepixel = NSToCoordRound(1 * dev2app);
|
||||
PRUint32 fontsize = mFont->size;
|
||||
|
||||
|
@ -154,18 +154,18 @@ nsresult nsDeviceContextOS2::Init( nsNativeDeviceContext aContext,
|
||||
mPixelsToTwips = ((float)NSIntPointsToTwips(72)) / ((float)dpi);
|
||||
mTwipsToPixels = 1.0 / mPixelsToTwips;
|
||||
|
||||
GetTwipsToDevUnits(newscale);
|
||||
newscale = TwipsToDevUnits();
|
||||
// On OS/2, origscale can be different based on the video resolution.
|
||||
// On 640x480, it's 1/15, on everything else it is 1/12.
|
||||
// For consistent printing, 1/15 is the correct value to use.
|
||||
// It is the closest to 4.x and to Windows.
|
||||
// aOrigContext->GetTwipsToDevUnits( origscale);
|
||||
// origscale = aOrigContext->TwipsToDevUnits();
|
||||
origscale = 1.0/15.0;
|
||||
|
||||
mCPixelScale = newscale / origscale;
|
||||
|
||||
aOrigContext->GetTwipsToDevUnits(t2d);
|
||||
aOrigContext->GetAppUnitsToDevUnits(a2d);
|
||||
t2d = aOrigContext->TwipsToDevUnits();
|
||||
a2d = aOrigContext->AppUnitsToDevUnits();
|
||||
|
||||
mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels;
|
||||
mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;
|
||||
|
@ -390,7 +390,7 @@ void
|
||||
nsFontMetricsOS2::SetFontHandle(HPS aPS, nsFontOS2* aFont)
|
||||
{
|
||||
float app2dev, reqEmHeight;
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mDeviceContext->AppUnitsToDevUnits();
|
||||
reqEmHeight = mFont.size * app2dev;
|
||||
|
||||
FATTRS* fattrs = &(aFont->mFattrs);
|
||||
@ -1481,7 +1481,7 @@ nsFontMetricsOS2::RealizeFont()
|
||||
fm.lInternalLeading = (signed short)fm.lInternalLeading;
|
||||
|
||||
float dev2app;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
mMaxAscent = NSToCoordRound( (fm.lMaxAscender-1) * dev2app );
|
||||
mMaxDescent = NSToCoordRound( (fm.lMaxDescender+1) * dev2app );
|
||||
|
@ -286,9 +286,9 @@ nsresult nsRenderingContextOS2::CommonInit()
|
||||
{
|
||||
float app2dev;
|
||||
|
||||
mContext->GetAppUnitsToDevUnits( app2dev);
|
||||
app2dev = mContext->AppUnitsToDevUnits();
|
||||
mTranMatrix->AddScale( app2dev, app2dev);
|
||||
mContext->GetDevUnitsToAppUnits( mP2T);
|
||||
mP2T = mContext->DevUnitsToAppUnits();
|
||||
|
||||
return SetupPS();
|
||||
}
|
||||
|
@ -102,11 +102,11 @@ NS_IMETHODIMP nsDeviceContextPh :: Init( nsNativeWidget aWidget ) {
|
||||
|
||||
CommonInit(NULL);
|
||||
|
||||
GetTwipsToDevUnits(newscale);
|
||||
GetAppUnitsToDevUnits(origscale);
|
||||
newscale = TwipsToDevUnits();
|
||||
origscale = AppUnitsToDevUnits();
|
||||
|
||||
GetTwipsToDevUnits(t2d);
|
||||
GetAppUnitsToDevUnits(a2d);
|
||||
t2d = TwipsToDevUnits();
|
||||
a2d = AppUnitsToDevUnits();
|
||||
|
||||
// Call my base class
|
||||
return DeviceContextImpl::Init( aWidget );
|
||||
@ -121,13 +121,13 @@ nsresult nsDeviceContextPh :: Init( nsNativeDeviceContext aContext, nsIDeviceCon
|
||||
|
||||
CommonInit(mDC);
|
||||
|
||||
GetTwipsToDevUnits(newscale);
|
||||
aOrigContext->GetAppUnitsToDevUnits(origscale);
|
||||
newscale = TwipsToDevUnits();
|
||||
origscale = aOrigContext->AppUnitsToDevUnits();
|
||||
|
||||
mPixelScale = newscale / origscale;
|
||||
|
||||
aOrigContext->GetTwipsToDevUnits(t2d);
|
||||
aOrigContext->GetAppUnitsToDevUnits(a2d);
|
||||
t2d = aOrigContext->TwipsToDevUnits();
|
||||
a2d = aOrigContext->AppUnitsToDevUnits();
|
||||
|
||||
mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels;
|
||||
mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;
|
||||
|
@ -184,7 +184,7 @@ printf( "\n\n\t\t\tIn nsFontMetricsPh::Init str=%s\n", str );
|
||||
}
|
||||
|
||||
float app2dev;
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mDeviceContext->AppUnitsToDevUnits();
|
||||
|
||||
PRInt32 sizePoints = NSToIntRound( app2dev * mFont->size * 0.74 );
|
||||
|
||||
@ -239,7 +239,7 @@ printf( "\tCall PfLoadMetrics for NSFullFontName=%s\n", NSFullFontName );
|
||||
double height;
|
||||
nscoord onePixel;
|
||||
|
||||
mDeviceContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mDeviceContext->DevUnitsToAppUnits();
|
||||
onePixel = NSToCoordRound(1 * dev2app);
|
||||
height = node->descender - node->ascender + 1.0;
|
||||
PfExtentText(&extent, NULL, NSFullFontName, " ", 1);
|
||||
|
@ -379,9 +379,9 @@ private:
|
||||
inline NS_IMETHODIMP CommonInit()
|
||||
{
|
||||
if( mContext && mTranMatrix ) {
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
mP2T = mContext->DevUnitsToAppUnits();
|
||||
float app2dev;
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mContext->AppUnitsToDevUnits();
|
||||
mTranMatrix->AddScale(app2dev, app2dev);
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -196,12 +196,12 @@ nsDeviceContextPS::InitDeviceContextPS(nsIDeviceContext *aCreatingDeviceContext,
|
||||
mTwipsToPixels = (float)72.0/(float)NSIntPointsToTwips(72);
|
||||
mPixelsToTwips = 1.0f / mTwipsToPixels;
|
||||
|
||||
GetTwipsToDevUnits(newscale);
|
||||
aParentContext->GetTwipsToDevUnits(origscale);
|
||||
newscale = TwipsToDevUnits();
|
||||
origscale = aParentContext->TwipsToDevUnits();
|
||||
mCPixelScale = newscale / origscale;
|
||||
|
||||
aParentContext->GetTwipsToDevUnits(t2d);
|
||||
aParentContext->GetAppUnitsToDevUnits(a2d);
|
||||
t2d = aParentContext->TwipsToDevUnits();
|
||||
a2d = aParentContext->AppUnitsToDevUnits();
|
||||
|
||||
mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels;
|
||||
mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;
|
||||
|
@ -160,7 +160,7 @@ nsFontMetricsPS::RealizeFont()
|
||||
{
|
||||
if (mFont && mDeviceContext) {
|
||||
float dev2app;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mDeviceContext->DevUnitsToAppUnits();
|
||||
fontps *font = (fontps*)mFontsPS->ElementAt(0);
|
||||
#ifdef MOZ_ENABLE_FREETYPE2
|
||||
NS_ASSERTION(font && font->entry, "no font available");
|
||||
@ -1137,7 +1137,7 @@ nsFontPSFreeType::Init(nsITrueTypeFontCatalogEntry* aEntry,
|
||||
float app2dev;
|
||||
nsIDeviceContext* dc = mFontMetrics->GetDeviceContext();
|
||||
NS_ENSURE_TRUE(dc, NS_ERROR_NULL_POINTER);
|
||||
dc->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = dc->AppUnitsToDevUnits();
|
||||
|
||||
mPixelSize = NSToIntRound(app2dev * mFont->size);
|
||||
|
||||
@ -1214,7 +1214,7 @@ nsFontPSFreeType::GetWidth(const PRUnichar* aString, PRUint32 aLength)
|
||||
NS_ENSURE_TRUE(dc, 0);
|
||||
|
||||
float dev2app;
|
||||
dc->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = dc->DevUnitsToAppUnits();
|
||||
origin_x *= dev2app;
|
||||
origin_x /= FT_REG_TO_16_16(1);
|
||||
|
||||
|
@ -184,7 +184,7 @@ nsRenderingContextPS::Init(nsIDeviceContext* aContext)
|
||||
NS_ENSURE_TRUE(nsnull != aContext, NS_ERROR_NULL_POINTER);
|
||||
|
||||
mContext = aContext;
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
mP2T = mContext->DevUnitsToAppUnits();
|
||||
|
||||
mPSObj = NS_REINTERPRET_CAST(nsDeviceContextPS *, mContext.get())->GetPrintContext();
|
||||
|
||||
|
@ -363,7 +363,7 @@ nsresult nsRenderingContextImpl::AllocateBackbuffer(const nsRect &aRequestedSize
|
||||
float p2t;
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
GetDeviceContext(*getter_AddRefs(dx));
|
||||
dx->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = dx->DevUnitsToAppUnits();
|
||||
nsRect bounds = aRequestedSize;
|
||||
bounds *= p2t;
|
||||
|
||||
@ -442,7 +442,7 @@ void nsRenderingContextImpl::CalculateDiscreteSurfaceSize(const nsRect& aMaxBack
|
||||
dx->GetDeviceSurfaceDimensions(width, height);
|
||||
|
||||
float devUnits;
|
||||
dx->GetDevUnitsToAppUnits(devUnits);
|
||||
devUnits = dx->DevUnitsToAppUnits();
|
||||
PRInt32 screenHeight = NSToIntRound(float( height) / devUnits );
|
||||
PRInt32 screenWidth = NSToIntRound(float( width) / devUnits );
|
||||
|
||||
|
@ -149,13 +149,13 @@ nsresult nsDeviceContextWin :: Init(nsNativeDeviceContext aContext, nsIDeviceCon
|
||||
CommonInit(mDC);
|
||||
|
||||
|
||||
GetTwipsToDevUnits(newscale);
|
||||
aOrigContext->GetTwipsToDevUnits(origscale);
|
||||
newscale = TwipsToDevUnits();
|
||||
origscale = aOrigContext->TwipsToDevUnits();
|
||||
|
||||
mPixelScale = newscale / origscale;
|
||||
|
||||
aOrigContext->GetTwipsToDevUnits(t2d);
|
||||
aOrigContext->GetAppUnitsToDevUnits(a2d);
|
||||
t2d = aOrigContext->TwipsToDevUnits();
|
||||
a2d = aOrigContext->AppUnitsToDevUnits();
|
||||
|
||||
mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels;
|
||||
mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;
|
||||
|
@ -500,9 +500,9 @@ nsFontMetricsWin::FillLogFont(LOGFONT* logFont, PRInt32 aWeight,
|
||||
PRBool aSizeOnly)
|
||||
{
|
||||
float app2dev, app2twip, scale;
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mDeviceContext->AppUnitsToDevUnits();
|
||||
if (nsDeviceContextWin::gRound) {
|
||||
mDeviceContext->GetDevUnitsToTwips(app2twip);
|
||||
app2twip = mDeviceContext->DevUnitsToTwips();
|
||||
mDeviceContext->GetCanonicalPixelScale(scale);
|
||||
app2twip *= app2dev * scale;
|
||||
|
||||
@ -2283,7 +2283,7 @@ void
|
||||
nsFontMetricsWin::InitMetricsFor(HDC aDC, nsFontWin* aFont)
|
||||
{
|
||||
float dev2app;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
TEXTMETRIC metrics;
|
||||
::GetTextMetrics(aDC, &metrics);
|
||||
@ -2338,7 +2338,7 @@ nsFontMetricsWin::CreateFontAdjustHandle(HDC aDC, LOGFONT* aLogFont)
|
||||
if (::GetTextFace(aDC, sizeof(name), name) &&
|
||||
!strcmpi(name, aLogFont->lfFaceName)) {
|
||||
float dev2app;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
// Get the x-height
|
||||
nscoord xheight72;
|
||||
@ -3667,7 +3667,7 @@ nsFontMetricsWin::RealizeFont()
|
||||
|
||||
// Get font metrics
|
||||
float dev2app;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(dev2app);
|
||||
dev2app = mDeviceContext->DevUnitsToAppUnits();
|
||||
OUTLINETEXTMETRIC oMetrics;
|
||||
TEXTMETRIC& metrics = oMetrics.otmTextMetrics;
|
||||
nscoord onePixel = NSToCoordRound(1 * dev2app);
|
||||
|
@ -494,9 +494,9 @@ nsresult nsRenderingContextWin :: CommonInit(void)
|
||||
{
|
||||
float app2dev;
|
||||
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mContext->AppUnitsToDevUnits();
|
||||
mTranMatrix->AddScale(app2dev, app2dev);
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
mP2T = mContext->DevUnitsToAppUnits();
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
mInitialized = PR_TRUE;
|
||||
|
@ -1809,7 +1809,7 @@ NS_IMETHODIMP nsFontMetricsXlib::Init(const nsFont& aFont, nsIAtom* aLangGroup,
|
||||
mLangGroup = aLangGroup;
|
||||
|
||||
float app2dev;
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mDeviceContext->AppUnitsToDevUnits();
|
||||
|
||||
mPixelSize = NSToIntRound(app2dev * mFont->size);
|
||||
// Make sure to clamp the pixel size to something reasonable so we
|
||||
@ -1908,7 +1908,7 @@ NS_IMETHODIMP nsFontMetricsXlib::Destroy()
|
||||
void nsFontMetricsXlib::RealizeFont()
|
||||
{
|
||||
float f;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
#ifdef USE_FREETYPE
|
||||
if (mWesternFont->IsFreeTypeFont()) {
|
||||
@ -1996,7 +1996,7 @@ void nsFontMetricsXlib::RealizeFont()
|
||||
#endif /* USE_FREETYPE */
|
||||
nsXFont *xFont = mWesternFont->GetXFont();
|
||||
XFontStruct *fontInfo = xFont->GetXFontStruct();
|
||||
mDeviceContext->GetDevUnitsToAppUnits(f);
|
||||
f = mDeviceContext->DevUnitsToAppUnits();
|
||||
|
||||
nscoord lineSpacing = nscoord((fontInfo->ascent + fontInfo->descent) * f);
|
||||
mEmHeight = PR_MAX(1, nscoord(mWesternFont->mSize * f));
|
||||
|
@ -318,7 +318,7 @@ public:
|
||||
PRInt16 mBaselineAdjust;
|
||||
|
||||
// these values are not in app units, they need to be scaled with
|
||||
// nsIDeviceContext::GetDevUnitsToAppUnits()
|
||||
// nsIDeviceContext::DevUnitsToAppUnits()
|
||||
PRInt16 mMaxAscent;
|
||||
PRInt16 mMaxDescent;
|
||||
|
||||
|
@ -251,9 +251,9 @@ nsresult nsRenderingContextXlib::CommonInit(void)
|
||||
mClipRegion->Init();
|
||||
mClipRegion->SetTo(0, 0, width, height);
|
||||
|
||||
mContext->GetDevUnitsToAppUnits(mP2T);
|
||||
mP2T = mContext->DevUnitsToAppUnits();
|
||||
float app2dev;
|
||||
mContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mContext->AppUnitsToDevUnits();
|
||||
mTranMatrix->AddScale(app2dev, app2dev);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ nsDeviceContextXp::InitDeviceContextXP(nsIDeviceContext *aCreatingDeviceContext,
|
||||
mPixelsToTwips = (float)NSIntPointsToTwips(72) / (float)print_resolution;
|
||||
mTwipsToPixels = 1.0f / mPixelsToTwips;
|
||||
|
||||
GetTwipsToDevUnits(newscale);
|
||||
aParentContext->GetTwipsToDevUnits(origscale);
|
||||
newscale = TwipsToDevUnits();
|
||||
origscale = aParentContext->TwipsToDevUnits();
|
||||
|
||||
mCPixelScale = newscale / origscale;
|
||||
|
||||
aParentContext->GetTwipsToDevUnits(t2d);
|
||||
aParentContext->GetAppUnitsToDevUnits(a2d);
|
||||
t2d = aParentContext->TwipsToDevUnits();
|
||||
a2d = aParentContext->AppUnitsToDevUnits();
|
||||
|
||||
mAppUnitsToDevUnits = (a2d / t2d) * mTwipsToPixels;
|
||||
mDevUnitsToAppUnits = 1.0f / mAppUnitsToDevUnits;
|
||||
|
@ -98,7 +98,7 @@ nsPoint *pointlist;
|
||||
nsIDeviceContext* deviceContext;
|
||||
aSurface->GetDeviceContext(deviceContext);
|
||||
float p2t; // pixel to twips conversion
|
||||
deviceContext->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = deviceContext->DevUnitsToAppUnits();
|
||||
NS_RELEASE(deviceContext);
|
||||
|
||||
font = new nsFont("Times", NS_FONT_STYLE_NORMAL,NS_FONT_VARIANT_NORMAL,NS_FONT_WEIGHT_BOLD,0,12);
|
||||
|
@ -1030,7 +1030,7 @@ void nsCaret::GetCaretRectAndInvert()
|
||||
if (mCaretTwipsWidth < 0) // need to re-compute the pixel width
|
||||
{
|
||||
float tDevUnitsToTwips;
|
||||
presContext->DeviceContext()->GetDevUnitsToTwips(tDevUnitsToTwips);
|
||||
tDevUnitsToTwips = presContext->DeviceContext()->DevUnitsToTwips();
|
||||
mCaretTwipsWidth = (nscoord)(tDevUnitsToTwips * (float)mCaretPixelsWidth);
|
||||
}
|
||||
caretRect.width = mCaretTwipsWidth;
|
||||
|
@ -937,7 +937,7 @@ nsPresContext::GetPixelsToTwips(float* aResult) const
|
||||
NS_PRECONDITION(aResult, "null out param");
|
||||
|
||||
float p2t;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = mDeviceContext->DevUnitsToAppUnits();
|
||||
*aResult = p2t;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -947,7 +947,7 @@ nsPresContext::GetTwipsToPixels(float* aResult) const
|
||||
{
|
||||
NS_PRECONDITION(aResult, "null out param");
|
||||
|
||||
mDeviceContext->GetAppUnitsToDevUnits(*aResult);
|
||||
*aResult = mDeviceContext->AppUnitsToDevUnits();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -968,12 +968,12 @@ nsPresContext::GetTwipsToPixelsForFonts(float* aResult) const
|
||||
nsCOMPtr<nsIDeviceContext> altDC;
|
||||
mDeviceContext->GetAltDevice(getter_AddRefs(altDC));
|
||||
if (altDC) {
|
||||
altDC->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = altDC->AppUnitsToDevUnits();
|
||||
} else {
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mDeviceContext->AppUnitsToDevUnits();
|
||||
}
|
||||
#else
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mDeviceContext->AppUnitsToDevUnits();
|
||||
#endif
|
||||
*aResult = app2dev;
|
||||
return NS_OK;
|
||||
@ -989,7 +989,7 @@ nsPresContext::GetScaledPixelsToTwips(float* aResult) const
|
||||
float scale;
|
||||
float p2t;
|
||||
|
||||
mDeviceContext->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = mDeviceContext->DevUnitsToAppUnits();
|
||||
mDeviceContext->GetCanonicalPixelScale(scale);
|
||||
scale = p2t * scale;
|
||||
|
||||
|
@ -1030,7 +1030,7 @@ void nsCaret::GetCaretRectAndInvert()
|
||||
if (mCaretTwipsWidth < 0) // need to re-compute the pixel width
|
||||
{
|
||||
float tDevUnitsToTwips;
|
||||
presContext->DeviceContext()->GetDevUnitsToTwips(tDevUnitsToTwips);
|
||||
tDevUnitsToTwips = presContext->DeviceContext()->DevUnitsToTwips();
|
||||
mCaretTwipsWidth = (nscoord)(tDevUnitsToTwips * (float)mCaretPixelsWidth);
|
||||
}
|
||||
caretRect.width = mCaretTwipsWidth;
|
||||
|
@ -937,7 +937,7 @@ nsPresContext::GetPixelsToTwips(float* aResult) const
|
||||
NS_PRECONDITION(aResult, "null out param");
|
||||
|
||||
float p2t;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = mDeviceContext->DevUnitsToAppUnits();
|
||||
*aResult = p2t;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -947,7 +947,7 @@ nsPresContext::GetTwipsToPixels(float* aResult) const
|
||||
{
|
||||
NS_PRECONDITION(aResult, "null out param");
|
||||
|
||||
mDeviceContext->GetAppUnitsToDevUnits(*aResult);
|
||||
*aResult = mDeviceContext->AppUnitsToDevUnits();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -968,12 +968,12 @@ nsPresContext::GetTwipsToPixelsForFonts(float* aResult) const
|
||||
nsCOMPtr<nsIDeviceContext> altDC;
|
||||
mDeviceContext->GetAltDevice(getter_AddRefs(altDC));
|
||||
if (altDC) {
|
||||
altDC->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = altDC->AppUnitsToDevUnits();
|
||||
} else {
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mDeviceContext->AppUnitsToDevUnits();
|
||||
}
|
||||
#else
|
||||
mDeviceContext->GetAppUnitsToDevUnits(app2dev);
|
||||
app2dev = mDeviceContext->AppUnitsToDevUnits();
|
||||
#endif
|
||||
*aResult = app2dev;
|
||||
return NS_OK;
|
||||
@ -989,7 +989,7 @@ nsPresContext::GetScaledPixelsToTwips(float* aResult) const
|
||||
float scale;
|
||||
float p2t;
|
||||
|
||||
mDeviceContext->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = mDeviceContext->DevUnitsToAppUnits();
|
||||
mDeviceContext->GetCanonicalPixelScale(scale);
|
||||
scale = p2t * scale;
|
||||
|
||||
|
@ -183,7 +183,7 @@ PrintPreviewContext::GetScaledPixelsToTwips(float* aResult) const
|
||||
if (mDeviceContext)
|
||||
{
|
||||
float p2t;
|
||||
mDeviceContext->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = mDeviceContext->DevUnitsToAppUnits();
|
||||
if (mDoScaledTwips) {
|
||||
mDeviceContext->GetCanonicalPixelScale(scale);
|
||||
scale = p2t * scale;
|
||||
|
@ -878,7 +878,7 @@ nsFormControlFrame::GetScreenHeight(nsIPresContext* aPresContext,
|
||||
context->GetClientRect(screen);
|
||||
|
||||
float devUnits;
|
||||
context->GetDevUnitsToAppUnits(devUnits);
|
||||
devUnits = context->DevUnitsToAppUnits();
|
||||
aHeight = NSToIntRound(float(screen.height) / devUnits );
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -878,7 +878,7 @@ nsFormControlFrame::GetScreenHeight(nsIPresContext* aPresContext,
|
||||
context->GetClientRect(screen);
|
||||
|
||||
float devUnits;
|
||||
context->GetDevUnitsToAppUnits(devUnits);
|
||||
devUnits = context->DevUnitsToAppUnits();
|
||||
aHeight = NSToIntRound(float(screen.height) / devUnits );
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -1608,8 +1608,8 @@ int main(int argc, char** argv)
|
||||
|
||||
if (NS_OK == rv) {
|
||||
dx->Init(nsull);
|
||||
dx->SetDevUnitsToAppUnits(dx->GetDevUnitsToTwips());
|
||||
dx->SetAppUnitsToDevUnits(dx->GetTwipsToDevUnits());
|
||||
dx->SetDevUnitsToAppUnits(dx->DevUnitsToTwips());
|
||||
dx->SetAppUnitsToDevUnits(dx->TwipsToDevUnits());
|
||||
}
|
||||
|
||||
NS_NewGalleyContext(&presContext);
|
||||
|
@ -449,8 +449,8 @@ GeometryTest::GeometryTest(BasicTest *aDoc)
|
||||
|
||||
if (NS_OK == rv) {
|
||||
dx->Init(nsnull);
|
||||
dx->SetDevUnitsToAppUnits(dx->GetDevUnitsToTwips());
|
||||
dx->SetAppUnitsToDevUnits(dx->GetTwipsToDevUnits());
|
||||
dx->SetDevUnitsToAppUnits(dx->DevUnitsToTwips());
|
||||
dx->SetAppUnitsToDevUnits(dx->TwipsToDevUnits());
|
||||
}
|
||||
|
||||
nsIPresContext * pc = nsnull;
|
||||
|
@ -829,11 +829,11 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
|
||||
// DEVICE CONTEXT INFORMATION from PresContext
|
||||
nsIDeviceContext *dx = mPresContext->DeviceContext();
|
||||
printf("DeviceContext of Presentation Context(%x)\n", dx);
|
||||
dx->GetDevUnitsToTwips(a1);
|
||||
dx->GetTwipsToDevUnits(a2);
|
||||
a1 = dx->DevUnitsToTwips();
|
||||
a2 = dx->TwipsToDevUnits();
|
||||
printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2);
|
||||
dx->GetAppUnitsToDevUnits(a1);
|
||||
dx->GetDevUnitsToAppUnits(a2);
|
||||
a1 = dx->AppUnitsToDevUnits();
|
||||
a2 = dx->DevUnitsToAppUnits();
|
||||
printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2);
|
||||
dx->GetCanonicalPixelScale(a1);
|
||||
printf(" GetCanonicalPixelScale = %f\n",a1);
|
||||
@ -849,11 +849,11 @@ nsPrintEngine::Print(nsIPrintSettings* aPrintSettings,
|
||||
|
||||
// DEVICE CONTEXT INFORMATION
|
||||
printf("DeviceContext created for print(%x)\n",mPrt->mPrintDC);
|
||||
mPrt->mPrintDC->GetDevUnitsToTwips(a1);
|
||||
mPrt->mPrintDC->GetTwipsToDevUnits(a2);
|
||||
a1 = mPrt->mPrintDC->DevUnitsToTwips();
|
||||
a2 = mPrt->mPrintDC->TwipsToDevUnits();
|
||||
printf(" DevToTwips = %f TwipToDev = %f\n",a1,a2);
|
||||
mPrt->mPrintDC->GetAppUnitsToDevUnits(a1);
|
||||
mPrt->mPrintDC->GetDevUnitsToAppUnits(a2);
|
||||
a1 = mPrt->mPrintDC->AppUnitsToDevUnits();
|
||||
a2 = mPrt->mPrintDC->DevUnitsToAppUnits();
|
||||
printf(" AppUnitsToDev = %f DevUnitsToApp = %f\n",a1,a2);
|
||||
mPrt->mPrintDC->GetCanonicalPixelScale(a1);
|
||||
printf(" GetCanonicalPixelScale = %f\n",a1);
|
||||
|
@ -911,7 +911,7 @@ nsMenuPopupFrame::SyncViewWithFrame(nsIPresContext* aPresContext,
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
viewManager->GetDeviceContext(*getter_AddRefs(dx));
|
||||
dx->GetAppUnitsToDevUnits(t2p);
|
||||
t2p = dx->AppUnitsToDevUnits();
|
||||
|
||||
// get the document and the global script object
|
||||
nsIPresShell *presShell = aPresContext->PresShell();
|
||||
|
@ -346,8 +346,8 @@ NS_IMETHODIMP nsScrollPortView::ScrollTo(nscoord aDestinationX, nscoord aDestina
|
||||
nsCOMPtr<nsIDeviceContext> dev;
|
||||
mViewManager->GetDeviceContext(*getter_AddRefs(dev));
|
||||
float p2t, t2p;
|
||||
dev->GetDevUnitsToAppUnits(p2t);
|
||||
dev->GetAppUnitsToDevUnits(t2p);
|
||||
p2t = dev->DevUnitsToAppUnits();
|
||||
t2p = dev->AppUnitsToDevUnits();
|
||||
|
||||
// compute velocity vectors
|
||||
ComputeVelocities(currentVelocityX, mOffsetX,
|
||||
@ -584,8 +584,8 @@ NS_IMETHODIMP nsScrollPortView::ScrollToImpl(nscoord aX, nscoord aY, PRUint32 aU
|
||||
float p2t;
|
||||
|
||||
mViewManager->GetDeviceContext(dev);
|
||||
dev->GetAppUnitsToDevUnits(t2p);
|
||||
dev->GetDevUnitsToAppUnits(p2t);
|
||||
t2p = dev->AppUnitsToDevUnits();
|
||||
p2t = dev->DevUnitsToAppUnits();
|
||||
|
||||
NS_RELEASE(dev);
|
||||
|
||||
|
@ -322,7 +322,7 @@ void nsView::ResetWidgetPosition(PRBool aRecurse) {
|
||||
float scale;
|
||||
|
||||
mViewManager->GetDeviceContext(dx);
|
||||
dx->GetAppUnitsToDevUnits(scale);
|
||||
scale = dx->AppUnitsToDevUnits();
|
||||
NS_RELEASE(dx);
|
||||
|
||||
nsPoint offset(0, 0);
|
||||
@ -349,7 +349,7 @@ NS_IMETHODIMP nsView::SynchWidgetSizePosition()
|
||||
float t2p;
|
||||
|
||||
mViewManager->GetDeviceContext(dx);
|
||||
dx->GetAppUnitsToDevUnits(t2p);
|
||||
t2p = dx->AppUnitsToDevUnits();
|
||||
NS_RELEASE(dx);
|
||||
// if we just resized do it
|
||||
if (mVFlags & NS_VIEW_FLAG_WIDGET_RESIZED)
|
||||
@ -422,7 +422,7 @@ void nsView::SetDimensions(const nsRect& aRect, PRBool aPaint)
|
||||
float t2p;
|
||||
|
||||
mViewManager->GetDeviceContext(dx);
|
||||
dx->GetAppUnitsToDevUnits(t2p);
|
||||
t2p = dx->AppUnitsToDevUnits();
|
||||
|
||||
if (needToMoveWidget) {
|
||||
NS_ASSERTION(GetParent(), "Don't try to move the root widget, dude");
|
||||
@ -562,7 +562,7 @@ nsresult nsIView::CreateWidget(const nsIID &aWindowIID,
|
||||
NS_IF_RELEASE(mWindow);
|
||||
|
||||
mViewManager->GetDeviceContext(dx);
|
||||
dx->GetAppUnitsToDevUnits(scale);
|
||||
scale = dx->AppUnitsToDevUnits();
|
||||
|
||||
trect *= scale;
|
||||
|
||||
@ -671,7 +671,7 @@ void nsIView::List(FILE* out, PRInt32 aIndent) const
|
||||
float p2t;
|
||||
nsIDeviceContext *dx;
|
||||
mViewManager->GetDeviceContext(dx);
|
||||
dx->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = dx->DevUnitsToAppUnits();
|
||||
NS_RELEASE(dx);
|
||||
mWindow->GetClientBounds(windowBounds);
|
||||
windowBounds *= p2t;
|
||||
|
@ -544,8 +544,8 @@ NS_IMETHODIMP nsViewManager::Init(nsIDeviceContext* aContext)
|
||||
return NS_ERROR_ALREADY_INITIALIZED;
|
||||
}
|
||||
mContext = aContext;
|
||||
mContext->GetAppUnitsToDevUnits(mTwipsToPixels);
|
||||
mContext->GetDevUnitsToAppUnits(mPixelsToTwips);
|
||||
mTwipsToPixels = mContext->AppUnitsToDevUnits();
|
||||
mPixelsToTwips = mContext->DevUnitsToAppUnits();
|
||||
|
||||
mRefreshEnabled = PR_TRUE;
|
||||
|
||||
@ -705,7 +705,7 @@ static void ConvertNativeRegionToAppRegion(nsIRegion* aIn, nsRegion* aOut,
|
||||
return;
|
||||
|
||||
float p2t;
|
||||
context->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = context->DevUnitsToAppUnits();
|
||||
|
||||
PRUint32 i;
|
||||
for (i = 0; i < rects->mNumRects; i++) {
|
||||
@ -825,7 +825,7 @@ void nsViewManager::Refresh(nsView *aView, nsIRenderingContext *aContext,
|
||||
nsRect widgetDamageRectInPixels = damageRect;
|
||||
widgetDamageRectInPixels.MoveBy(-viewRect.x, -viewRect.y);
|
||||
float t2p;
|
||||
mContext->GetAppUnitsToDevUnits(t2p);
|
||||
t2p = mContext->AppUnitsToDevUnits();
|
||||
widgetDamageRectInPixels.ScaleRoundOut(t2p);
|
||||
|
||||
if (aUpdateFlags & NS_VMREFRESH_DOUBLE_BUFFER)
|
||||
@ -1817,7 +1817,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
||||
{
|
||||
// Convert from pixels to twips
|
||||
float p2t;
|
||||
mContext->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = mContext->DevUnitsToAppUnits();
|
||||
|
||||
//printf("resize: (pix) %d, %d\n", width, height);
|
||||
SetWindowDimensions(NSIntPixelsToTwips(width, p2t),
|
||||
@ -1862,7 +1862,7 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
||||
nsRect damRect;
|
||||
region->GetBoundingBox(&damRect.x, &damRect.y, &damRect.width, &damRect.height);
|
||||
float p2t;
|
||||
mContext->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = mContext->DevUnitsToAppUnits();
|
||||
damRect.ScaleRoundOut(p2t);
|
||||
DefaultRefresh(view, &damRect);
|
||||
|
||||
@ -1964,9 +1964,9 @@ NS_IMETHODIMP nsViewManager::DispatchEvent(nsGUIEvent *aEvent, nsEventStatus *aS
|
||||
|
||||
if (nsnull != view) {
|
||||
float t2p;
|
||||
mContext->GetAppUnitsToDevUnits(t2p);
|
||||
t2p = mContext->AppUnitsToDevUnits();
|
||||
float p2t;
|
||||
mContext->GetDevUnitsToAppUnits(p2t);
|
||||
p2t = mContext->DevUnitsToAppUnits();
|
||||
|
||||
//Calculate the proper offset for the view we're going to
|
||||
offset.x = offset.y = 0;
|
||||
@ -3840,7 +3840,7 @@ void nsViewManager::ViewToWidget(nsView *aView, nsView* aWidgetView, nsRect &aRe
|
||||
|
||||
// finally, convert to device coordinates.
|
||||
float t2p;
|
||||
mContext->GetAppUnitsToDevUnits(t2p);
|
||||
t2p = mContext->AppUnitsToDevUnits();
|
||||
aRect.ScaleRoundOut(t2p);
|
||||
}
|
||||
|
||||
|
@ -1500,9 +1500,9 @@ nsBrowserWindow::CreateToolBar(PRInt32 aWidth)
|
||||
|
||||
nsIDeviceContext* dc = mWindow->GetDeviceContext();
|
||||
float t2d;
|
||||
dc->GetTwipsToDevUnits(t2d);
|
||||
t2d = dc->TwipsToDevUnits();
|
||||
float d2a;
|
||||
dc->GetDevUnitsToAppUnits(d2a);
|
||||
d2a = dc->DevUnitsToAppUnits();
|
||||
nsFont font(TOOL_BAR_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL, 0,
|
||||
nscoord(NSIntPointsToTwips(TOOL_BAR_FONT_SIZE) * t2d * d2a));
|
||||
@ -1612,7 +1612,7 @@ nsBrowserWindow::CreateStatusBar(PRInt32 aWidth)
|
||||
|
||||
nsIDeviceContext* dc = mWindow->GetDeviceContext();
|
||||
float t2d;
|
||||
dc->GetTwipsToDevUnits(t2d);
|
||||
t2d = dc->TwipsToDevUnits();
|
||||
nsFont font(STATUS_BAR_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL, 0,
|
||||
nscoord(t2d * NSIntPointsToTwips(STATUS_BAR_FONT_SIZE)));
|
||||
|
@ -920,7 +920,7 @@ PRBool CreateRobotDialog(nsIWidget * aParent)
|
||||
|
||||
nsIDeviceContext* dc = aParent->GetDeviceContext();
|
||||
float t2d;
|
||||
dc->GetTwipsToDevUnits(t2d);
|
||||
t2d = dc->TwipsToDevUnits();
|
||||
nsFont font(DIALOG_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL, 0,
|
||||
nscoord(t2d * NSIntPointsToTwips(DIALOG_FONT_SIZE)));
|
||||
@ -1363,7 +1363,7 @@ PRBool CreateSiteDialog(nsIWidget * aParent)
|
||||
|
||||
nsIDeviceContext* dc = aParent->GetDeviceContext();
|
||||
float t2d;
|
||||
dc->GetTwipsToDevUnits(t2d);
|
||||
t2d = dc->TwipsToDevUnits();
|
||||
nsFont font(DIALOG_FONT, NS_FONT_STYLE_NORMAL, NS_FONT_VARIANT_NORMAL,
|
||||
NS_FONT_WEIGHT_NORMAL, 0,
|
||||
nscoord(t2d * NSIntPointsToTwips(DIALOG_FONT_SIZE)));
|
||||
|
@ -218,8 +218,8 @@ NS_METHOD nsButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetAppUnitsToDevUnits(devUnits);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
devUnits = context->AppUnitsToDevUnits();
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
nsRect rect;
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
@ -250,7 +250,7 @@ NS_METHOD nsCheckButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
||||
|
@ -237,7 +237,7 @@ NS_METHOD nsTextWidget::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
||||
|
@ -228,8 +228,8 @@ NS_METHOD nsButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetAppUnitsToDevUnits(devUnits);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
devUnits = context->AppUnitsToDevUnits();
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
nsRect rect;
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
@ -257,7 +257,7 @@ NS_METHOD nsCheckButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
||||
|
@ -248,7 +248,7 @@ NS_METHOD nsTextWidget::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
||||
|
@ -165,8 +165,8 @@ NS_METHOD nsButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetAppUnitsToDevUnits(devUnits);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
devUnits = context->AppUnitsToDevUnits();
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
nsRect rect;
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
@ -192,7 +192,7 @@ NS_METHOD nsCheckButton::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
||||
|
@ -143,7 +143,7 @@ NS_METHOD nsTextWidget::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
|
||||
|
@ -2318,7 +2318,7 @@ nsChildView::Idle()
|
||||
|
||||
// convert to the nsIView coordinates
|
||||
float mPixelsToTwips = 1.0;
|
||||
mGeckoChild->GetDeviceContext()->GetDevUnitsToAppUnits(mPixelsToTwips);
|
||||
mPixelsToTwips = mGeckoChild->GetDeviceContext()->DevUnitsToAppUnits();
|
||||
nscoord newX = mHandScrollStartScrollX +
|
||||
NSIntPixelsToTwips(deltaX, mPixelsToTwips);
|
||||
nscoord newY = mHandScrollStartScrollY +
|
||||
|
@ -1586,8 +1586,8 @@ nsIFontMetrics *nsWindow::GetFont(void)
|
||||
if( 2 == sscanf( buf[0], "%d.%s", &ptSize, buf[1])) // mmm, scanf()...
|
||||
{
|
||||
float twip2dev, twip2app;
|
||||
mContext->GetTwipsToDevUnits( twip2dev);
|
||||
mContext->GetDevUnitsToAppUnits( twip2app);
|
||||
twip2dev = mContext->TwipsToDevUnits();
|
||||
twip2app = mContext->DevUnitsToAppUnits();
|
||||
twip2app *= twip2dev;
|
||||
|
||||
nscoord appSize = (nscoord) (twip2app * ptSize * 20);
|
||||
@ -1614,8 +1614,8 @@ NS_METHOD nsWindow::SetFont(const nsFont &aFont)
|
||||
// jump through hoops to convert the size in the font (in app units)
|
||||
// into points.
|
||||
float dev2twip, app2twip;
|
||||
mContext->GetDevUnitsToTwips( dev2twip);
|
||||
mContext->GetAppUnitsToDevUnits( app2twip);
|
||||
dev2twip = mContext->DevUnitsToTwips();
|
||||
app2twip = mContext->AppUnitsToDevUnits();
|
||||
app2twip *= dev2twip;
|
||||
|
||||
int points = NSTwipsToFloorIntPoints( nscoord( aFont.size * app2twip));
|
||||
|
@ -850,7 +850,7 @@ NS_METHOD nsBaseWidget::Paint(nsIRenderingContext& aRenderingContext,
|
||||
aRenderingContext.GetDeviceContext(context);
|
||||
|
||||
context->GetCanonicalPixelScale(scale);
|
||||
context->GetDevUnitsToAppUnits(appUnits);
|
||||
appUnits = context->DevUnitsToAppUnits();
|
||||
|
||||
GetBoundsAppUnits(rect, appUnits);
|
||||
aRenderingContext.SetColor(NS_RGB(0,0,0));
|
||||
|
Loading…
Reference in New Issue
Block a user