1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 #ifndef TEXTUREIMAGEEGL_H_
7 #define TEXTUREIMAGEEGL_H_
9 #include "GLTextureImage.h"
18 TextureImageEGL(GLuint aTexture
,
19 const nsIntSize
& aSize
,
21 ContentType aContentType
,
23 Flags aFlags
= TextureImage::NoFlags
,
24 TextureState aTextureState
= Created
,
25 TextureImage::ImageFormat aImageFormat
= gfxImageFormatUnknown
);
27 virtual ~TextureImageEGL();
29 virtual void GetUpdateRegion(nsIntRegion
& aForRegion
);
31 virtual gfxASurface
* BeginUpdate(nsIntRegion
& aRegion
);
33 virtual void EndUpdate();
35 virtual bool DirectUpdate(gfxASurface
* aSurf
, const nsIntRegion
& aRegion
, const nsIntPoint
& aFrom
/* = nsIntPoint(0, 0) */);
37 virtual void BindTexture(GLenum aTextureUnit
);
39 virtual GLuint
GetTextureID()
41 // Ensure the texture is allocated before it is used.
42 if (mTextureState
== Created
) {
48 virtual bool InUpdate() const { return !!mUpdateSurface
; }
50 virtual void Resize(const nsIntSize
& aSize
);
54 bool ReleaseTexImage();
56 virtual bool CreateEGLSurface(gfxASurface
* aSurface
)
61 virtual void DestroyEGLSurface(void);
64 typedef gfxImageFormat ImageFormat
;
66 GLContext
* mGLContext
;
68 nsIntRect mUpdateRect
;
69 ImageFormat mUpdateFormat
;
70 nsRefPtr
<gfxASurface
> mUpdateSurface
;
75 TextureState mTextureState
;
79 virtual void ApplyFilter();
86 #endif // TEXTUREIMAGEEGL_H_