From a60fbefc56b1be8983f96801e46527d6af4fee21 Mon Sep 17 00:00:00 2001 From: michaelp Date: Thu, 7 May 1998 18:00:48 +0000 Subject: [PATCH] deferred creation of null pen until we actually need to use it. --- gfx/src/windows/nsRenderingContextWin.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/gfx/src/windows/nsRenderingContextWin.cpp b/gfx/src/windows/nsRenderingContextWin.cpp index 2796174334b4..eb7f104ccc0d 100644 --- a/gfx/src/windows/nsRenderingContextWin.cpp +++ b/gfx/src/windows/nsRenderingContextWin.cpp @@ -286,8 +286,6 @@ nsresult nsRenderingContextWin :: CommonInit(void) mBlackPen = ::CreatePen(PS_SOLID, 0, RGB(0, 0, 0)); mOrigSolidPen = ::SelectObject(mDC, mBlackPen); - mNullPen = ::CreatePen(PS_NULL, 0, 0); - return NS_OK; } @@ -646,6 +644,10 @@ void nsRenderingContextWin::FillPolygon(nsPoint aPoints[], PRInt32 aNumPoints) int pfm = ::GetPolyFillMode(mDC); ::SetPolyFillMode(mDC, WINDING); SetupSolidBrush(); + + if (NULL == mNullPen) + mNullPen = ::CreatePen(PS_NULL, 0, 0); + HPEN oldPen = ::SelectObject(mDC, mNullPen); ::Polygon(mDC, pp0, int(aNumPoints)); ::SelectObject(mDC, oldPen);