diff --git a/mozilla/gfx/src/motif/nsRenderingContextUnix.cpp b/mozilla/gfx/src/motif/nsRenderingContextUnix.cpp index 96d8e5d4a7d..09392a0e0e5 100644 --- a/mozilla/gfx/src/motif/nsRenderingContextUnix.cpp +++ b/mozilla/gfx/src/motif/nsRenderingContextUnix.cpp @@ -210,9 +210,8 @@ void nsRenderingContextUnix :: PushState(void) } -void nsRenderingContextUnix :: PopState(void) +PRBool nsRenderingContextUnix :: PopState(void) { - PRUint32 cnt = mStateCache->Count(); GraphicsState * state; @@ -229,7 +228,8 @@ void nsRenderingContextUnix :: PopState(void) delete state; } - + //XXX need to return if clip region is empty after pop. see nsirendering....h MMP + return PR_FALSE; } PRBool nsRenderingContextUnix :: IsVisibleRect(const nsRect& aRect) @@ -486,8 +486,9 @@ void nsRenderingContextUnix :: DestroyDrawingSurface(nsDrawingSurface aDS) // XXX - Could this be a GC? If so, store the type of surface in nsDrawingSurfaceUnix ::XFreePixmap(surface->display, surface->drawable); - // if (mRenderingSurface == surface) - // mRenderingSurface = nsnull; + //XXX greg, this seems bad. MMP + if (mRenderingSurface == surface) + mRenderingSurface = nsnull; delete aDS; } diff --git a/mozilla/gfx/src/motif/nsRenderingContextUnix.h b/mozilla/gfx/src/motif/nsRenderingContextUnix.h index 53814f211e7..1733a909de7 100644 --- a/mozilla/gfx/src/motif/nsRenderingContextUnix.h +++ b/mozilla/gfx/src/motif/nsRenderingContextUnix.h @@ -66,7 +66,7 @@ public: virtual nsresult SelectOffScreenDrawingSurface(nsDrawingSurface aSurface); virtual void PushState(void); - virtual void PopState(void); + virtual PRBool PopState(void); virtual PRBool IsVisibleRect(const nsRect& aRect); diff --git a/mozilla/gfx/src/nsIRenderingContext.h b/mozilla/gfx/src/nsIRenderingContext.h index 1e14f148f95..8836b3c09bd 100644 --- a/mozilla/gfx/src/nsIRenderingContext.h +++ b/mozilla/gfx/src/nsIRenderingContext.h @@ -104,8 +104,10 @@ public: /** * Get and and set RenderingContext to this graphical state + * @return if PR_TRUE, indicates that the clipping region after + * popping state is empty, else PR_FALSE */ - virtual void PopState(void) = 0; + virtual PRBool PopState(void) = 0; /** * Tells if a given rectangle is visible within the rendering context diff --git a/mozilla/gfx/src/windows/nsRenderingContextWin.cpp b/mozilla/gfx/src/windows/nsRenderingContextWin.cpp index 75159c82fa6..194f6dd812a 100644 --- a/mozilla/gfx/src/windows/nsRenderingContextWin.cpp +++ b/mozilla/gfx/src/windows/nsRenderingContextWin.cpp @@ -354,8 +354,10 @@ void nsRenderingContextWin :: PushState(void) mTMatrix = &mStates->mMatrix; } -void nsRenderingContextWin :: PopState(void) +PRBool nsRenderingContextWin :: PopState(void) { + PRBool retval = PR_FALSE; + if (nsnull == mStates) { NS_ASSERTION(!(nsnull == mStates), "state underflow"); @@ -385,7 +387,12 @@ void nsRenderingContextWin :: PopState(void) pstate = pstate->mNext; if (nsnull != pstate) - ::SelectClipRgn(mDC, pstate->mClipRegion); + { + int cliptype = ::SelectClipRgn(mDC, pstate->mClipRegion); + + if (cliptype == NULLREGION) + retval = PR_TRUE; + } } oldstate->mFlags &= ~FLAGS_ALL; @@ -396,6 +403,8 @@ void nsRenderingContextWin :: PopState(void) else mTMatrix = nsnull; } + + return retval; } PRBool nsRenderingContextWin :: IsVisibleRect(const nsRect& aRect) diff --git a/mozilla/gfx/src/windows/nsRenderingContextWin.h b/mozilla/gfx/src/windows/nsRenderingContextWin.h index 643c03a99c1..955d497d040 100644 --- a/mozilla/gfx/src/windows/nsRenderingContextWin.h +++ b/mozilla/gfx/src/windows/nsRenderingContextWin.h @@ -61,7 +61,7 @@ public: virtual nsresult SelectOffScreenDrawingSurface(nsDrawingSurface aSurface); virtual void PushState(void); - virtual void PopState(void); + virtual PRBool PopState(void); virtual PRBool IsVisibleRect(const nsRect& aRect);