зеркало из https://github.com/mozilla/pjs.git
nsViewManager :: Refresh
Created explicit pointers to offscreen and onscreen rendering contexts. Stop passing NS_COPYBITS_TO_BACK_BUFFER flag.
This commit is contained in:
Родитель
f59b360041
Коммит
0d24534039
|
@ -674,7 +674,7 @@ NS_IMETHODIMP nsView :: Paint(nsIRenderingContext& rc, const nsRect& rect,
|
|||
NS_RELEASE(blender);
|
||||
NS_RELEASE(dx);
|
||||
|
||||
rc.CopyOffScreenBits(surf, 0, 0, brect, NS_COPYBITS_XFORM_DEST_VALUES | NS_COPYBITS_TO_BACK_BUFFER);
|
||||
rc.CopyOffScreenBits(surf, 0, 0, brect, NS_COPYBITS_XFORM_DEST_VALUES);
|
||||
}
|
||||
|
||||
rc.DestroyDrawingSurface(surf);
|
||||
|
|
|
@ -391,6 +391,10 @@ NS_IMETHODIMP nsViewManager :: ResetScrolling(void)
|
|||
void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsIRegion *region, PRUint32 aUpdateFlags)
|
||||
{
|
||||
nsRect wrect;
|
||||
nsIRenderingContext *onscreencx = nsnull; // on screen
|
||||
nsIRenderingContext *offscreencx = nsnull; // secondary buffer
|
||||
// the localcx points to the (offscreencx) if double buffering,
|
||||
// otherwise it points to (onscreencx)
|
||||
nsIRenderingContext *localcx = nsnull;
|
||||
nsDrawingSurface ds = nsnull;
|
||||
|
||||
|
@ -414,13 +418,16 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsI
|
|||
if (nsnull == aContext)
|
||||
{
|
||||
localcx = CreateRenderingContext(*aView);
|
||||
onscreencx = localcx;
|
||||
|
||||
//couldn't get rendering context. this is ok at init time atleast
|
||||
if (nsnull == localcx)
|
||||
return;
|
||||
}
|
||||
else
|
||||
else {
|
||||
localcx = aContext;
|
||||
onscreencx = aContext;
|
||||
}
|
||||
|
||||
if (aUpdateFlags & NS_VMREFRESH_DOUBLE_BUFFER)
|
||||
{
|
||||
|
@ -432,7 +439,9 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsI
|
|||
wrect.x = wrect.y = 0;
|
||||
|
||||
NS_RELEASE(widget);
|
||||
|
||||
|
||||
localcx = CreateRenderingContext(*aView);
|
||||
offscreencx = localcx;
|
||||
ds = GetDrawingSurface(*localcx, wrect);
|
||||
}
|
||||
|
||||
|
@ -450,13 +459,15 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsI
|
|||
|
||||
if ((aUpdateFlags & NS_VMREFRESH_DOUBLE_BUFFER) && ds)
|
||||
#ifdef NEW_COMPOSITOR
|
||||
localcx->CopyOffScreenBits(ds, wrect.x, wrect.y, wrect, 0);
|
||||
onscreencx->CopyOffScreenBits(ds, wrect.x, wrect.y, wrect, 0);
|
||||
#else
|
||||
localcx->CopyOffScreenBits(ds, wrect.x, wrect.y, wrect, NS_COPYBITS_USE_SOURCE_CLIP_REGION);
|
||||
onscreencx->CopyOffScreenBits(ds, wrect.x, wrect.y, wrect, NS_COPYBITS_USE_SOURCE_CLIP_REGION);
|
||||
#endif
|
||||
|
||||
if (localcx != aContext)
|
||||
NS_RELEASE(localcx);
|
||||
if (onscreencx != aContext)
|
||||
NS_RELEASE(onscreencx);
|
||||
|
||||
NS_IF_RELEASE(offscreencx);
|
||||
|
||||
// Subtract the area we just painted from the dirty region
|
||||
if ((nsnull != region) && !region->IsEmpty())
|
||||
|
@ -478,6 +489,10 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, nsI
|
|||
void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, const nsRect *rect, PRUint32 aUpdateFlags)
|
||||
{
|
||||
nsRect wrect, brect;
|
||||
nsIRenderingContext *onscreencx = nsnull; // on screen
|
||||
nsIRenderingContext *offscreencx = nsnull; // secondary buffer
|
||||
// the localcx points to the (offscreencx) if double buffering,
|
||||
// otherwise it points to (onscreencx)
|
||||
nsIRenderingContext *localcx = nsnull;
|
||||
nsDrawingSurface ds = nsnull;
|
||||
|
||||
|
@ -500,16 +515,20 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, con
|
|||
aUpdateFlags &= ~NS_VMREFRESH_DOUBLE_BUFFER;
|
||||
#endif
|
||||
|
||||
|
||||
if (nsnull == aContext)
|
||||
{
|
||||
localcx = CreateRenderingContext(*aView);
|
||||
onscreencx = localcx;
|
||||
|
||||
//couldn't get rendering context. this is ok if at startup
|
||||
if (nsnull == localcx)
|
||||
return;
|
||||
}
|
||||
else
|
||||
else {
|
||||
localcx = aContext;
|
||||
onscreencx = aContext;
|
||||
}
|
||||
|
||||
if (aUpdateFlags & NS_VMREFRESH_DOUBLE_BUFFER)
|
||||
{
|
||||
|
@ -523,6 +542,9 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, con
|
|||
|
||||
NS_RELEASE(widget);
|
||||
|
||||
//Create a new rendering context for the background buffer.
|
||||
localcx = CreateRenderingContext(*aView);
|
||||
offscreencx = localcx;
|
||||
ds = GetDrawingSurface(*localcx, wrect);
|
||||
}
|
||||
|
||||
|
@ -538,21 +560,24 @@ void nsViewManager :: Refresh(nsIView *aView, nsIRenderingContext *aContext, con
|
|||
#ifdef NEW_COMPOSITOR
|
||||
{
|
||||
#ifdef XP_MAC
|
||||
localcx->CopyOffScreenBits(ds, wrect.x, wrect.y, wrect, 0);
|
||||
onscreencx->CopyOffScreenBits(ds, wrect.x, wrect.y, wrect, 0);
|
||||
#else
|
||||
#ifdef XP_UNIX
|
||||
localcx->SetClipRect(trect, nsClipCombine_kReplace, result);
|
||||
onscreencx->SetClipRect(trect, nsClipCombine_kReplace, result);
|
||||
#endif //unix
|
||||
localcx->CopyOffScreenBits(ds, brect.x, brect.y, brect, 0);
|
||||
onscreencx->CopyOffScreenBits(ds, brect.x, brect.y, brect, 0);
|
||||
#endif //mac
|
||||
}
|
||||
#else
|
||||
localcx->CopyOffScreenBits(ds, wrect.x, wrect.y, wrect, NS_COPYBITS_USE_SOURCE_CLIP_REGION);
|
||||
onscreencx->CopyOffScreenBits(ds, wrect.x, wrect.y, wrect, NS_COPYBITS_USE_SOURCE_CLIP_REGION);
|
||||
#endif
|
||||
|
||||
|
||||
if (localcx != aContext)
|
||||
NS_RELEASE(localcx);
|
||||
if (onscreencx != aContext)
|
||||
NS_RELEASE(onscreencx);
|
||||
|
||||
NS_IF_RELEASE(offscreencx);
|
||||
|
||||
|
||||
// Subtract the area we just painted from the dirty region
|
||||
nsIRegion *dirtyRegion;
|
||||
|
@ -1082,7 +1107,7 @@ void nsViewManager :: RenderViews(nsIView *aRootView, nsIRenderingContext& aRC,
|
|||
mBlueCX->Translate(localrect.x, localrect.y);
|
||||
|
||||
//buffer swap.
|
||||
aRC.CopyOffScreenBits(gOffScreen, 0, 0, localrect, NS_COPYBITS_XFORM_DEST_VALUES | NS_COPYBITS_TO_BACK_BUFFER);
|
||||
aRC.CopyOffScreenBits(gOffScreen, 0, 0, localrect, NS_COPYBITS_XFORM_DEST_VALUES);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче