Added the DrawStdLine call. The RenderingContext now updates the mTransMatrix pointer member so the RenderingContextImpl can use this matrix.

This commit is contained in:
dcone%netscape.com 2000-05-11 21:05:49 +00:00
Родитель fd11a8f6a4
Коммит ec0f7330b9
2 изменённых файлов: 29 добавлений и 0 удалений

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

@ -198,6 +198,7 @@ void nsRenderingContextMac::SelectDrawingSurface(nsDrawingSurfaceMac* aSurface,
mCurrentSurface = aSurface;
aSurface->GetGrafPtr(&mPort);
mGS = aSurface->GetGS();
mTranMatrix = &(mGS->mTMatrix);
// quickdraw initialization
::SetPort(mPort);
@ -308,6 +309,9 @@ NS_IMETHODIMP nsRenderingContextMac::PopState(PRBool &aClipEmpty)
// remove the GS object from the stack and delete it
mGSStack->RemoveElementAt(index);
sGraphicStatePool.ReleaseGS(gs);
// make sure the matrix is pointing at the current matrix
mTranMatrix = &(mGS->mTMatrix);
}
aClipEmpty = (::EmptyRgn(mGS->mClipRegion));
@ -862,6 +866,30 @@ NS_IMETHODIMP nsRenderingContextMac::DrawLine(nscoord aX0, nscoord aY0, nscoord
return NS_OK;
}
//------------------------------------------------------------------------
NS_IMETHODIMP nsRenderingContextMac::DrawStdLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1)
{
StPortSetter setter(mPort);
// make the line one pixel shorter to match other platforms
nscoord diffX = aX1 - aX0;
if (diffX)
diffX -= (diffX > 0 ? 1 : -1);
nscoord diffY = aY1 - aY0;
if (diffY)
diffY -= (diffY > 0 ? 1 : -1);
// draw line
::MoveTo(aX0, aY0);
::Line(diffX, diffY);
return NS_OK;
}
//------------------------------------------------------------------------
NS_IMETHODIMP nsRenderingContextMac::DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints)

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

@ -88,6 +88,7 @@ public:
NS_IMETHOD CreateDrawingSurface(nsRect *aBounds, PRUint32 aSurfFlags, nsDrawingSurface &aSurface);
NS_IMETHOD DestroyDrawingSurface(nsDrawingSurface aDS);
NS_IMETHOD DrawLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
NS_IMETHOD DrawStdLine(nscoord aX0, nscoord aY0, nscoord aX1, nscoord aY1);
NS_IMETHOD DrawPolyline(const nsPoint aPoints[], PRInt32 aNumPoints);
NS_IMETHOD DrawRect(const nsRect& aRect);
NS_IMETHOD DrawRect(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight);