зеркало из https://github.com/mozilla/pjs.git
Added assertions to the gfx code so that we can find xp bugs easier
This commit is contained in:
Родитель
ec9074b5e1
Коммит
07ebf09540
|
@ -63,6 +63,8 @@ NS_IMPL_ISUPPORTS(nsImageGTK, kIImageIID);
|
||||||
|
|
||||||
nsresult nsImageGTK :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMaskRequirements aMaskRequirements)
|
nsresult nsImageGTK :: Init(PRInt32 aWidth, PRInt32 aHeight, PRInt32 aDepth,nsMaskRequirements aMaskRequirements)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail ((aWidth != 0) || (aHeight != 0), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
if (nsnull != mImageBits)
|
if (nsnull != mImageBits)
|
||||||
delete[] (PRUint8*)mImageBits;
|
delete[] (PRUint8*)mImageBits;
|
||||||
|
|
||||||
|
@ -245,6 +247,8 @@ NS_IMETHODIMP nsImageGTK :: Draw(nsIRenderingContext &aContext, nsDrawingSurface
|
||||||
PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
PRInt32 aSX, PRInt32 aSY, PRInt32 aSWidth, PRInt32 aSHeight,
|
||||||
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
|
PRInt32 aDX, PRInt32 aDY, PRInt32 aDWidth, PRInt32 aDHeight)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail ((aSurface != NULL), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsDrawingSurfaceGTK *drawing = (nsDrawingSurfaceGTK*)aSurface;
|
nsDrawingSurfaceGTK *drawing = (nsDrawingSurfaceGTK*)aSurface;
|
||||||
|
|
||||||
moz_gdk_draw_bgr_image (drawing->drawable,
|
moz_gdk_draw_bgr_image (drawing->drawable,
|
||||||
|
@ -265,7 +269,10 @@ NS_IMETHODIMP nsImageGTK :: Draw(nsIRenderingContext &aContext,
|
||||||
PRInt32 aX, PRInt32 aY,
|
PRInt32 aX, PRInt32 aY,
|
||||||
PRInt32 aWidth, PRInt32 aHeight)
|
PRInt32 aWidth, PRInt32 aHeight)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail ((aSurface != NULL), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsDrawingSurfaceGTK *drawing = (nsDrawingSurfaceGTK*) aSurface;
|
nsDrawingSurfaceGTK *drawing = (nsDrawingSurfaceGTK*) aSurface;
|
||||||
|
|
||||||
XImage *x_image = NULL;
|
XImage *x_image = NULL;
|
||||||
Pixmap pixmap = 0;
|
Pixmap pixmap = 0;
|
||||||
Display *dpy = NULL;
|
Display *dpy = NULL;
|
||||||
|
|
|
@ -513,6 +513,9 @@ NS_IMETHODIMP nsRenderingContextGTK::CreateDrawingSurface(nsRect *aBounds,
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_return_val_if_fail ((aBounds != NULL), NS_ERROR_FAILURE);
|
||||||
|
g_return_val_if_fail ((aBounds->width != 0) && (aBounds->height != 0), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
pixmap = ::gdk_pixmap_new(mRenderingSurface->drawable, aBounds->width, aBounds->height, -1);
|
pixmap = ::gdk_pixmap_new(mRenderingSurface->drawable, aBounds->width, aBounds->height, -1);
|
||||||
nsDrawingSurfaceGTK * surface = new nsDrawingSurfaceGTK();
|
nsDrawingSurfaceGTK * surface = new nsDrawingSurfaceGTK();
|
||||||
|
|
||||||
|
@ -528,6 +531,8 @@ NS_IMETHODIMP nsRenderingContextGTK::DestroyDrawingSurface(nsDrawingSurface aDS)
|
||||||
{
|
{
|
||||||
nsDrawingSurfaceGTK * surface = (nsDrawingSurfaceGTK *) aDS;
|
nsDrawingSurfaceGTK * surface = (nsDrawingSurfaceGTK *) aDS;
|
||||||
|
|
||||||
|
g_return_val_if_fail ((surface != NULL), NS_ERROR_FAILURE);
|
||||||
|
g_return_val_if_fail ((surface->drawable != NULL), NS_ERROR_FAILURE);
|
||||||
::gdk_pixmap_unref (surface->drawable);
|
::gdk_pixmap_unref (surface->drawable);
|
||||||
|
|
||||||
delete surface;
|
delete surface;
|
||||||
|
@ -537,9 +542,12 @@ NS_IMETHODIMP nsRenderingContextGTK::DestroyDrawingSurface(nsDrawingSurface aDS)
|
||||||
|
|
||||||
NS_IMETHODIMP nsRenderingContextGTK::DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
|
NS_IMETHODIMP nsRenderingContextGTK::DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
|
||||||
{
|
{
|
||||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
return NS_ERROR_FAILURE;
|
(mRenderingSurface != NULL) ||
|
||||||
}
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
mTMatrix->TransformCoord(&aX0,&aY0);
|
mTMatrix->TransformCoord(&aX0,&aY0);
|
||||||
mTMatrix->TransformCoord(&aX1,&aY1);
|
mTMatrix->TransformCoord(&aX1,&aY1);
|
||||||
|
|
||||||
|
@ -552,11 +560,14 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawLine(nscoord aX0, nscoord aY0, nscoord
|
||||||
|
|
||||||
NS_IMETHODIMP nsRenderingContextGTK::DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
|
NS_IMETHODIMP nsRenderingContextGTK::DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||||
{
|
{
|
||||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
}
|
|
||||||
PRUint32 i ;
|
PRUint32 i ;
|
||||||
|
|
||||||
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
|
(mRenderingSurface != NULL) ||
|
||||||
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
GdkPoint *pts = new GdkPoint[aNumPoints];
|
GdkPoint *pts = new GdkPoint[aNumPoints];
|
||||||
for (PRInt32 i = 0; i < aNumPoints; i++)
|
for (PRInt32 i = 0; i < aNumPoints; i++)
|
||||||
{
|
{
|
||||||
|
@ -593,6 +604,9 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawRect(nscoord aX, nscoord aY, nscoord aW
|
||||||
w = aWidth;
|
w = aWidth;
|
||||||
h = aHeight;
|
h = aHeight;
|
||||||
|
|
||||||
|
g_return_val_if_fail ((mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL), NS_ERROR_FAILURE);
|
||||||
|
|
||||||
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
mTMatrix->TransformCoord(&x,&y,&w,&h);
|
||||||
|
|
||||||
::gdk_draw_rectangle(mRenderingSurface->drawable, mRenderingSurface->gc,
|
::gdk_draw_rectangle(mRenderingSurface->drawable, mRenderingSurface->gc,
|
||||||
|
@ -631,9 +645,11 @@ NS_IMETHODIMP nsRenderingContextGTK::FillRect(nscoord aX, nscoord aY, nscoord aW
|
||||||
|
|
||||||
NS_IMETHODIMP nsRenderingContextGTK::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
NS_IMETHODIMP nsRenderingContextGTK::DrawPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||||
{
|
{
|
||||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
return NS_ERROR_FAILURE;
|
(mRenderingSurface != NULL) ||
|
||||||
}
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
GdkPoint *pts = new GdkPoint[aNumPoints];
|
GdkPoint *pts = new GdkPoint[aNumPoints];
|
||||||
for (PRInt32 i = 0; i < aNumPoints; i++)
|
for (PRInt32 i = 0; i < aNumPoints; i++)
|
||||||
|
@ -652,9 +668,11 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawPolygon(const nsPoint aPoints[], PRInt3
|
||||||
|
|
||||||
NS_IMETHODIMP nsRenderingContextGTK::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
NS_IMETHODIMP nsRenderingContextGTK::FillPolygon(const nsPoint aPoints[], PRInt32 aNumPoints)
|
||||||
{
|
{
|
||||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
return NS_ERROR_FAILURE;
|
(mRenderingSurface != NULL) ||
|
||||||
}
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
GdkPoint *pts = new GdkPoint[aNumPoints];
|
GdkPoint *pts = new GdkPoint[aNumPoints];
|
||||||
for (PRInt32 i = 0; i < aNumPoints; i++)
|
for (PRInt32 i = 0; i < aNumPoints; i++)
|
||||||
|
@ -678,9 +696,12 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawEllipse(const nsRect& aRect)
|
||||||
|
|
||||||
NS_IMETHODIMP nsRenderingContextGTK::DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
NS_IMETHODIMP nsRenderingContextGTK::DrawEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||||
{
|
{
|
||||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
return NS_ERROR_FAILURE;
|
(mRenderingSurface != NULL) ||
|
||||||
}
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nscoord x,y,w,h;
|
nscoord x,y,w,h;
|
||||||
|
|
||||||
x = aX;
|
x = aX;
|
||||||
|
@ -704,9 +725,12 @@ NS_IMETHODIMP nsRenderingContextGTK::FillEllipse(const nsRect& aRect)
|
||||||
|
|
||||||
NS_IMETHODIMP nsRenderingContextGTK::FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
NS_IMETHODIMP nsRenderingContextGTK::FillEllipse(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight)
|
||||||
{
|
{
|
||||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
return NS_ERROR_FAILURE;
|
(mRenderingSurface != NULL) ||
|
||||||
}
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nscoord x,y,w,h;
|
nscoord x,y,w,h;
|
||||||
|
|
||||||
x = aX;
|
x = aX;
|
||||||
|
@ -733,9 +757,12 @@ NS_IMETHODIMP nsRenderingContextGTK::DrawArc(nscoord aX, nscoord aY,
|
||||||
nscoord aWidth, nscoord aHeight,
|
nscoord aWidth, nscoord aHeight,
|
||||||
float aStartAngle, float aEndAngle)
|
float aStartAngle, float aEndAngle)
|
||||||
{
|
{
|
||||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
return NS_ERROR_FAILURE;
|
(mRenderingSurface != NULL) ||
|
||||||
}
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nscoord x,y,w,h;
|
nscoord x,y,w,h;
|
||||||
|
|
||||||
x = aX;
|
x = aX;
|
||||||
|
@ -764,9 +791,12 @@ NS_IMETHODIMP nsRenderingContextGTK::FillArc(nscoord aX, nscoord aY,
|
||||||
nscoord aWidth, nscoord aHeight,
|
nscoord aWidth, nscoord aHeight,
|
||||||
float aStartAngle, float aEndAngle)
|
float aStartAngle, float aEndAngle)
|
||||||
{
|
{
|
||||||
if (nsnull == mTMatrix || nsnull == mRenderingSurface) {
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
return NS_ERROR_FAILURE;
|
(mRenderingSurface != NULL) ||
|
||||||
}
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nscoord x,y,w,h;
|
nscoord x,y,w,h;
|
||||||
|
|
||||||
x = aX;
|
x = aX;
|
||||||
|
@ -814,6 +844,11 @@ NS_IMETHODIMP nsRenderingContextGTK::GetWidth(const char *aString, nscoord &aWid
|
||||||
NS_IMETHODIMP nsRenderingContextGTK::GetWidth(const char *aString,
|
NS_IMETHODIMP nsRenderingContextGTK::GetWidth(const char *aString,
|
||||||
PRUint32 aLength, nscoord &aWidth)
|
PRUint32 aLength, nscoord &aWidth)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail ((aString != NULL) ||
|
||||||
|
(aLength != 0) ||
|
||||||
|
(aWidth != 0),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
PRInt32 rc;
|
PRInt32 rc;
|
||||||
|
|
||||||
GdkFont *font = (GdkFont *)mCurrentFont;
|
GdkFont *font = (GdkFont *)mCurrentFont;
|
||||||
|
@ -828,6 +863,11 @@ NS_IMETHODIMP nsRenderingContextGTK::GetWidth(const char *aString,
|
||||||
NS_IMETHODIMP nsRenderingContextGTK::GetWidth(const PRUnichar *aString,
|
NS_IMETHODIMP nsRenderingContextGTK::GetWidth(const PRUnichar *aString,
|
||||||
PRUint32 aLength, nscoord &aWidth)
|
PRUint32 aLength, nscoord &aWidth)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail ((aString != NULL) ||
|
||||||
|
(aLength != 0) ||
|
||||||
|
(aWidth != 0),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nsString nsStr;
|
nsString nsStr;
|
||||||
nsStr.SetString(aString, aLength);
|
nsStr.SetString(aString, aLength);
|
||||||
char* cStr = nsStr.ToNewCString();
|
char* cStr = nsStr.ToNewCString();
|
||||||
|
@ -842,6 +882,15 @@ nsRenderingContextGTK::DrawString(const char *aString, PRUint32 aLength,
|
||||||
nscoord aWidth,
|
nscoord aWidth,
|
||||||
const nscoord* aSpacing)
|
const nscoord* aSpacing)
|
||||||
{
|
{
|
||||||
|
g_return_val_if_fail ((aString != NULL) ||
|
||||||
|
(aLength != 0) ||
|
||||||
|
(aWidth != 0) ||
|
||||||
|
(mTMatrix != NULL) ||
|
||||||
|
(mRenderingSurface != NULL) ||
|
||||||
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
nscoord x = aX;
|
nscoord x = aX;
|
||||||
nscoord y = aY;
|
nscoord y = aY;
|
||||||
|
|
||||||
|
@ -968,6 +1017,12 @@ nsRenderingContextGTK::CopyOffScreenBits(nsDrawingSurface aSrcSurf,
|
||||||
nsRect drect = aDestBounds;
|
nsRect drect = aDestBounds;
|
||||||
nsDrawingSurfaceGTK *destsurf;
|
nsDrawingSurfaceGTK *destsurf;
|
||||||
|
|
||||||
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
|
(mRenderingSurface != NULL) ||
|
||||||
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
if (aCopyFlags & NS_COPYBITS_TO_BACK_BUFFER)
|
if (aCopyFlags & NS_COPYBITS_TO_BACK_BUFFER)
|
||||||
{
|
{
|
||||||
NS_ASSERTION(!(nsnull == mRenderingSurface), "no back buffer");
|
NS_ASSERTION(!(nsnull == mRenderingSurface), "no back buffer");
|
||||||
|
@ -1000,6 +1055,13 @@ nsRenderingContextGTK::SetClipRectInPixels(const nsRect& aRect,
|
||||||
nsClipCombine aCombine,
|
nsClipCombine aCombine,
|
||||||
PRBool &aClipEmpty)
|
PRBool &aClipEmpty)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
g_return_val_if_fail ((mTMatrix != NULL) ||
|
||||||
|
(mRenderingSurface != NULL) ||
|
||||||
|
(mRenderingSurface->drawable != NULL) ||
|
||||||
|
(mRenderingSurface->gc != NULL),
|
||||||
|
NS_ERROR_FAILURE);
|
||||||
|
|
||||||
PRBool bEmpty = PR_FALSE;
|
PRBool bEmpty = PR_FALSE;
|
||||||
|
|
||||||
nsRect trect = aRect;
|
nsRect trect = aRect;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче