Update() receives the rendering context as a parameter and passes it to the children

This commit is contained in:
pierre%netscape.com 1998-12-02 10:15:22 +00:00
Родитель 3767d35deb
Коммит 8cba629bdd
2 изменённых файлов: 14 добавлений и 4 удалений

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

@ -675,14 +675,23 @@ PRBool nsWindow::OnPaint(nsPaintEvent &event)
// The window visRgn is expected to be set to whatever needs to be drawn // The window visRgn is expected to be set to whatever needs to be drawn
// (ie. if we are not between BeginUpdate/EndUpdate, we redraw the whole widget) // (ie. if we are not between BeginUpdate/EndUpdate, we redraw the whole widget)
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
NS_IMETHODIMP nsWindow::Update() NS_IMETHODIMP nsWindow::Update(nsIRenderingContext* aRenderingContext)
{ {
RgnHandle updateRgn = ::NewRgn(); RgnHandle updateRgn = ::NewRgn();
//::SectRgn(mWindowPtr->visRgn, mWindowRegion, updateRgn); //::SectRgn(mWindowPtr->visRgn, mWindowRegion, updateRgn);
::SectRgn(mWindowPtr->visRgn, mMacPortRelativeRegion, updateRgn); ::SectRgn(mWindowPtr->visRgn, mMacPortRelativeRegion, updateRgn);
if (!::EmptyRgn(updateRgn)) if (!::EmptyRgn(updateRgn))
{ {
nsIRenderingContext* renderingContext = GetRenderingContext(); // this sets the origin // make sure we have a rendering context
nsIRenderingContext* renderingContext;
if (aRenderingContext)
{
renderingContext = aRenderingContext;
NS_ADDREF(renderingContext);
}
else
renderingContext = GetRenderingContext(); // this sets the origin
if (renderingContext) if (renderingContext)
{ {
// initialize the paint event for that widget // initialize the paint event for that widget
@ -721,7 +730,7 @@ NS_IMETHODIMP nsWindow::Update()
do do
{ {
if (NS_SUCCEEDED(children->CurrentItem((nsISupports **)&child))) { if (NS_SUCCEEDED(children->CurrentItem((nsISupports **)&child))) {
child->Update(); child->Update(renderingContext);
} }
} }
while (NS_SUCCEEDED(children->Next())); while (NS_SUCCEEDED(children->Next()));

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

@ -112,7 +112,8 @@ public:
virtual void StartDraw(nsIRenderingContext* aRenderingContext = nsnull); virtual void StartDraw(nsIRenderingContext* aRenderingContext = nsnull);
virtual void EndDraw(); virtual void EndDraw();
virtual PRBool OnPaint(nsPaintEvent &event); virtual PRBool OnPaint(nsPaintEvent &event);
NS_IMETHOD Update(); virtual nsresult Update(nsIRenderingContext* aRenderingContext);
NS_IMETHOD Update() {return(Update(nsnull));}
virtual void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY); virtual void ConvertToDeviceCoordinates(nscoord &aX, nscoord &aY);
virtual void LocalToWindowCoordinate(nsPoint& aPoint); virtual void LocalToWindowCoordinate(nsPoint& aPoint);