Bug 59528 - BeOS: images are drawn outside of its bounding box - r=cls

This commit is contained in:
koehler%mythrium.com 2000-12-22 23:19:04 +00:00
parent a1b8c789f4
commit 37ea41723f
3 changed files with 29 additions and 30 deletions

View File

@ -271,35 +271,34 @@ nsImageBeOS::Draw(nsIRenderingContext &aContext,
PRInt32 aX, PRInt32 aY,
PRInt32 aWidth, PRInt32 aHeight)
{
// XXX kipp: this is temporary code until we eliminate the
// width/height arguments from the draw method.
if((aWidth != mWidth) || (aHeight != mHeight))
{
aWidth = mWidth;
aHeight = mHeight;
}
// XXX kipp: this is temporary code until we eliminate the
// width/height arguments from the draw method.
aWidth = PR_MIN(aWidth, mWidth);
aHeight = PR_MIN(aHeight, mHeight);
nsDrawingSurfaceBeOS *beosdrawing = (nsDrawingSurfaceBeOS *) aSurface;
BView *view;
nsDrawingSurfaceBeOS *beosdrawing = (nsDrawingSurfaceBeOS *) aSurface;
BView *view;
beosdrawing->AcquireView(&view);
if((PR_FALSE == mStaticImage) || (NULL == mImage))
BuildImage(aSurface);
if((PR_FALSE == mStaticImage) || (NULL == mImage))
BuildImage(aSurface);
if(NULL == mImage)
return PR_FALSE;
if(NULL == mImage)
return PR_FALSE;
if(view && view->LockLooper())
{
view->SetDrawingMode(B_OP_ALPHA);
view->DrawBitmapAsync(mImage, BRect(aX, aY, aX + aWidth - 1, aY + aHeight - 1));
view->SetDrawingMode(B_OP_COPY);
view->UnlockLooper();
}
beosdrawing->ReleaseView();
if(view && view->LockLooper())
{
view->SetDrawingMode(B_OP_ALPHA);
view->DrawBitmapAsync(mImage,
BRect(0, 0, aWidth - 1, aHeight - 1),
BRect(aX, aY, aX + aWidth - 1, aY + aHeight - 1));
view->SetDrawingMode(B_OP_COPY);
view->UnlockLooper();
}
beosdrawing->ReleaseView();
return NS_OK;
return NS_OK;
}
/**

View File

@ -2277,7 +2277,7 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
}
}
#ifndef XP_UNIX
#if !defined(XP_UNIX) && !defined(XP_BEOS)
// Setup clipping so that rendering doesn't leak out of the computed
// dirty rect
PRBool clipState;
@ -2359,7 +2359,7 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
}
}
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_BEOS)
// Take the intersection again to paint only the required area
nsRect tileRect(x0,y0,(x1-x0),(y1-y0));
nsRect drawRect;
@ -2424,7 +2424,7 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
theTransform->AddScale(app2dev, app2dev);
// XXX this #ifdef needs to go away when we are sure that this works on windows and mac
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_BEOS)
srcRect.SetRect(0,0,tvrect.width,tvrect.height);
aRenderingContext.SetClipRect(srcRect, nsClipCombine_kReplace, clip);
#endif
@ -2475,7 +2475,7 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
}
#endif
#ifndef XP_UNIX
#if !defined(XP_UNIX) && !defined(XP_BEOS)
// Restore clipping
aRenderingContext.PopState(clipState);
#endif

View File

@ -2277,7 +2277,7 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
}
}
#ifndef XP_UNIX
#if !defined(XP_UNIX) && !defined(XP_BEOS)
// Setup clipping so that rendering doesn't leak out of the computed
// dirty rect
PRBool clipState;
@ -2359,7 +2359,7 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
}
}
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_BEOS)
// Take the intersection again to paint only the required area
nsRect tileRect(x0,y0,(x1-x0),(y1-y0));
nsRect drawRect;
@ -2424,7 +2424,7 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
theTransform->AddScale(app2dev, app2dev);
// XXX this #ifdef needs to go away when we are sure that this works on windows and mac
#ifdef XP_UNIX
#if defined(XP_UNIX) || defined(XP_BEOS)
srcRect.SetRect(0,0,tvrect.width,tvrect.height);
aRenderingContext.SetClipRect(srcRect, nsClipCombine_kReplace, clip);
#endif
@ -2475,7 +2475,7 @@ nsCSSRendering::PaintBackground(nsIPresContext* aPresContext,
}
#endif
#ifndef XP_UNIX
#if !defined(XP_UNIX) && !defined(XP_BEOS)
// Restore clipping
aRenderingContext.PopState(clipState);
#endif