Back to index

lightning-sunbird  0.9+nobinonly
Public Member Functions | Public Attributes | Protected Member Functions | Private Attributes | Friends
nsGraphicState Class Reference

#include <nsGraphicState.h>

Collaboration diagram for nsGraphicState:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 nsGraphicState ()
 ~nsGraphicState ()
NS_DECL_AND_IMPL_ZEROING_OPERATOR_NEW
void 
Clear ()
void Init (nsIDrawingSurface *aSurface)
void Init (CGrafPtr aPort)
void Init (nsIWidget *aWindow)
void Duplicate (nsGraphicState *aGS)
void SetChanges (PRUint32 aChanges)
PRUint32 GetChanges ()

Public Attributes

nsTransform2D mTMatrix
PRInt32 mOffx
PRInt32 mOffy
RgnHandle mMainRegion
RgnHandle mClipRegion
nscolor mColor
PRInt32 mFont
nsIFontMetricsmFontMetrics
PRInt32 mCurrFontHandle
nsLineStyle mLineStyle
PRUint32 mChanges

Protected Member Functions

RgnHandle DuplicateRgn (RgnHandle aRgn, RgnHandle aDestRgn=nsnull)

Private Attributes

nsGraphicStatemNext

Friends

class nsGraphicStatePool

Detailed Description

Definition at line 52 of file nsGraphicState.h.


Constructor & Destructor Documentation

Definition at line 95 of file nsGraphicState.cpp.

{
       // everything is initialized to 0 through the 'new' operator
}

Definition at line 102 of file nsGraphicState.cpp.

{
       Clear();
}

Here is the call graph for this function:


Member Function Documentation

Definition at line 109 of file nsGraphicState.cpp.

{
       mTMatrix.SetToIdentity();

       if (mMainRegion) {
              sNativeRegionPool.ReleaseRegion(mMainRegion); //::DisposeRgn(mMainRegion);
              mMainRegion = nsnull;
       }

       if (mClipRegion) {
              sNativeRegionPool.ReleaseRegion(mClipRegion); //::DisposeRgn(mClipRegion);
              mClipRegion = nsnull;
       }

  NS_IF_RELEASE(mFontMetrics);

  mOffx                                          = 0;
  mOffy                                          = 0;
  mColor                                  = NS_RGB(255,255,255);
       mFont                                     = 0;
  mFontMetrics              = nsnull;
  mCurrFontHandle    = 0;
  mLineStyle = nsLineStyle_kSolid;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 188 of file nsGraphicState.cpp.

{
       // clear old values? no need, just copying them any way.
       // Clear();

       // copy new ones
       mTMatrix.SetMatrix(&aGS->mTMatrix);

       mOffx                                     = aGS->mOffx;
       mOffy                                     = aGS->mOffy;

       mMainRegion                 = DuplicateRgn(aGS->mMainRegion, mMainRegion);
       mClipRegion                 = DuplicateRgn(aGS->mClipRegion, mClipRegion);

       mColor                             = aGS->mColor;
       mFont                                     = aGS->mFont;
       
       NS_IF_RELEASE(mFontMetrics);
       mFontMetrics         = aGS->mFontMetrics;
       NS_IF_ADDREF(mFontMetrics);

       mCurrFontHandle      = aGS->mCurrFontHandle;

       mLineStyle = aGS->mLineStyle;
       
       mChanges                           = aGS->mChanges;
}

Here is the call graph for this function:

Here is the caller graph for this function:

RgnHandle nsGraphicState::DuplicateRgn ( RgnHandle  aRgn,
RgnHandle  aDestRgn = nsnull 
) [protected]

Definition at line 218 of file nsGraphicState.cpp.

{
       RgnHandle dupRgn = aDestRgn;
       if (aRgn)     {
              if (nsnull == dupRgn)
                     dupRgn = sNativeRegionPool.GetNewRegion(); //::NewRgn();
              if (dupRgn)
                     ::CopyRgn(aRgn, dupRgn);
       }
       return dupRgn;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 67 of file nsGraphicState.h.

{ return mChanges; } 

Here is the caller graph for this function:

Definition at line 136 of file nsGraphicState.cpp.

{
       // retrieve the grafPort
       nsDrawingSurfaceMac* surface = static_cast<nsDrawingSurfaceMac*>(aSurface);
       CGrafPtr port;
       surface->GetGrafPtr(&port);

       // init from grafPort
       Init(port);
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 149 of file nsGraphicState.cpp.

{
       // delete old values
       Clear();

       // init from grafPort (usually an offscreen port)
       RgnHandle     rgn = sNativeRegionPool.GetNewRegion(); //::NewRgn();
       if ( rgn ) {
              Rect bounds;
              ::RectRgn(rgn, ::GetPortBounds(aPort, &bounds));
       }

  Rect    portBounds;
  ::GetPortBounds(aPort, &portBounds);
  mOffx = -portBounds.left;
  mOffy = -portBounds.top;
  
  mMainRegion                             = rgn;
  mClipRegion                             = DuplicateRgn(rgn);
}

Here is the call graph for this function:

Definition at line 172 of file nsGraphicState.cpp.

{
       // delete old values
       Clear();

       // init from widget
  mOffx                                          = (PRInt32)aWindow->GetNativeData(NS_NATIVE_OFFSETX);
  mOffy                                          = (PRInt32)aWindow->GetNativeData(NS_NATIVE_OFFSETY);

       RgnHandle widgetRgn = (RgnHandle)aWindow->GetNativeData(NS_NATIVE_REGION);
       mMainRegion                               = DuplicateRgn(widgetRgn);
  mClipRegion                             = DuplicateRgn(widgetRgn);
}

Here is the call graph for this function:

void nsGraphicState::SetChanges ( PRUint32  aChanges) [inline]

Definition at line 66 of file nsGraphicState.h.

{ mChanges = aChanges; }

Here is the caller graph for this function:


Friends And Related Function Documentation

friend class nsGraphicStatePool [friend]

Definition at line 90 of file nsGraphicState.h.


Member Data Documentation

Definition at line 87 of file nsGraphicState.h.

Definition at line 79 of file nsGraphicState.h.

Definition at line 81 of file nsGraphicState.h.

Definition at line 84 of file nsGraphicState.h.

Definition at line 82 of file nsGraphicState.h.

Definition at line 83 of file nsGraphicState.h.

Definition at line 85 of file nsGraphicState.h.

Definition at line 78 of file nsGraphicState.h.

Definition at line 91 of file nsGraphicState.h.

Definition at line 75 of file nsGraphicState.h.

Definition at line 76 of file nsGraphicState.h.

nsTransform2D nsGraphicState::mTMatrix

Definition at line 73 of file nsGraphicState.h.


The documentation for this class was generated from the following files: