Bug 573829, part 2: Add TextureImage API for getting backing ASurface (if exists) and determining whether it's in an update. sr=vlad

This commit is contained in:
Chris Jones 2010-07-22 15:29:37 -05:00
parent f80d743342
commit 7d90dfc275
2 changed files with 20 additions and 0 deletions

View File

@ -187,8 +187,17 @@ public:
GLuint Texture() { return mTexture; }
/** Can be called safely at any time. */
/**
* If this TextureImage has a permanent gfxASurface backing,
* return it. Otherwise return NULL.
*/
virtual already_AddRefed<gfxASurface> GetBackingSurface()
{ return NULL; }
const nsIntSize& GetSize() const { return mSize; }
ContentType GetContentType() const { return mContentType; }
virtual PRBool InUpdate() const = 0;
protected:
/**
@ -226,6 +235,8 @@ public:
virtual gfxContext* BeginUpdate(nsIntRegion& aRegion);
virtual PRBool EndUpdate();
virtual PRBool InUpdate() const { return !!mUpdateContext; }
protected:
typedef gfxASurface::gfxImageFormat ImageFormat;

View File

@ -736,6 +736,15 @@ public:
return PR_FALSE; // texture not bound
}
virtual already_AddRefed<gfxASurface>
GetBackingSurface()
{
NS_ADDREF(mImpl->mThebesSurface);
return mImpl->mThebesSurface.get();
}
virtual PRBool InUpdate() const { return !!mUpdateContext; }
private:
GLContext* mGLContext;
nsRefPtr<GLContextEGL> mImpl;