зеркало из https://github.com/mozilla/gecko-dev.git
Bug 266236 part 8: Change nsRenderingContext::GetDeviceContext and ::GetFontMetrics to return bare pointers.
--HG-- rename : gfx/src/nsThebesRenderingContext.cpp => gfx/src/nsRenderingContext.cpp rename : gfx/src/nsThebesRenderingContext.h => gfx/src/nsRenderingContext.h extra : rebase_source : 36dd32d715cb75e99cd3a69e460c000c1777d6a6
This commit is contained in:
Родитель
f8eccd9ec7
Коммит
86131020a5
|
@ -100,12 +100,9 @@ nsRenderingContext::Init(nsIDeviceContext* aContext,
|
|||
mP2A = mDeviceContext->AppUnitsPerDevPixel();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIDeviceContext>
|
||||
nsRenderingContext::GetDeviceContext()
|
||||
{
|
||||
NS_IF_ADDREF(mDeviceContext);
|
||||
return mDeviceContext.get();
|
||||
}
|
||||
//
|
||||
// graphics state
|
||||
//
|
||||
|
||||
void
|
||||
nsRenderingContext::PushState()
|
||||
|
@ -119,10 +116,6 @@ nsRenderingContext::PopState()
|
|||
mThebes->Restore();
|
||||
}
|
||||
|
||||
//
|
||||
// clipping
|
||||
//
|
||||
|
||||
void
|
||||
nsRenderingContext::IntersectClip(const nsRect& aRect)
|
||||
{
|
||||
|
@ -208,6 +201,10 @@ nsRenderingContext::Scale(float aSx, float aSy)
|
|||
mThebes->Scale(aSx, aSy);
|
||||
}
|
||||
|
||||
//
|
||||
// shapes
|
||||
//
|
||||
|
||||
void
|
||||
nsRenderingContext::DrawLine(const nsPoint& aStartPt, const nsPoint& aEndPt)
|
||||
{
|
||||
|
@ -445,7 +442,9 @@ nsRenderingContext::FillPolygon(const nsPoint twPoints[], PRInt32 aNumPoints)
|
|||
mThebes->Fill();
|
||||
}
|
||||
|
||||
//
|
||||
// text
|
||||
//
|
||||
|
||||
void
|
||||
nsRenderingContext::SetRightToLeftText(PRBool aIsRTL)
|
||||
|
@ -485,13 +484,6 @@ nsRenderingContext::SetFont(nsIFontMetrics *aFontMetrics)
|
|||
mFontMetrics = static_cast<nsIThebesFontMetrics*>(aFontMetrics);
|
||||
}
|
||||
|
||||
already_AddRefed<nsIFontMetrics>
|
||||
nsRenderingContext::GetFontMetrics()
|
||||
{
|
||||
NS_IF_ADDREF(mFontMetrics);
|
||||
return mFontMetrics.get();
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsRenderingContext::GetMaxChunkLength()
|
||||
{
|
||||
|
|
|
@ -142,8 +142,10 @@ public:
|
|||
void Init(nsIDeviceContext* aContext, gfxASurface* aThebesSurface);
|
||||
void Init(nsIDeviceContext* aContext, gfxContext* aThebesContext);
|
||||
|
||||
already_AddRefed<nsIDeviceContext> GetDeviceContext();
|
||||
// These accessors will never return null.
|
||||
gfxContext *ThebesContext() { return mThebes; }
|
||||
nsIDeviceContext *DeviceContext() { return mDeviceContext; }
|
||||
PRInt32 AppUnitsPerDevPixel() { return mP2A; }
|
||||
|
||||
// Graphics state
|
||||
|
||||
|
@ -194,7 +196,7 @@ public:
|
|||
gfxUserFontSet *aUserFontSet);
|
||||
void SetFont(const nsFont& aFont, gfxUserFontSet *aUserFontSet);
|
||||
void SetFont(nsIFontMetrics *aFontMetrics);
|
||||
already_AddRefed<nsIFontMetrics> GetFontMetrics();
|
||||
nsIThebesFontMetrics *FontMetrics() { return mFontMetrics; } // may be null
|
||||
|
||||
void SetRightToLeftText(PRBool aIsRTL);
|
||||
void SetTextRunRTL(PRBool aIsRTL);
|
||||
|
|
|
@ -1785,10 +1785,8 @@ public:
|
|||
virtual void DrawText(nscoord aXOffset,
|
||||
nscoord)
|
||||
{
|
||||
nsCOMPtr<nsIFontMetrics> metrics = mCtx->GetFontMetrics();
|
||||
nsIThebesFontMetrics* fm = static_cast<nsIThebesFontMetrics*>(metrics.get());
|
||||
fm->DrawString(mText, mLength, mPt.x + aXOffset, mPt.y,
|
||||
mCtx, mTextRunConstructionContext);
|
||||
mCtx->FontMetrics()->DrawString(mText, mLength, mPt.x + aXOffset, mPt.y,
|
||||
mCtx, mTextRunConstructionContext);
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -3264,8 +3264,7 @@ DrawImageInternal(nsRenderingContext* aRenderingContext,
|
|||
const nsIntSize& aImageSize,
|
||||
PRUint32 aImageFlags)
|
||||
{
|
||||
nsCOMPtr<nsIDeviceContext> dc = aRenderingContext->GetDeviceContext();
|
||||
PRInt32 appUnitsPerDevPixel = dc->AppUnitsPerDevPixel();
|
||||
PRInt32 appUnitsPerDevPixel = aRenderingContext->AppUnitsPerDevPixel();
|
||||
gfxContext* ctx = aRenderingContext->ThebesContext();
|
||||
|
||||
SnappedImageDrawingParameters drawingParams =
|
||||
|
@ -3295,8 +3294,7 @@ nsLayoutUtils::DrawPixelSnapped(nsRenderingContext* aRenderingContext,
|
|||
const nsPoint& aAnchor,
|
||||
const nsRect& aDirty)
|
||||
{
|
||||
nsCOMPtr<nsIDeviceContext> dc = aRenderingContext->GetDeviceContext();
|
||||
PRInt32 appUnitsPerDevPixel = dc->AppUnitsPerDevPixel();
|
||||
PRInt32 appUnitsPerDevPixel = aRenderingContext->AppUnitsPerDevPixel();
|
||||
gfxContext* ctx = aRenderingContext->ThebesContext();
|
||||
gfxIntSize drawableSize = aDrawable->Size();
|
||||
nsIntSize imageSize(drawableSize.width, drawableSize.height);
|
||||
|
|
|
@ -152,7 +152,7 @@ BRFrame::Reflow(nsPresContext* aPresContext,
|
|||
// normal inline frame. That line-height is used is important
|
||||
// here for cases where the line-height is less than 1.
|
||||
nsLayoutUtils::SetFontFromStyle(aReflowState.rendContext, mStyleContext);
|
||||
nsCOMPtr<nsIFontMetrics> fm = aReflowState.rendContext->GetFontMetrics();
|
||||
nsIFontMetrics *fm = aReflowState.rendContext->FontMetrics();
|
||||
if (fm) {
|
||||
nscoord logicalHeight = aReflowState.CalcLineHeight();
|
||||
aMetrics.height = logicalHeight;
|
||||
|
|
|
@ -2370,10 +2370,10 @@ nsBlockFrame::ReflowDirtyLines(nsBlockReflowState& aState)
|
|||
|
||||
nsRenderingContext *rc = aState.mReflowState.rendContext;
|
||||
nsLayoutUtils::SetFontFromStyle(rc, GetStyleContext());
|
||||
nsCOMPtr<nsIFontMetrics> fm = rc->GetFontMetrics();
|
||||
|
||||
nscoord minAscent =
|
||||
nsLayoutUtils::GetCenteredFontBaseline(fm, aState.mMinLineHeight);
|
||||
nsLayoutUtils::GetCenteredFontBaseline(rc->FontMetrics(),
|
||||
aState.mMinLineHeight);
|
||||
nscoord minDescent = aState.mMinLineHeight - minAscent;
|
||||
|
||||
aState.mY += NS_MAX(minAscent, metrics.ascent) +
|
||||
|
|
|
@ -975,7 +975,7 @@ nsImageFrame::DisplayAltText(nsPresContext* aPresContext,
|
|||
nsLayoutUtils::SetFontFromStyle(&aRenderingContext, mStyleContext);
|
||||
|
||||
// Format the text to display within the formatting rect
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
|
||||
nscoord maxAscent, maxDescent, height;
|
||||
fm->GetMaxAscent(maxAscent);
|
||||
|
|
|
@ -644,7 +644,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
}
|
||||
|
||||
nsLayoutUtils::SetFontFromStyle(aReflowState.rendContext, mStyleContext);
|
||||
nsCOMPtr<nsIFontMetrics> fm = aReflowState.rendContext->GetFontMetrics();
|
||||
nsIFontMetrics* fm = aReflowState.rendContext->FontMetrics();
|
||||
|
||||
if (fm) {
|
||||
// Compute final height of the frame.
|
||||
|
|
|
@ -1563,7 +1563,7 @@ nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
|
|||
nsStyleContext* styleContext = spanFrame->GetStyleContext();
|
||||
nsRenderingContext* rc = mBlockReflowState->rendContext;
|
||||
nsLayoutUtils::SetFontFromStyle(mBlockReflowState->rendContext, styleContext);
|
||||
nsCOMPtr<nsIFontMetrics> fm = rc->GetFontMetrics();
|
||||
nsIFontMetrics* fm = rc->FontMetrics();
|
||||
|
||||
PRBool preMode = mStyleText->WhiteSpaceIsSignificant();
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@ nsMathMLContainerFrame::ReflowError(nsRenderingContext& aRenderingContext,
|
|||
aRenderingContext.GetBoundingMetrics(errorMsg.get(), errorMsg.Length());
|
||||
|
||||
// reflow metrics
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
fm->GetMaxAscent(aDesiredSize.ascent);
|
||||
nscoord descent;
|
||||
fm->GetMaxDescent(descent);
|
||||
|
@ -144,8 +144,7 @@ void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
|
|||
aCtx->SetColor(NS_RGB(255,255,255));
|
||||
|
||||
nscoord ascent;
|
||||
nsCOMPtr<nsIFontMetrics> fm = aCtx->GetFontMetrics();
|
||||
fm->GetMaxAscent(ascent);
|
||||
aCtx->FontMetrics()->GetMaxAscent(ascent);
|
||||
|
||||
nsAutoString errorMsg; errorMsg.AssignLiteral("invalid-markup");
|
||||
aCtx->DrawString(errorMsg.get(), PRUint32(errorMsg.Length()), pt.x, pt.y+ascent);
|
||||
|
|
|
@ -281,11 +281,10 @@ nsMathMLFrame::GetRuleThickness(nsRenderingContext& aRenderingContext,
|
|||
{
|
||||
// get the bounding metrics of the overbar char, the rendering context
|
||||
// is assumed to have been set with the font of the current style context
|
||||
#ifdef NS_DEBUG
|
||||
nsCOMPtr<nsIFontMetrics> currFontMetrics = aRenderingContext.GetFontMetrics();
|
||||
NS_ASSERTION(currFontMetrics->Font().Equals(aFontMetrics->Font()),
|
||||
"unexpected state");
|
||||
#endif
|
||||
NS_ASSERTION(aRenderingContext.FontMetrics()->Font().
|
||||
Equals(aFontMetrics->Font()),
|
||||
"unexpected state");
|
||||
|
||||
nscoord xHeight;
|
||||
aFontMetrics->GetXHeight(xHeight);
|
||||
PRUnichar overBar = 0x00AF;
|
||||
|
@ -304,11 +303,10 @@ nsMathMLFrame::GetAxisHeight(nsRenderingContext& aRenderingContext,
|
|||
{
|
||||
// get the bounding metrics of the minus sign, the rendering context
|
||||
// is assumed to have been set with the font of the current style context
|
||||
#ifdef NS_DEBUG
|
||||
nsCOMPtr<nsIFontMetrics> currFontMetrics = aRenderingContext.GetFontMetrics();
|
||||
NS_ASSERTION(currFontMetrics->Font().Equals(aFontMetrics->Font()),
|
||||
"unexpected state");
|
||||
#endif
|
||||
NS_ASSERTION(aRenderingContext.FontMetrics()->Font().
|
||||
Equals(aFontMetrics->Font()),
|
||||
"unexpected state");
|
||||
|
||||
nscoord xHeight;
|
||||
aFontMetrics->GetXHeight(xHeight);
|
||||
PRUnichar minus = 0x2212; // not '-', but official Unicode minus sign
|
||||
|
|
|
@ -378,7 +378,7 @@ nsMathMLmencloseFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
|||
nscoord mEmHeight;
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
GetRuleThickness(aRenderingContext, fm, mRuleThickness);
|
||||
GetEmHeight(fm, mEmHeight);
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ nsMathMLmfencedFrame::Reflow(nsPresContext* aPresContext,
|
|||
const nsStyleFont* font = GetStyleFont();
|
||||
aReflowState.rendContext->SetFont(font->mFont,
|
||||
aPresContext->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aReflowState.rendContext->GetFontMetrics();
|
||||
nsIFontMetrics* fm = aReflowState.rendContext->FontMetrics();
|
||||
nscoord axisHeight, em;
|
||||
GetAxisHeight(*aReflowState.rendContext, fm, axisHeight);
|
||||
GetEmHeight(fm, em);
|
||||
|
|
|
@ -270,7 +270,7 @@ nsMathMLmfracFrame::PlaceInternal(nsRenderingContext& aRenderingContext,
|
|||
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont,
|
||||
presContext->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
|
||||
nscoord defaultRuleThickness, axisHeight;
|
||||
GetRuleThickness(aRenderingContext, fm, defaultRuleThickness);
|
||||
|
|
|
@ -163,7 +163,7 @@ nsMathMLmmultiscriptsFrame::Place(nsRenderingContext& aRenderingContext,
|
|||
const nsStyleFont* font = GetStyleFont();
|
||||
aRenderingContext.SetFont(font->mFont,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
|
||||
nscoord xHeight;
|
||||
fm->GetXHeight (xHeight);
|
||||
|
|
|
@ -640,12 +640,12 @@ nsMathMLmoFrame::Stretch(nsRenderingContext& aRenderingContext,
|
|||
// get the axis height;
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
nscoord axisHeight, height;
|
||||
GetAxisHeight(aRenderingContext, fm, axisHeight);
|
||||
|
||||
// get the leading to be left at the top and the bottom of the stretched char
|
||||
// this seems more reliable than using fm->GetLeading() on suspicious fonts
|
||||
// this seems more reliable than using fm->GetLeading() on suspicious fonts
|
||||
nscoord em;
|
||||
GetEmHeight(fm, em);
|
||||
nscoord leading = NSToCoordRound(0.2f * em);
|
||||
|
|
|
@ -284,7 +284,7 @@ nsMathMLmoverFrame::Place(nsRenderingContext& aRenderingContext,
|
|||
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
|
||||
nscoord xHeight = 0;
|
||||
fm->GetXHeight (xHeight);
|
||||
|
|
|
@ -261,7 +261,7 @@ nsMathMLmrootFrame::Reflow(nsPresContext* aPresContext,
|
|||
|
||||
renderingContext.SetFont(GetStyleFont()->mFont,
|
||||
aPresContext->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = renderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = renderingContext.FontMetrics();
|
||||
|
||||
// For radical glyphs from TeX fonts and some of the radical glyphs from
|
||||
// Mathematica fonts, the thickness of the overline can be obtained from the
|
||||
|
@ -413,9 +413,9 @@ nsMathMLmrootFrame::GetIntrinsicWidth(nsRenderingContext* aRenderingContext)
|
|||
nsLayoutUtils::PREF_WIDTH);
|
||||
nscoord sqrWidth = mSqrChar.GetMaxWidth(PresContext(), *aRenderingContext);
|
||||
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext->GetFontMetrics();
|
||||
nscoord dxSqr;
|
||||
GetRadicalXOffsets(indexWidth, sqrWidth, fm, nsnull, &dxSqr);
|
||||
GetRadicalXOffsets(indexWidth, sqrWidth, aRenderingContext->FontMetrics(),
|
||||
nsnull, &dxSqr);
|
||||
|
||||
return dxSqr + sqrWidth + baseWidth;
|
||||
}
|
||||
|
|
|
@ -196,7 +196,7 @@ nsMathMLmsubsupFrame::PlaceSubSupScript(nsPresContext* aPresContext,
|
|||
|
||||
aRenderingContext.SetFont(baseFrame->GetStyleFont()->mFont,
|
||||
aPresContext->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
|
||||
// get x-height (an ex)
|
||||
nscoord xHeight;
|
||||
|
|
|
@ -639,9 +639,10 @@ nsMathMLmtableOuterFrame::Reflow(nsPresContext* aPresContext,
|
|||
// XXX should instead use style data from the row of reference here ?
|
||||
aReflowState.rendContext->SetFont(GetStyleFont()->mFont,
|
||||
aPresContext->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aReflowState.rendContext->GetFontMetrics();
|
||||
nscoord axisHeight;
|
||||
GetAxisHeight(*aReflowState.rendContext, fm, axisHeight);
|
||||
GetAxisHeight(*aReflowState.rendContext,
|
||||
aReflowState.rendContext->FontMetrics(),
|
||||
axisHeight);
|
||||
if (rowFrame) {
|
||||
// anchor the table on the axis of the row of reference
|
||||
// XXX fallback to baseline because it is a hard problem
|
||||
|
|
|
@ -281,7 +281,7 @@ nsMathMLmunderFrame::Place(nsRenderingContext& aRenderingContext,
|
|||
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
|
||||
nscoord xHeight = 0;
|
||||
fm->GetXHeight (xHeight);
|
||||
|
|
|
@ -323,7 +323,7 @@ nsMathMLmunderoverFrame::Place(nsRenderingContext& aRenderingContext,
|
|||
|
||||
aRenderingContext.SetFont(GetStyleFont()->mFont,
|
||||
PresContext()->GetUserFontSet());
|
||||
nsCOMPtr<nsIFontMetrics> fm = aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* fm = aRenderingContext.FontMetrics();
|
||||
|
||||
nscoord xHeight = 0;
|
||||
fm->GetXHeight (xHeight);
|
||||
|
|
|
@ -657,8 +657,7 @@ nsTextBoxFrame::CalculateUnderline(nsRenderingContext& aRenderingContext)
|
|||
mAccesskeyIndex]);
|
||||
|
||||
nscoord offset, baseline;
|
||||
nsCOMPtr<nsIFontMetrics> metrics
|
||||
= aRenderingContext.GetFontMetrics();
|
||||
nsIFontMetrics* metrics = aRenderingContext.FontMetrics();
|
||||
metrics->GetUnderline(offset, mAccessKeyInfo->mAccessUnderlineSize);
|
||||
metrics->GetMaxAscent(baseline);
|
||||
mAccessKeyInfo->mAccessOffset = baseline - offset;
|
||||
|
|
|
@ -1494,17 +1494,19 @@ nsNativeThemeCocoa::DrawResizer(CGContextRef cgContext, const HIRect& aRect,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, nsIFrame* aFrame,
|
||||
PRUint8 aWidgetType, const nsRect& aRect,
|
||||
nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
|
||||
nsIFrame* aFrame,
|
||||
PRUint8 aWidgetType,
|
||||
const nsRect& aRect,
|
||||
const nsRect& aDirtyRect)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
|
||||
|
||||
// setup to draw into the correct port
|
||||
nsCOMPtr<nsIDeviceContext> dctx = aContext->GetDeviceContext();
|
||||
PRInt32 p2a = dctx->AppUnitsPerDevPixel();
|
||||
PRInt32 p2a = aContext->AppUnitsPerDevPixel();
|
||||
|
||||
gfxRect nativeDirtyRect(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
|
||||
gfxRect nativeDirtyRect(aDirtyRect.x, aDirtyRect.y,
|
||||
aDirtyRect.width, aDirtyRect.height);
|
||||
gfxRect nativeWidgetRect(aRect.x, aRect.y, aRect.width, aRect.height);
|
||||
nativeWidgetRect.ScaleInverse(gfxFloat(p2a));
|
||||
nativeDirtyRect.ScaleInverse(gfxFloat(p2a));
|
||||
|
@ -1512,7 +1514,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext, nsIFrame*
|
|||
if (nativeWidgetRect.IsEmpty())
|
||||
return NS_OK; // Don't attempt to draw invisible widgets.
|
||||
|
||||
nsRefPtr<gfxContext> thebesCtx = aContext->ThebesContext();
|
||||
gfxContext* thebesCtx = aContext->ThebesContext();
|
||||
if (!thebesCtx)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
|
|
|
@ -1135,11 +1135,9 @@ nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
|
|||
case NS_THEME_TREEVIEW_HEADER_CELL:
|
||||
{
|
||||
// Just include our border, and let the box code augment the size.
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dc = aContext->GetDeviceContext();
|
||||
|
||||
nsIntMargin border;
|
||||
nsNativeThemeGTK::GetWidgetBorder(dc, aFrame, aWidgetType, &border);
|
||||
nsNativeThemeGTK::GetWidgetBorder(aContext->DeviceContext(),
|
||||
aFrame, aWidgetType, &border);
|
||||
aResult->width = border.left + border.right;
|
||||
aResult->height = border.top + border.bottom;
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ nsNativeThemeQt::DrawWidgetBackground(QPainter *qPainter,
|
|||
QMatrix qctm(ctm.xx, ctm.yx, ctm.xy, ctm.yy, ctm.x0, ctm.y0);
|
||||
qPainter->setWorldMatrix(qctm, true);
|
||||
|
||||
PRInt32 p2a = GetAppUnitsPerDevPixel(aContext);
|
||||
PRInt32 p2a = aContext->AppUnitsPerDevPixel();
|
||||
|
||||
QRect r = qRectInPixels(aRect, p2a);
|
||||
QRect cr = qRectInPixels(aClipRect, p2a);
|
||||
|
@ -395,7 +395,7 @@ nsNativeThemeQt::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aF
|
|||
|
||||
QStyle *s = qApp->style();
|
||||
|
||||
PRInt32 p2a = GetAppUnitsPerDevPixel(aContext);
|
||||
PRInt32 p2a = aContext->AppUnitsPerDevPixel();
|
||||
|
||||
switch (aWidgetType) {
|
||||
case NS_THEME_RADIO:
|
||||
|
|
|
@ -111,11 +111,6 @@ private:
|
|||
const nsRect& aRect,
|
||||
const nsRect& aClipRect);
|
||||
|
||||
inline PRInt32 GetAppUnitsPerDevPixel(nsRenderingContext* aContext){
|
||||
nsCOMPtr<nsIDeviceContext> dctx = aContext->GetDeviceContext();
|
||||
return dctx->AppUnitsPerDevPixel();
|
||||
}
|
||||
|
||||
void InitButtonStyle(PRUint8 widgetType,
|
||||
nsIFrame* aFrame,
|
||||
QRect rect,
|
||||
|
|
|
@ -1246,8 +1246,7 @@ nsNativeThemeWin::DrawWidgetBackground(nsRenderingContext* aContext,
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dc = aContext->GetDeviceContext();
|
||||
gfxFloat p2a = gfxFloat(dc->AppUnitsPerDevPixel());
|
||||
gfxFloat p2a = gfxFloat(aContext->AppUnitsPerDevPixel());
|
||||
RECT widgetRect;
|
||||
RECT clipRect;
|
||||
gfxRect tr(aRect.x, aRect.y, aRect.width, aRect.height),
|
||||
|
@ -3114,8 +3113,7 @@ nsresult nsNativeThemeWin::ClassicDrawWidgetBackground(nsRenderingContext* aCont
|
|||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dc = aContext->GetDeviceContext();
|
||||
gfxFloat p2a = gfxFloat(dc->AppUnitsPerDevPixel());
|
||||
gfxFloat p2a = gfxFloat(aContext->AppUnitsPerDevPixel());
|
||||
RECT widgetRect;
|
||||
gfxRect tr(aRect.x, aRect.y, aRect.width, aRect.height),
|
||||
dr(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);
|
||||
|
|
Загрузка…
Ссылка в новой задаче