2005-04-06 05:54:26 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2012-05-21 15:12:37 +04:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2005-04-06 05:54:26 +04:00
|
|
|
|
2005-04-11 08:36:18 +04:00
|
|
|
#ifndef GFX_ASURFACE_H
|
|
|
|
#define GFX_ASURFACE_H
|
2005-04-06 05:54:26 +04:00
|
|
|
|
2012-07-05 22:07:37 +04:00
|
|
|
#ifdef MOZ_DUMP_PAINTING
|
|
|
|
#define MOZ_DUMP_IMAGES
|
|
|
|
#endif
|
|
|
|
|
2005-06-28 13:18:55 +04:00
|
|
|
#include "gfxTypes.h"
|
2005-10-06 08:02:10 +04:00
|
|
|
#include "gfxRect.h"
|
2010-04-01 22:05:40 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2012-02-01 06:18:30 +04:00
|
|
|
#include "nsAutoRef.h"
|
|
|
|
#include "nsThreadUtils.h"
|
|
|
|
|
2007-01-27 04:26:49 +03:00
|
|
|
typedef struct _cairo_surface cairo_surface_t;
|
|
|
|
typedef struct _cairo_user_data_key cairo_user_data_key_t;
|
|
|
|
|
|
|
|
typedef void (*thebes_destroy_func_t) (void *data);
|
|
|
|
|
2009-06-26 00:30:56 +04:00
|
|
|
class gfxImageSurface;
|
2011-03-09 20:27:37 +03:00
|
|
|
struct nsIntPoint;
|
|
|
|
struct nsIntRect;
|
2009-06-26 00:30:56 +04:00
|
|
|
|
2005-08-20 09:36:47 +04:00
|
|
|
/**
|
|
|
|
* A surface is something you can draw on. Instantiate a subclass of this
|
|
|
|
* abstract class, and use gfxContext to draw on this surface.
|
|
|
|
*/
|
2006-04-27 18:41:11 +04:00
|
|
|
class THEBES_API gfxASurface {
|
2007-01-18 01:20:16 +03:00
|
|
|
public:
|
2012-01-06 18:44:25 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2007-01-27 04:26:49 +03:00
|
|
|
nsrefcnt AddRef(void);
|
|
|
|
nsrefcnt Release(void);
|
2005-06-28 13:18:55 +04:00
|
|
|
|
2012-01-06 18:44:25 +04:00
|
|
|
// These functions exist so that browsercomps can refcount a gfxASurface
|
|
|
|
virtual nsresult AddRefExternal(void)
|
|
|
|
{
|
|
|
|
return AddRef();
|
|
|
|
}
|
|
|
|
virtual nsresult ReleaseExternal(void)
|
|
|
|
{
|
|
|
|
return Release();
|
|
|
|
}
|
|
|
|
#else
|
|
|
|
virtual nsresult AddRef(void);
|
|
|
|
virtual nsresult Release(void);
|
|
|
|
#endif
|
|
|
|
|
2005-04-06 05:54:26 +04:00
|
|
|
public:
|
2005-08-20 09:36:47 +04:00
|
|
|
/**
|
|
|
|
* The format for an image surface. For all formats with alpha data, 0
|
|
|
|
* means transparent, 1 or 255 means fully opaque.
|
|
|
|
*/
|
|
|
|
typedef enum {
|
|
|
|
ImageFormatARGB32, ///< ARGB data in native endianness, using premultiplied alpha
|
|
|
|
ImageFormatRGB24, ///< xRGB data in native endianness
|
|
|
|
ImageFormatA8, ///< Only an alpha channel
|
2006-04-05 01:54:22 +04:00
|
|
|
ImageFormatA1, ///< Packed transparency information (one byte refers to 8 pixels)
|
2010-06-11 13:33:22 +04:00
|
|
|
ImageFormatRGB16_565, ///< RGB_565 data in native endianness
|
2006-04-05 01:54:22 +04:00
|
|
|
ImageFormatUnknown
|
2005-08-20 09:36:47 +04:00
|
|
|
} gfxImageFormat;
|
|
|
|
|
2006-04-05 01:54:22 +04:00
|
|
|
typedef enum {
|
|
|
|
SurfaceTypeImage,
|
|
|
|
SurfaceTypePDF,
|
|
|
|
SurfaceTypePS,
|
|
|
|
SurfaceTypeXlib,
|
|
|
|
SurfaceTypeXcb,
|
2011-12-19 02:54:50 +04:00
|
|
|
SurfaceTypeGlitz, // unused, but needed for cairo parity
|
2006-04-05 01:54:22 +04:00
|
|
|
SurfaceTypeQuartz,
|
|
|
|
SurfaceTypeWin32,
|
|
|
|
SurfaceTypeBeOS,
|
2011-12-19 02:54:50 +04:00
|
|
|
SurfaceTypeDirectFB, // unused, but needed for cairo parity
|
2006-04-05 01:54:22 +04:00
|
|
|
SurfaceTypeSVG,
|
2007-09-25 02:50:44 +04:00
|
|
|
SurfaceTypeOS2,
|
2008-02-06 09:48:47 +03:00
|
|
|
SurfaceTypeWin32Printing,
|
2008-04-19 17:34:30 +04:00
|
|
|
SurfaceTypeQuartzImage,
|
2010-01-16 20:04:52 +03:00
|
|
|
SurfaceTypeScript,
|
2009-04-23 04:48:30 +04:00
|
|
|
SurfaceTypeQPainter,
|
2010-09-08 07:27:34 +04:00
|
|
|
SurfaceTypeRecording,
|
|
|
|
SurfaceTypeVG,
|
|
|
|
SurfaceTypeGL,
|
|
|
|
SurfaceTypeDRM,
|
|
|
|
SurfaceTypeTee,
|
|
|
|
SurfaceTypeXML,
|
|
|
|
SurfaceTypeSkia,
|
2011-03-10 22:52:15 +03:00
|
|
|
SurfaceTypeSubsurface,
|
2010-09-08 07:27:34 +04:00
|
|
|
SurfaceTypeD2D,
|
2010-05-22 08:10:14 +04:00
|
|
|
SurfaceTypeMax
|
2006-04-05 01:54:22 +04:00
|
|
|
} gfxSurfaceType;
|
|
|
|
|
2006-08-10 00:25:07 +04:00
|
|
|
typedef enum {
|
2007-01-27 04:26:49 +03:00
|
|
|
CONTENT_COLOR = 0x1000,
|
|
|
|
CONTENT_ALPHA = 0x2000,
|
2012-07-12 16:51:57 +04:00
|
|
|
CONTENT_COLOR_ALPHA = 0x3000,
|
|
|
|
CONTENT_SENTINEL = 0xffff
|
2006-08-10 00:25:07 +04:00
|
|
|
} gfxContentType;
|
|
|
|
|
2010-06-18 13:21:15 +04:00
|
|
|
/** Wrap the given cairo surface and return a gfxASurface for it.
|
|
|
|
* This adds a reference to csurf (owned by the returned gfxASurface).
|
|
|
|
*/
|
2006-04-05 01:54:22 +04:00
|
|
|
static already_AddRefed<gfxASurface> Wrap(cairo_surface_t *csurf);
|
|
|
|
|
2005-06-28 13:18:55 +04:00
|
|
|
/*** this DOES NOT addref the surface */
|
2007-05-10 23:58:09 +04:00
|
|
|
cairo_surface_t *CairoSurface() {
|
|
|
|
NS_ASSERTION(mSurface != nsnull, "gfxASurface::CairoSurface called with mSurface == nsnull!");
|
|
|
|
return mSurface;
|
|
|
|
}
|
2006-04-05 01:54:22 +04:00
|
|
|
|
2007-01-27 04:26:49 +03:00
|
|
|
gfxSurfaceType GetType() const;
|
2005-04-06 05:54:26 +04:00
|
|
|
|
2007-01-27 04:26:49 +03:00
|
|
|
gfxContentType GetContentType() const;
|
2006-08-10 00:25:07 +04:00
|
|
|
|
2007-02-08 23:47:48 +03:00
|
|
|
void SetDeviceOffset(const gfxPoint& offset);
|
2007-01-27 04:26:49 +03:00
|
|
|
gfxPoint GetDeviceOffset() const;
|
2005-11-29 23:12:29 +03:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool GetRotateForLandscape() { return false; }
|
2011-07-14 21:02:20 +04:00
|
|
|
|
2010-08-09 06:19:17 +04:00
|
|
|
void Flush() const;
|
2007-01-27 04:26:49 +03:00
|
|
|
void MarkDirty();
|
|
|
|
void MarkDirty(const gfxRect& r);
|
|
|
|
|
2006-02-01 08:21:59 +03:00
|
|
|
/* Printing backend functions */
|
2007-09-26 00:46:08 +04:00
|
|
|
virtual nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
|
|
|
|
virtual nsresult EndPrinting();
|
|
|
|
virtual nsresult AbortPrinting();
|
|
|
|
virtual nsresult BeginPage();
|
|
|
|
virtual nsresult EndPage();
|
2006-02-01 08:21:59 +03:00
|
|
|
|
2006-02-22 04:44:31 +03:00
|
|
|
void SetData(const cairo_user_data_key_t *key,
|
|
|
|
void *user_data,
|
2007-01-27 04:26:49 +03:00
|
|
|
thebes_destroy_func_t destroy);
|
|
|
|
void *GetData(const cairo_user_data_key_t *key);
|
2006-02-22 04:44:31 +03:00
|
|
|
|
2007-03-01 03:02:27 +03:00
|
|
|
virtual void Finish();
|
2007-01-27 04:46:14 +03:00
|
|
|
|
2010-06-01 03:37:44 +04:00
|
|
|
/**
|
|
|
|
* Create an offscreen surface that can be efficiently copied into
|
|
|
|
* this surface (at least if tiling is not involved).
|
|
|
|
* Returns null on error.
|
|
|
|
*/
|
|
|
|
virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
|
|
|
|
const gfxIntSize& aSize);
|
2010-11-11 23:31:22 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns an image surface for this surface, or nsnull if not supported.
|
|
|
|
* This will not copy image data, just wraps an image surface around
|
|
|
|
* pixel data already available in memory.
|
|
|
|
*/
|
|
|
|
virtual already_AddRefed<gfxImageSurface> GetAsImageSurface()
|
|
|
|
{
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
2007-05-11 00:50:16 +04:00
|
|
|
int CairoStatus();
|
2007-05-10 23:58:09 +04:00
|
|
|
|
|
|
|
/* Make sure that the given dimensions don't overflow a 32-bit signed int
|
|
|
|
* using 4 bytes per pixel; optionally, make sure that either dimension
|
|
|
|
* doesn't exceed the given limit.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
static bool CheckSurfaceSize(const gfxIntSize& sz, PRInt32 limit = 0);
|
2007-05-10 23:58:09 +04:00
|
|
|
|
2011-03-16 01:01:00 +03:00
|
|
|
/* Provide a stride value that will respect all alignment requirements of
|
|
|
|
* the accelerated image-rendering code.
|
|
|
|
*/
|
|
|
|
static PRInt32 FormatStrideForWidth(gfxImageFormat format, PRInt32 width);
|
|
|
|
|
2007-11-29 23:06:56 +03:00
|
|
|
/* Return the default set of context flags for this surface; these are
|
|
|
|
* hints to the context about any special rendering considerations. See
|
|
|
|
* gfxContext::SetFlag for documentation.
|
|
|
|
*/
|
2008-01-07 03:50:18 +03:00
|
|
|
virtual PRInt32 GetDefaultContextFlags() const { return 0; }
|
2007-11-29 23:06:56 +03:00
|
|
|
|
2008-04-29 05:15:30 +04:00
|
|
|
static gfxContentType ContentFromFormat(gfxImageFormat format);
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetSubpixelAntialiasingEnabled(bool aEnabled);
|
|
|
|
bool GetSubpixelAntialiasingEnabled();
|
2011-01-03 04:48:08 +03:00
|
|
|
|
2010-05-22 08:10:14 +04:00
|
|
|
/**
|
|
|
|
* Record number of bytes for given surface type. Use positive bytes
|
|
|
|
* for allocations and negative bytes for deallocations.
|
|
|
|
*/
|
|
|
|
static void RecordMemoryUsedForSurfaceType(gfxASurface::gfxSurfaceType aType,
|
|
|
|
PRInt32 aBytes);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Same as above, but use current surface type as returned by GetType().
|
|
|
|
* The bytes will be accumulated until RecordMemoryFreed is called,
|
|
|
|
* in which case the value that was recorded for this surface will
|
|
|
|
* be freed.
|
|
|
|
*/
|
|
|
|
void RecordMemoryUsed(PRInt32 aBytes);
|
|
|
|
void RecordMemoryFreed();
|
|
|
|
|
2011-07-18 17:20:27 +04:00
|
|
|
virtual PRInt32 KnownMemoryUsed() { return mBytesRecorded; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The memory used by this surface (as reported by KnownMemoryUsed()) can
|
|
|
|
* either live in this process's heap, in this process but outside the
|
|
|
|
* heap, or in another process altogether.
|
|
|
|
*/
|
|
|
|
enum MemoryLocation {
|
|
|
|
MEMORY_IN_PROCESS_HEAP,
|
|
|
|
MEMORY_IN_PROCESS_NONHEAP,
|
|
|
|
MEMORY_OUT_OF_PROCESS
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Where does this surface's memory live? By default, we say it's in this
|
|
|
|
* process's heap.
|
|
|
|
*/
|
|
|
|
virtual MemoryLocation GetMemoryLocation() const;
|
2010-05-22 08:10:14 +04:00
|
|
|
|
2010-06-11 13:33:22 +04:00
|
|
|
static PRInt32 BytePerPixelFromFormat(gfxImageFormat format);
|
|
|
|
|
2010-09-08 04:36:57 +04:00
|
|
|
virtual const gfxIntSize GetSize() const { return gfxIntSize(-1, -1); }
|
|
|
|
|
2012-07-05 22:07:37 +04:00
|
|
|
#ifdef MOZ_DUMP_IMAGES
|
2011-10-26 07:19:13 +04:00
|
|
|
/**
|
|
|
|
* Debug functions to encode the current image as a PNG and export it.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Writes a binary PNG file.
|
|
|
|
*/
|
|
|
|
void WriteAsPNG(const char* aFile);
|
|
|
|
|
2012-03-01 12:26:09 +04:00
|
|
|
/**
|
|
|
|
* Write as a PNG encoded Data URL to a file.
|
|
|
|
*/
|
|
|
|
void DumpAsDataURL(FILE* aOutput = stdout);
|
|
|
|
|
2011-10-26 07:19:13 +04:00
|
|
|
/**
|
|
|
|
* Write as a PNG encoded Data URL to stdout.
|
|
|
|
*/
|
2012-03-01 12:26:09 +04:00
|
|
|
void PrintAsDataURL();
|
2011-03-25 01:04:46 +03:00
|
|
|
|
2011-10-26 07:19:13 +04:00
|
|
|
/**
|
|
|
|
* Copy a PNG encoded Data URL to the clipboard.
|
|
|
|
*/
|
|
|
|
void CopyAsDataURL();
|
|
|
|
|
|
|
|
void WriteAsPNG_internal(FILE* aFile, bool aBinary);
|
|
|
|
#endif
|
|
|
|
|
2011-01-03 04:48:08 +03:00
|
|
|
void SetOpaqueRect(const gfxRect& aRect) {
|
|
|
|
if (aRect.IsEmpty()) {
|
|
|
|
mOpaqueRect = nsnull;
|
|
|
|
} else if (mOpaqueRect) {
|
|
|
|
*mOpaqueRect = aRect;
|
|
|
|
} else {
|
|
|
|
mOpaqueRect = new gfxRect(aRect);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
const gfxRect& GetOpaqueRect() {
|
|
|
|
if (mOpaqueRect)
|
|
|
|
return *mOpaqueRect;
|
|
|
|
static const gfxRect empty(0, 0, 0, 0);
|
|
|
|
return empty;
|
|
|
|
}
|
|
|
|
|
2011-03-09 20:27:37 +03:00
|
|
|
/**
|
|
|
|
* Move the pixels in |aSourceRect| to |aDestTopLeft|. Like with
|
|
|
|
* memmove(), |aSourceRect| and the rectangle defined by
|
|
|
|
* |aDestTopLeft| are allowed to overlap, and the effect is
|
|
|
|
* equivalent to copying |aSourceRect| to a scratch surface and
|
|
|
|
* then back to |aDestTopLeft|.
|
|
|
|
*
|
|
|
|
* |aSourceRect| and the destination rectangle defined by
|
|
|
|
* |aDestTopLeft| are clipped to this surface's bounds.
|
|
|
|
*/
|
|
|
|
virtual void MovePixels(const nsIntRect& aSourceRect,
|
|
|
|
const nsIntPoint& aDestTopLeft);
|
|
|
|
|
2011-01-03 04:48:09 +03:00
|
|
|
/**
|
|
|
|
* Mark the surface as being allowed/not allowed to be used as a source.
|
|
|
|
*/
|
2011-09-29 10:19:26 +04:00
|
|
|
void SetAllowUseAsSource(bool aAllow) { mAllowUseAsSource = aAllow; }
|
|
|
|
bool GetAllowUseAsSource() { return mAllowUseAsSource; }
|
2011-01-03 04:48:09 +03:00
|
|
|
|
2005-04-06 05:54:26 +04:00
|
|
|
protected:
|
2011-01-03 04:48:09 +03:00
|
|
|
gfxASurface() : mSurface(nsnull), mFloatingRefs(0), mBytesRecorded(0),
|
2011-10-17 18:59:28 +04:00
|
|
|
mSurfaceValid(false), mAllowUseAsSource(true)
|
2010-06-18 13:21:15 +04:00
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(gfxASurface);
|
|
|
|
}
|
2007-05-10 23:58:09 +04:00
|
|
|
|
2006-04-05 01:54:22 +04:00
|
|
|
static gfxASurface* GetSurfaceWrapper(cairo_surface_t *csurf);
|
|
|
|
static void SetSurfaceWrapper(cairo_surface_t *csurf, gfxASurface *asurf);
|
2005-04-06 05:54:26 +04:00
|
|
|
|
2011-05-08 05:19:11 +04:00
|
|
|
/**
|
|
|
|
* An implementation of MovePixels that assumes the backend can
|
|
|
|
* internally handle this operation and doesn't allocate any
|
|
|
|
* temporary surfaces.
|
|
|
|
*/
|
|
|
|
void FastMovePixels(const nsIntRect& aSourceRect,
|
|
|
|
const nsIntPoint& aDestTopLeft);
|
|
|
|
|
2011-01-04 19:40:54 +03:00
|
|
|
// NB: Init() *must* be called from within subclass's
|
|
|
|
// constructors. It's unsafe to call it after the ctor finishes;
|
|
|
|
// leaks and use-after-frees are possible.
|
2011-09-29 10:19:26 +04:00
|
|
|
void Init(cairo_surface_t *surface, bool existingSurface = false);
|
2005-06-30 08:58:27 +04:00
|
|
|
|
2010-06-18 13:21:15 +04:00
|
|
|
virtual ~gfxASurface()
|
|
|
|
{
|
2010-05-22 08:10:14 +04:00
|
|
|
RecordMemoryFreed();
|
2010-06-18 13:21:15 +04:00
|
|
|
|
|
|
|
MOZ_COUNT_DTOR(gfxASurface);
|
2005-04-06 05:54:26 +04:00
|
|
|
}
|
2010-05-22 08:10:14 +04:00
|
|
|
|
2010-06-01 03:37:44 +04:00
|
|
|
cairo_surface_t *mSurface;
|
2011-01-03 04:48:08 +03:00
|
|
|
nsAutoPtr<gfxRect> mOpaqueRect;
|
2010-06-01 03:37:44 +04:00
|
|
|
|
2005-07-02 05:36:23 +04:00
|
|
|
private:
|
2007-05-10 23:58:09 +04:00
|
|
|
static void SurfaceDestroyFunc(void *data);
|
|
|
|
|
|
|
|
PRInt32 mFloatingRefs;
|
2010-05-22 08:10:14 +04:00
|
|
|
PRInt32 mBytesRecorded;
|
2007-01-18 01:20:16 +03:00
|
|
|
|
2007-05-10 23:58:09 +04:00
|
|
|
protected:
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mSurfaceValid;
|
|
|
|
bool mAllowUseAsSource;
|
2005-04-06 05:54:26 +04:00
|
|
|
};
|
|
|
|
|
2006-02-09 04:24:30 +03:00
|
|
|
/**
|
|
|
|
* An Unknown surface; used to wrap unknown cairo_surface_t returns from cairo
|
|
|
|
*/
|
2006-04-27 18:41:11 +04:00
|
|
|
class THEBES_API gfxUnknownSurface : public gfxASurface {
|
2006-02-09 04:24:30 +03:00
|
|
|
public:
|
|
|
|
gfxUnknownSurface(cairo_surface_t *surf) {
|
2011-10-17 18:59:28 +04:00
|
|
|
Init(surf, true);
|
2006-02-09 04:24:30 +03:00
|
|
|
}
|
|
|
|
|
2007-01-18 01:20:16 +03:00
|
|
|
virtual ~gfxUnknownSurface() { }
|
2006-02-09 04:24:30 +03:00
|
|
|
};
|
|
|
|
|
2012-02-01 06:18:30 +04:00
|
|
|
#ifndef XPCOM_GLUE_AVOID_NSPR
|
|
|
|
/**
|
|
|
|
* We need to be able to hold a reference to a gfxASurface from Image
|
|
|
|
* subclasses. This is potentially a problem since Images can be addrefed
|
|
|
|
* or released off the main thread. We can ensure that we never AddRef
|
|
|
|
* a gfxASurface off the main thread, but we might want to Release due
|
|
|
|
* to an Image being destroyed off the main thread.
|
|
|
|
*
|
|
|
|
* We use nsCountedRef<nsMainThreadSurfaceRef> to reference the
|
|
|
|
* gfxASurface. When AddRefing, we assert that we're on the main thread.
|
|
|
|
* When Releasing, if we're not on the main thread, we post an event to
|
|
|
|
* the main thread to do the actual release.
|
|
|
|
*/
|
|
|
|
class nsMainThreadSurfaceRef;
|
|
|
|
|
|
|
|
template <>
|
|
|
|
class nsAutoRefTraits<nsMainThreadSurfaceRef> {
|
|
|
|
public:
|
|
|
|
typedef gfxASurface* RawRef;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The XPCOM event that will do the actual release on the main thread.
|
|
|
|
*/
|
|
|
|
class SurfaceReleaser : public nsRunnable {
|
|
|
|
public:
|
|
|
|
SurfaceReleaser(RawRef aRef) : mRef(aRef) {}
|
|
|
|
NS_IMETHOD Run() {
|
|
|
|
mRef->Release();
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
RawRef mRef;
|
|
|
|
};
|
|
|
|
|
|
|
|
static RawRef Void() { return nsnull; }
|
|
|
|
static void Release(RawRef aRawRef)
|
|
|
|
{
|
|
|
|
if (NS_IsMainThread()) {
|
|
|
|
aRawRef->Release();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIRunnable> runnable = new SurfaceReleaser(aRawRef);
|
|
|
|
NS_DispatchToMainThread(runnable);
|
|
|
|
}
|
|
|
|
static void AddRef(RawRef aRawRef)
|
|
|
|
{
|
|
|
|
NS_ASSERTION(NS_IsMainThread(),
|
|
|
|
"Can only add a reference on the main thread");
|
|
|
|
aRawRef->AddRef();
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
2005-04-11 08:36:18 +04:00
|
|
|
#endif /* GFX_ASURFACE_H */
|