Public Types | Public Member Functions | Protected Attributes

mozilla::gl::BasicTextureImage Class Reference

BasicTextureImage is the baseline TextureImage implementation --- it updates its texture by allocating a scratch buffer for the client to draw into, then using glTexSubImage2D() to upload the new pixels. More...

#include <GLContext.h>

Inheritance diagram for mozilla::gl::BasicTextureImage:
Collaboration diagram for mozilla::gl::BasicTextureImage:

List of all members.

Public Types

typedef gfxASurface::gfxImageFormat ImageFormat

Public Member Functions

virtual ~BasicTextureImage ()
 BasicTextureImage (GLuint aTexture, const nsIntSize &aSize, GLenum aWrapMode, ContentType aContentType, GLContext *aContext)
virtual gfxASurfaceBeginUpdate (nsIntRegion &aRegion)
 Returns a gfxASurface for updating |aRegion| of the client's image if successul, NULL if not.
virtual void EndUpdate ()
 Finish the active update and synchronize with the server, if necessary.
virtual bool DirectUpdate (gfxASurface *aSurf, const nsIntRegion &aRegion)
virtual already_AddRefed
< gfxASurface
GetSurfaceForUpdate (const gfxIntSize &aSize, ImageFormat aFmt)
virtual bool FinishedSurfaceUpdate ()
virtual void FinishedSurfaceUpload ()
virtual PRBool InUpdate () const
virtual void Resize (const nsIntSize &aSize)
 Set this TextureImage's size, and ensure a texture has been allocated.

Protected Attributes

PRBool mTextureInited
GLContextmGLContext
nsRefPtr< gfxASurfacemUpdateSurface
nsIntRegion mUpdateRegion
nsIntPoint mUpdateOffset

Detailed Description

BasicTextureImage is the baseline TextureImage implementation --- it updates its texture by allocating a scratch buffer for the client to draw into, then using glTexSubImage2D() to upload the new pixels.

Platforms must provide the code to create a new surface into which the updated pixels will be drawn, and the code to convert the update surface's pixels into an image on which we can glTexSubImage2D().


Member Typedef Documentation


Constructor & Destructor Documentation

virtual mozilla::gl::BasicTextureImage::~BasicTextureImage (  )  [virtual]
mozilla::gl::BasicTextureImage::BasicTextureImage ( GLuint  aTexture,
const nsIntSize aSize,
GLenum  aWrapMode,
ContentType  aContentType,
GLContext aContext 
) [inline]

Member Function Documentation

virtual gfxASurface* mozilla::gl::BasicTextureImage::BeginUpdate ( nsIntRegion aRegion  )  [virtual]

Returns a gfxASurface for updating |aRegion| of the client's image if successul, NULL if not.

|aRegion|'s bounds must fit within Size(); its coordinate space (if any) is ignored. If the update begins successfully, the returned gfxASurface is owned by this. Otherwise, NULL is returned.

|aRegion| is an inout param: the returned region is what the client must repaint. Category (1) regions above can efficiently handle repaints to "scattered" regions, while (2) can only efficiently handle repaints to rects.

Painting the returned surface outside of |aRegion| results in undefined behavior.

BeginUpdate() calls cannot be "nested", and each successful BeginUpdate() must be followed by exactly one EndUpdate() (see below). Failure to do so can leave this in a possibly inconsistent state. Unsuccessful BeginUpdate()s must not be followed by EndUpdate().

Implements mozilla::gl::TextureImage.

virtual bool mozilla::gl::BasicTextureImage::DirectUpdate ( gfxASurface aSurf,
const nsIntRegion aRegion 
) [virtual]
virtual void mozilla::gl::BasicTextureImage::EndUpdate (  )  [virtual]

Finish the active update and synchronize with the server, if necessary.

BeginUpdate() must have been called exactly once before EndUpdate().

Implements mozilla::gl::TextureImage.

virtual bool mozilla::gl::BasicTextureImage::FinishedSurfaceUpdate (  )  [virtual]
virtual void mozilla::gl::BasicTextureImage::FinishedSurfaceUpload (  )  [virtual]
virtual already_AddRefed<gfxASurface> mozilla::gl::BasicTextureImage::GetSurfaceForUpdate ( const gfxIntSize aSize,
ImageFormat  aFmt 
) [virtual]
virtual PRBool mozilla::gl::BasicTextureImage::InUpdate (  )  const [inline, virtual]
virtual void mozilla::gl::BasicTextureImage::Resize ( const nsIntSize aSize  )  [virtual]

Set this TextureImage's size, and ensure a texture has been allocated.

Must not be called between BeginUpdate and EndUpdate. After a resize, the contents are undefined.

If this isn't implemented by a subclass, it will just perform a dummy BeginUpdate/EndUpdate pair.

Reimplemented from mozilla::gl::TextureImage.


Member Data Documentation


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