Use StPortSetter from the nsGfxUtils.h header. r=pinkerton

This commit is contained in:
sfraser%netscape.com 2000-03-21 21:43:13 +00:00
Родитель e35432ce72
Коммит e3042083ab
1 изменённых файлов: 2 добавлений и 24 удалений

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

@ -34,7 +34,9 @@
#include "nsTransform2D.h"
#include "nsVoidArray.h"
#include "nsGfxCIID.h"
#include "nsGfxUtils.h"
#include "nsCOMPtr.h"
#include "plhash.h"
#include <FixMath.h>
@ -45,30 +47,6 @@
#define STACK_TREASHOLD 1000
//------------------------------------------------------------------------
// utility port setting class
//------------------------------------------------------------------------
class StPortSetter {
public:
StPortSetter(GrafPtr newPort)
: mNewPort(newPort), mOldPort(::GetQDGlobalsThePort())
{
if (mOldPort != newPort)
::SetPort(newPort);
}
~StPortSetter()
{
if (mOldPort != mNewPort)
::SetPort(mOldPort);
}
protected:
GrafPtr mNewPort;
GrafPtr mOldPort;
};
//------------------------------------------------------------------------
nsRenderingContextMac::nsRenderingContextMac()