зеркало из https://github.com/mozilla/pjs.git
Allow global offscreen to size bigger than a screen without creating a new offscreen each time and asserting. b=38847 r=rods@netscape.com tested=WIN32,Linux Removed compiler warnings in nsViewManager2
This commit is contained in:
Родитель
9efc745de9
Коммит
f0ee8f96b4
|
@ -122,6 +122,8 @@ nsDrawingSurface nsViewManager2::gRed = nsnull;
|
||||||
nsDrawingSurface nsViewManager2::gBlue = nsnull;
|
nsDrawingSurface nsViewManager2::gBlue = nsnull;
|
||||||
nsSize nsViewManager2::gBlendSize = nsSize(0, 0);
|
nsSize nsViewManager2::gBlendSize = nsSize(0, 0);
|
||||||
nsSize nsViewManager2::gOffScreenSize = nsSize(0, 0);
|
nsSize nsViewManager2::gOffScreenSize = nsSize(0, 0);
|
||||||
|
nsSize nsViewManager2::gLargestRequestedSize = nsSize(0, 0);
|
||||||
|
|
||||||
|
|
||||||
// Weakly held references to all of the view managers
|
// Weakly held references to all of the view managers
|
||||||
nsVoidArray* nsViewManager2::gViewManagers = nsnull;
|
nsVoidArray* nsViewManager2::gViewManagers = nsnull;
|
||||||
|
@ -861,7 +863,7 @@ void nsViewManager2::RenderDisplayListElement(DisplayListElement2* element, nsIR
|
||||||
if (damageRect.width > 0 && damageRect.height > 0) {
|
if (damageRect.width > 0 && damageRect.height > 0) {
|
||||||
mBlender->Blend(damageRect.x, damageRect.y, damageRect.width, damageRect.height,
|
mBlender->Blend(damageRect.x, damageRect.y, damageRect.width, damageRect.height,
|
||||||
mRedCX, mOffScreenCX,
|
mRedCX, mOffScreenCX,
|
||||||
viewX * mTwipsToPixels, viewY * mTwipsToPixels,
|
(PRInt32)(viewX * mTwipsToPixels),(PRInt32)(viewY * mTwipsToPixels),
|
||||||
opacity, mBlueCX,
|
opacity, mBlueCX,
|
||||||
NS_RGB(255, 0, 0), NS_RGB(0, 0, 255));
|
NS_RGB(255, 0, 0), NS_RGB(0, 0, 255));
|
||||||
}
|
}
|
||||||
|
@ -1848,9 +1850,6 @@ void nsViewManager2::GetMaxWidgetBounds(nsRect& aMaxWidgetBounds) const
|
||||||
aMaxWidgetBounds.width = max(aMaxWidgetBounds.width, widgetBounds.width);
|
aMaxWidgetBounds.width = max(aMaxWidgetBounds.width, widgetBounds.width);
|
||||||
aMaxWidgetBounds.height = max(aMaxWidgetBounds.height, widgetBounds.height);
|
aMaxWidgetBounds.height = max(aMaxWidgetBounds.height, widgetBounds.height);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
NS_ASSERTION(0, "failure to get rootWidget");
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// printf("WIDGET BOUNDS %d %d\n", aMaxWidgetBounds.width, aMaxWidgetBounds.height);
|
// printf("WIDGET BOUNDS %d %d\n", aMaxWidgetBounds.width, aMaxWidgetBounds.height);
|
||||||
|
@ -1884,7 +1883,7 @@ PRBool nsViewManager2::BothRectsFitInside(nsRect& aRect1, nsRect& aRect2, PRInt3
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
PRBool nsViewManager2::CalculateDiscreteSurfaceSize(nsRect& aRequestedSize, nsRect& aSurfaceSize) const
|
void nsViewManager2::CalculateDiscreteSurfaceSize(nsRect& aRequestedSize, nsRect& aSurfaceSize) const
|
||||||
{
|
{
|
||||||
nsRect aMaxWidgetSize;
|
nsRect aMaxWidgetSize;
|
||||||
GetMaxWidgetBounds(aMaxWidgetSize);
|
GetMaxWidgetBounds(aMaxWidgetSize);
|
||||||
|
@ -1904,47 +1903,49 @@ PRBool nsViewManager2::CalculateDiscreteSurfaceSize(nsRect& aRequestedSize, nsRe
|
||||||
|
|
||||||
// 1/8 screen
|
// 1/8 screen
|
||||||
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, screenWidth / 8, screenHeight / 8, aSurfaceSize)) {
|
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, screenWidth / 8, screenHeight / 8, aSurfaceSize)) {
|
||||||
return PR_TRUE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1/4 screen
|
// 1/4 screen
|
||||||
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, screenWidth / 4, screenHeight / 4, aSurfaceSize)) {
|
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, screenWidth / 4, screenHeight / 4, aSurfaceSize)) {
|
||||||
return PR_TRUE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1/2 screen
|
// 1/2 screen
|
||||||
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, screenWidth / 2, screenHeight / 2, aSurfaceSize)) {
|
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, screenWidth / 2, screenHeight / 2, aSurfaceSize)) {
|
||||||
return PR_TRUE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3/4 screen
|
// 3/4 screen
|
||||||
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, (screenWidth * 3) / 4, (screenHeight * 3) / 4, aSurfaceSize)) {
|
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, (screenWidth * 3) / 4, (screenHeight * 3) / 4, aSurfaceSize)) {
|
||||||
return PR_TRUE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3/4 screen width full screen height
|
// 3/4 screen width full screen height
|
||||||
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, (screenWidth * 3) / 4, screenHeight, aSurfaceSize)) {
|
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, (screenWidth * 3) / 4, screenHeight, aSurfaceSize)) {
|
||||||
return PR_TRUE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Full screen
|
// Full screen
|
||||||
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, screenWidth, screenHeight, aSurfaceSize)) {
|
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, screenWidth, screenHeight, aSurfaceSize)) {
|
||||||
return PR_TRUE;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return PR_FALSE;
|
// Bigger than Full Screen use the largest request every made.
|
||||||
|
if (BothRectsFitInside(aRequestedSize, aMaxWidgetSize, gLargestRequestedSize.width, gLargestRequestedSize.height, aSurfaceSize)) {
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
gLargestRequestedSize.width = PR_MAX(aRequestedSize.width, aMaxWidgetSize.width);
|
||||||
|
gLargestRequestedSize.height = PR_MAX(aRequestedSize.height, aMaxWidgetSize.height);
|
||||||
|
aSurfaceSize.width = gLargestRequestedSize.width;
|
||||||
|
aSurfaceSize.height = gLargestRequestedSize.height;
|
||||||
|
// printf("Expanding the largested requested size to %d %d\n", gLargestRequestedSize.width, gLargestRequestedSize.height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsViewManager2::GetDrawingSurfaceSize(nsRect& aRequestedSize, nsRect& aNewSize) const
|
void nsViewManager2::GetDrawingSurfaceSize(nsRect& aRequestedSize, nsRect& aNewSize) const
|
||||||
{
|
{
|
||||||
if (PR_FALSE == CalculateDiscreteSurfaceSize(aRequestedSize, aNewSize)) {
|
CalculateDiscreteSurfaceSize(aRequestedSize, aNewSize);
|
||||||
NS_ASSERTION(PR_FALSE, "CalculateDiscreteSize failed");
|
|
||||||
// Wasn't able to find any fixed size to render inside of
|
|
||||||
// so just expand the size of the offscreen using the requested size.
|
|
||||||
aNewSize.width = max(aRequestedSize.width, mDSBounds.width);
|
|
||||||
aNewSize.height = max(aRequestedSize.height, mDSBounds.height);
|
|
||||||
}
|
|
||||||
|
|
||||||
aNewSize.MoveTo(aRequestedSize.x, aRequestedSize.y);
|
aNewSize.MoveTo(aRequestedSize.x, aRequestedSize.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1965,7 +1966,7 @@ nsDrawingSurface nsViewManager2::GetDrawingSurface(nsIRenderingContext &aContext
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult rv = aContext.CreateDrawingSurface(&newBounds, 0, mDrawingSurface);
|
nsresult rv = aContext.CreateDrawingSurface(&newBounds, 0, mDrawingSurface);
|
||||||
// printf("Allocating a new drawing surface %d %d\n", newBounds.width, newBounds.height);
|
// printf("Allocating a new drawing surface %d %d\n", newBounds.width, newBounds.height);
|
||||||
if (NS_SUCCEEDED(rv)) {
|
if (NS_SUCCEEDED(rv)) {
|
||||||
mDSBounds = newBounds;
|
mDSBounds = newBounds;
|
||||||
aContext.SelectOffScreenDrawingSurface(mDrawingSurface);
|
aContext.SelectOffScreenDrawingSurface(mDrawingSurface);
|
||||||
|
|
|
@ -281,12 +281,9 @@ private:
|
||||||
* size (@see GetMaxWidgetBounds) and the requested size is returned.
|
* size (@see GetMaxWidgetBounds) and the requested size is returned.
|
||||||
*
|
*
|
||||||
* @param aRequestedSize Requested size for the offscreen.
|
* @param aRequestedSize Requested size for the offscreen.
|
||||||
* @param aSurfaceSize contains the surface size if the method returns PR_TRUE.
|
* @param aSurfaceSize contains the surface size
|
||||||
* It is unmodified if the method returns PR_FALSE;
|
|
||||||
* @returns PR_TRUE if it was able to calculate a discrete surface size, PR_FALSE
|
|
||||||
* otherwise.
|
|
||||||
*/
|
*/
|
||||||
PRBool CalculateDiscreteSurfaceSize(nsRect& aRequestedSize, nsRect& aSize) const;
|
void CalculateDiscreteSurfaceSize(nsRect& aRequestedSize, nsRect& aSize) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the size of the offscreen drawing surface..
|
* Get the size of the offscreen drawing surface..
|
||||||
|
@ -331,6 +328,9 @@ private:
|
||||||
static nsSize gOffScreenSize;
|
static nsSize gOffScreenSize;
|
||||||
static nsSize gBlendSize;
|
static nsSize gBlendSize;
|
||||||
|
|
||||||
|
// Largest requested offscreen size if larger than a full screen.
|
||||||
|
static nsSize gLargestRequestedSize;
|
||||||
|
|
||||||
//list of view managers
|
//list of view managers
|
||||||
static nsVoidArray *gViewManagers;
|
static nsVoidArray *gViewManagers;
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче