Fix memory allocation checking bug 9828.

Fix DrawLine and DrawString rendering bugs (contributed by
Yannick Koehler <koehler@mythrium.com>).
r=syd
This commit is contained in:
duncan%be.com 1999-11-28 10:53:47 +00:00
Родитель 118bd6c79b
Коммит 15817ebf5a
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -322,6 +322,9 @@ NS_IMETHODIMP nsRenderingContextBeOS::PushState(void)
{
GraphicsState * state = new GraphicsState();
if(!state)
return NS_ERROR_OUT_OF_MEMORY;
// Push into this state object, add to vector
state->mMatrix = mTMatrix;
@ -722,6 +725,11 @@ NS_IMETHODIMP nsRenderingContextBeOS::DrawLine(nscoord aX0, nscoord aY0, nscoord
mTMatrix->TransformCoord(&aX0, &aY0);
mTMatrix->TransformCoord(&aX1, &aY1);
if (aY0 != aY1)
aY1--;
if (aX0 != aX1)
aX1--;
if(mView && mView->LockLooper())
{
mView->StrokeLine(BPoint(aX0, aY0), BPoint(aX1, aY1)); // FIXME: add line style
@ -1143,6 +1151,7 @@ NS_IMETHODIMP nsRenderingContextBeOS::DrawString(const char *aString, PRUint32 a
{
PRIntn dxMem[500];
PRIntn *dx0;
PRInt32 currentX = x;
dx0 = dxMem;
if(aLength > 500)
@ -1150,7 +1159,10 @@ NS_IMETHODIMP nsRenderingContextBeOS::DrawString(const char *aString, PRUint32 a
mTMatrix->ScaleXCoords(aSpacing, aLength, dx0);
for(PRUint32 i = 0; i < aLength; i++)
mView->DrawString(&aString[i], 1L, BPoint(dx0[i], y));
{
mView->DrawString(&aString[i], 1L, BPoint(currentX, y));
currentX += dx0[i];
}
if((nsnull != aSpacing) && (dx0 != dxMem))
delete [] dx0;