Public Member Functions

gfxContextPathAutoSaveRestore Class Reference

Sentry helper class for functions with multiple return points that need to back up the current path of a context and have it automatically restored before they return. More...

#include <gfxContext.h>

Collaboration diagram for gfxContextPathAutoSaveRestore:

List of all members.

Public Member Functions

 gfxContextPathAutoSaveRestore ()
 gfxContextPathAutoSaveRestore (gfxContext *aContext, PRBool aSave=1)
 ~gfxContextPathAutoSaveRestore ()
void SetContext (gfxContext *aContext, PRBool aSave=1)
void Save ()
 If a path is already saved, does nothing.
void Restore ()
 If no path is saved, does nothing.

Detailed Description

Sentry helper class for functions with multiple return points that need to back up the current path of a context and have it automatically restored before they return.

This class assumes that the transformation matrix will be the same when Save and Restore are called. The calling function must ensure that this is the case or the path will be copied incorrectly.


Constructor & Destructor Documentation

gfxContextPathAutoSaveRestore::gfxContextPathAutoSaveRestore (  )  [inline]
gfxContextPathAutoSaveRestore::gfxContextPathAutoSaveRestore ( gfxContext aContext,
PRBool  aSave = 1 
) [inline]
gfxContextPathAutoSaveRestore::~gfxContextPathAutoSaveRestore (  )  [inline]

Member Function Documentation

void gfxContextPathAutoSaveRestore::Restore (  )  [inline]

If no path is saved, does nothing.

Else replaces the context's path with a copy of the saved one, and clears the saved path.

void gfxContextPathAutoSaveRestore::Save (  )  [inline]

If a path is already saved, does nothing.

Else copies the current path so that it may be restored.

void gfxContextPathAutoSaveRestore::SetContext ( gfxContext aContext,
PRBool  aSave = 1 
) [inline]

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