зеркало из https://github.com/mozilla/pjs.git
inlining addref/release for thebes. bug 342593. r=mrbkap
This commit is contained in:
Родитель
0da7d7b5c1
Коммит
aa753000e1
|
@ -49,7 +49,7 @@
|
|||
* abstract class, and use gfxContext to draw on this surface.
|
||||
*/
|
||||
class THEBES_API gfxASurface {
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxASurface)
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -65,7 +65,7 @@ class gfxTextRun;
|
|||
* pattern set by SetPattern, SetColor or SetSource.
|
||||
*/
|
||||
class THEBES_API gfxContext {
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxContext)
|
||||
|
||||
public:
|
||||
/**
|
||||
|
|
|
@ -117,7 +117,7 @@ struct THEBES_API gfxFontStyle {
|
|||
|
||||
/* a SPECIFIC single font family */
|
||||
class THEBES_API gfxFont {
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxFont)
|
||||
|
||||
public:
|
||||
gfxFont(const nsAString &aName, const gfxFontStyle *aFontGroup);
|
||||
|
@ -204,7 +204,7 @@ protected:
|
|||
|
||||
// these do not copy the text
|
||||
class THEBES_API gfxTextRun {
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxTextRun)
|
||||
|
||||
public:
|
||||
virtual void Draw(gfxContext *aContext, gfxPoint pt) = 0;
|
||||
|
|
|
@ -50,7 +50,7 @@ class gfxContext;
|
|||
class THEBES_API gfxPattern {
|
||||
friend class gfxContext;
|
||||
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(gfxPattern)
|
||||
|
||||
public:
|
||||
// from another surface
|
||||
|
|
|
@ -61,17 +61,27 @@ typedef double gfxFloat;
|
|||
#include "nsISupportsImpl.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
#define THEBES_IMPL_REFCOUNTING(_class) \
|
||||
NS_IMPL_ADDREF(_class) \
|
||||
NS_IMPL_RELEASE(_class)
|
||||
|
||||
#define THEBES_DECL_REFCOUNTING \
|
||||
public: \
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void); \
|
||||
NS_IMETHOD_(nsrefcnt) Release(void); \
|
||||
protected: \
|
||||
nsAutoRefCnt mRefCnt; \
|
||||
NS_DECL_OWNINGTHREAD \
|
||||
#define THEBES_INLINE_DECL_REFCOUNTING(_class) \
|
||||
public: \
|
||||
nsrefcnt AddRef(void) { \
|
||||
NS_PRECONDITION(PRInt32(mRefCnt) >= 0, "illegal refcnt"); \
|
||||
++mRefCnt; \
|
||||
NS_LOG_ADDREF(this, mRefCnt, #_class, sizeof(*this)); \
|
||||
return mRefCnt; \
|
||||
} \
|
||||
nsrefcnt Release(void) { \
|
||||
NS_PRECONDITION(0 != mRefCnt, "dup release"); \
|
||||
--mRefCnt; \
|
||||
NS_LOG_RELEASE(this, mRefCnt, #_class); \
|
||||
if (mRefCnt == 0) { \
|
||||
mRefCnt = 1; /* stabilize */ \
|
||||
NS_DELETEXPCOM(this); \
|
||||
return 0; \
|
||||
} \
|
||||
return mRefCnt; \
|
||||
} \
|
||||
protected: \
|
||||
nsAutoRefCnt mRefCnt; \
|
||||
public:
|
||||
|
||||
#endif /* GFX_TYPES_H */
|
||||
|
|
|
@ -67,7 +67,7 @@
|
|||
class WeightTable
|
||||
{
|
||||
public:
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(WeightTable)
|
||||
|
||||
WeightTable() : mWeights(0) {}
|
||||
~WeightTable() {
|
||||
|
@ -238,7 +238,7 @@ static PRUint8 CharRangeBit(PRUint32 ch) {
|
|||
class FontEntry
|
||||
{
|
||||
public:
|
||||
THEBES_DECL_REFCOUNTING
|
||||
THEBES_INLINE_DECL_REFCOUNTING(FontEntry)
|
||||
|
||||
FontEntry(const nsAString& aName, PRUint16 aFontType) :
|
||||
mName(aName), mFontType(aFontType), mUnicodeFont(PR_FALSE),
|
||||
|
|
|
@ -25,7 +25,6 @@ CPPSRCS = \
|
|||
gfxASurface.cpp \
|
||||
gfxContext.cpp \
|
||||
gfxImageSurface.cpp \
|
||||
gfxPattern.cpp \
|
||||
gfxFont.cpp \
|
||||
gfxPlatform.cpp \
|
||||
$(NULL)
|
||||
|
|
|
@ -288,8 +288,6 @@ gfxAtsuiFontGroup::MakeTextRun(const nsAString& aString)
|
|||
** gfxAtsuiTextRun
|
||||
**/
|
||||
|
||||
THEBES_IMPL_REFCOUNTING(gfxAtsuiTextRun)
|
||||
|
||||
gfxAtsuiTextRun::gfxAtsuiTextRun(const nsAString& aString, gfxAtsuiFontGroup *aGroup)
|
||||
: mString(aString), mGroup(aGroup)
|
||||
{
|
||||
|
|
|
@ -52,9 +52,6 @@
|
|||
#include "gfxASurface.h"
|
||||
#include "gfxPattern.h"
|
||||
|
||||
THEBES_IMPL_REFCOUNTING(gfxContext)
|
||||
THEBES_IMPL_REFCOUNTING(gfxASurface)
|
||||
|
||||
gfxContext::gfxContext(gfxASurface *surface) :
|
||||
mSurface(surface)
|
||||
{
|
||||
|
|
|
@ -46,9 +46,6 @@
|
|||
|
||||
#include "nsCRT.h"
|
||||
|
||||
THEBES_IMPL_REFCOUNTING(gfxFont)
|
||||
THEBES_IMPL_REFCOUNTING(gfxTextRun)
|
||||
|
||||
gfxFont::gfxFont(const nsAString &aName, const gfxFontStyle *aFontStyle) :
|
||||
mName(aName), mStyle(aFontStyle)
|
||||
{
|
||||
|
|
|
@ -66,9 +66,6 @@ inline HDC GetDCFromSurface(gfxASurface *aSurface) {
|
|||
return NS_STATIC_CAST(gfxWindowsSurface*, aSurface)->GetDC();
|
||||
}
|
||||
|
||||
THEBES_IMPL_REFCOUNTING(WeightTable)
|
||||
THEBES_IMPL_REFCOUNTING(FontEntry)
|
||||
|
||||
/**********************************************************************
|
||||
*
|
||||
* class gfxWindowsFont
|
||||
|
|
Загрузка…
Ссылка в новой задаче