From 6266dfafbf19cb3aa4b2bf3f915dec8d4956e980 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Thu, 19 Aug 2004 21:58:21 +0000 Subject: [PATCH] Don't bother with DrawTile when the destination rect is empty. b=237766 r+sr=roc --- gfx/src/shared/nsRenderingContextImpl.cpp | 6 +++++- gfx/src/windows/nsImageWin.cpp | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gfx/src/shared/nsRenderingContextImpl.cpp b/gfx/src/shared/nsRenderingContextImpl.cpp index ee3ba217af5..94b8934e2c2 100644 --- a/gfx/src/shared/nsRenderingContextImpl.cpp +++ b/gfx/src/shared/nsRenderingContextImpl.cpp @@ -348,12 +348,16 @@ nsRenderingContextImpl::DrawTile(imgIContainer *aImage, mTranMatrix->TransformCoord(&dr.x, &dr.y, &dr.width, &dr.height); mTranMatrix->TransformCoord(&aXImageStart, &aYImageStart); + // may have become empty due to transform shinking small number to 0 + if (dr.IsEmpty()) + return NS_OK; + nscoord width, height; aImage->GetWidth(&width); aImage->GetHeight(&height); if (width == 0 || height == 0) - return PR_FALSE; + return NS_OK; nscoord xOffset = (dr.x - aXImageStart) % width; nscoord yOffset = (dr.y - aYImageStart) % height; diff --git a/gfx/src/windows/nsImageWin.cpp b/gfx/src/windows/nsImageWin.cpp index b88ef1711b6..cc54b9cda01 100644 --- a/gfx/src/windows/nsImageWin.cpp +++ b/gfx/src/windows/nsImageWin.cpp @@ -803,6 +803,7 @@ NS_IMETHODIMP nsImageWin::DrawTile(nsIRenderingContext &aContext, PRInt32 aPadX, PRInt32 aPadY, const nsRect &aDestRect) { + NS_ASSERTION(!aDestRect.IsEmpty(), "DrawTile doesn't work with empty rects"); if (mDecodedX2 < mDecodedX1 || mDecodedY2 < mDecodedY1) return NS_OK;