зеркало из https://github.com/mozilla/pjs.git
StartDraw() initializes the rendering context; it allows Update() to pass the rendering context to the children.
This commit is contained in:
Родитель
34127314ce
Коммит
311f109e7a
|
@ -594,12 +594,8 @@ inline PRUint16 COLOR8TOCOLOR16(PRUint8 color8)
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// StartDraw
|
// StartDraw
|
||||||
// Initialize graphic attributes.
|
|
||||||
// When they receive a Paint event, XP Widgets rely
|
|
||||||
// on these attributes to be set.
|
|
||||||
//
|
//
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
//¥TODO: some of that work is done by the rendering context -> do some cleanup
|
|
||||||
void nsWindow::StartDraw(nsIRenderingContext* aRenderingContext)
|
void nsWindow::StartDraw(nsIRenderingContext* aRenderingContext)
|
||||||
{
|
{
|
||||||
// make sure we have a rendering context
|
// make sure we have a rendering context
|
||||||
|
@ -609,27 +605,21 @@ void nsWindow::StartDraw(nsIRenderingContext* aRenderingContext)
|
||||||
{
|
{
|
||||||
NS_IF_ADDREF(aRenderingContext);
|
NS_IF_ADDREF(aRenderingContext);
|
||||||
mTempRenderingContext = aRenderingContext;
|
mTempRenderingContext = aRenderingContext;
|
||||||
}
|
|
||||||
if (mTempRenderingContext)
|
|
||||||
mTempRenderingContext->PushState();
|
mTempRenderingContext->PushState();
|
||||||
|
mTempRenderingContext->Init(mContext, this);
|
||||||
|
}
|
||||||
|
|
||||||
// set the origin to the topLeft corner of the widget
|
// set the widget font
|
||||||
nsPoint widgetOrigin(mBounds.x, mBounds.y);
|
|
||||||
//nsPoint widgetOrgin( (**mMacPortRelativeRegion).rgnBBox.left, (**mMacPortRelativeRegion).rgnBBox.top );
|
|
||||||
LocalToWindowCoordinate(widgetOrigin);
|
|
||||||
::SetOrigin(-widgetOrigin.x, -widgetOrigin.y);
|
|
||||||
|
|
||||||
//::SetClip(mTempRenderingContext->mCurStatePtr->mOriginRelativeClipRgn);
|
|
||||||
|
|
||||||
// set the font
|
|
||||||
if (mFontMetrics)
|
if (mFontMetrics)
|
||||||
{
|
{
|
||||||
nsFont* font;
|
nsFont* font;
|
||||||
mFontMetrics->GetFont(font);
|
mFontMetrics->GetFont(font);
|
||||||
nsFontMetricsMac::SetFont(*font, mContext);
|
nsFontMetricsMac::SetFont(*font, mContext);
|
||||||
|
|
||||||
|
mTempRenderingContext->SetFont(mFontMetrics); // just in case, set the rendering context font too
|
||||||
}
|
}
|
||||||
|
|
||||||
// set the background & foreground colors
|
// set the widget background and foreground colors
|
||||||
nscolor color = GetBackgroundColor();
|
nscolor color = GetBackgroundColor();
|
||||||
RGBColor macColor;
|
RGBColor macColor;
|
||||||
macColor.red = COLOR8TOCOLOR16(NS_GET_R(color));
|
macColor.red = COLOR8TOCOLOR16(NS_GET_R(color));
|
||||||
|
@ -643,7 +633,7 @@ void nsWindow::StartDraw(nsIRenderingContext* aRenderingContext)
|
||||||
macColor.blue = COLOR8TOCOLOR16(NS_GET_B(color));
|
macColor.blue = COLOR8TOCOLOR16(NS_GET_B(color));
|
||||||
::RGBForeColor(&macColor);
|
::RGBForeColor(&macColor);
|
||||||
|
|
||||||
::PenNormal();
|
mTempRenderingContext->SetColor(color); // just in case, set the rendering context color too
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -730,7 +720,7 @@ NS_IMETHODIMP nsWindow::Update(nsIRenderingContext* aRenderingContext)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (NS_SUCCEEDED(children->CurrentItem((nsISupports **)&child))) {
|
if (NS_SUCCEEDED(children->CurrentItem((nsISupports **)&child))) {
|
||||||
child->Update(/*renderingContext*/);
|
child->Update(renderingContext);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (NS_SUCCEEDED(children->Next()));
|
while (NS_SUCCEEDED(children->Next()));
|
||||||
|
|
Загрузка…
Ссылка в новой задаче