From 512fff1d9054c2c5978628e7fa0cdca816191514 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Mon, 31 May 1999 01:30:59 +0000 Subject: [PATCH] added mChanges, bitmask indicating differences between graphics states, made mTMatrix a member object to reduce allocations, added mNext link field to support recycling. Changed nsGraphicsStatePool to just keep a free list of nsGraphicState objects rather than an array. --- gfx/src/mac/nsGraphicState.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/gfx/src/mac/nsGraphicState.h b/gfx/src/mac/nsGraphicState.h index 68087141d10e..e6212e637d8c 100644 --- a/gfx/src/mac/nsGraphicState.h +++ b/gfx/src/mac/nsGraphicState.h @@ -21,8 +21,12 @@ #define nsGraphicState_h___ #include "nsIRenderingContext.h" +#include "nsTransform2D.h" #include "nsCRT.h" -#include + +#ifndef __QUICKDRAW__ +#include +#endif //------------------------------------------------------------------------ @@ -39,13 +43,16 @@ public: void Init(GrafPtr aPort); void Init(nsIWidget* aWindow); void Duplicate(nsGraphicState* aGS); // would you prefer an '=' operator? - // - no thanks, + // - no thanks, + + void SetChanges(PRUint32 aChanges) { mChanges = aChanges; } + PRUint32 GetChanges() { return mChanges; } protected: - RgnHandle DuplicateRgn(RgnHandle aRgn); + RgnHandle DuplicateRgn(RgnHandle aRgn, RgnHandle aDestRgn = nsnull); public: - nsTransform2D * mTMatrix; // transform that all the graphics drawn here will obey + nsTransform2D mTMatrix; // transform that all the graphics drawn here will obey PRInt32 mOffx; PRInt32 mOffy; @@ -57,6 +64,12 @@ public: PRInt32 mFont; nsIFontMetrics * mFontMetrics; PRInt32 mCurrFontHandle; + + PRUint32 mChanges; // flags indicating changes between this graphics state and the previous. + +private: + friend class nsGraphicStatePool; + nsGraphicState* mNext; // link into free list of graphics states. }; //------------------------------------------------------------------------ @@ -71,6 +84,7 @@ public: void ReleaseGS(nsGraphicState* aGS); private: +#if 0 static const short kGSPoolCount = 80; // sizeof(nsGraphicState) = 36 bytes typedef struct nsGSRec @@ -80,6 +94,9 @@ private: } nsGSRec; nsGSRec mGSArray[kGSPoolCount]; +#endif + + nsGraphicState* mFreeList; }; //------------------------------------------------------------------------