Bug 892934 - Pass RGB image format into CreateTextureImage r=mattwoodrow

This commit is contained in:
Edwin Flores 2013-08-08 10:38:21 +12:00
parent ae9e174ecd
commit c80309e9c2
15 changed files with 213 additions and 47 deletions

View File

@ -977,9 +977,11 @@ already_AddRefed<TextureImage>
GLContext::CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags)
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
{
return CreateBasicTextureImage(this, aSize, aContentType, aWrapMode, aFlags);
return CreateBasicTextureImage(this, aSize, aContentType, aWrapMode,
aFlags, aImageFormat);
}
void GLContext::ApplyFilterToBoundTexture(gfxPattern::GraphicsFilter aFilter)

View File

@ -2642,8 +2642,10 @@ public:
/**
* Return a valid, allocated TextureImage of |aSize| with
* |aContentType|. The TextureImage's texture is configured to
* use |aWrapMode| (usually GL_CLAMP_TO_EDGE or GL_REPEAT) and by
* |aContentType|. If |aContentType| is COLOR, |aImageFormat| can be used
* to hint at the preferred RGB format, however it is not necessarily
* respected. The TextureImage's texture is configured to use
* |aWrapMode| (usually GL_CLAMP_TO_EDGE or GL_REPEAT) and by
* default, GL_LINEAR filtering. Specify
* |aFlags=UseNearestFilter| for GL_NEAREST filtering. Specify
* |aFlags=NeedsYFlip| if the image is flipped. Return
@ -2658,7 +2660,8 @@ public:
CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags = TextureImage::NoFlags);
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown);
/**
* In EGL we want to use Tiled Texture Images, which we return
@ -2670,7 +2673,8 @@ public:
virtual already_AddRefed<TextureImage>
TileGenFunc(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
TextureImage::Flags aFlags = TextureImage::NoFlags)
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown)
{
return nullptr;
}

View File

@ -184,12 +184,14 @@ public:
CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags = TextureImage::NoFlags) MOZ_OVERRIDE;
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) MOZ_OVERRIDE;
virtual already_AddRefed<TextureImage>
TileGenFunc(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
TextureImage::Flags aFlags = TextureImage::NoFlags) MOZ_OVERRIDE;
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) MOZ_OVERRIDE;
virtual SharedTextureHandle CreateSharedHandle(SharedTextureShareType shareType,
void* buffer,
@ -231,7 +233,8 @@ public:
CreateTextureImageInternal(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags);
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat);
};
@ -247,7 +250,8 @@ class TextureImageCGL : public BasicTextureImage
GLContextCGL::CreateTextureImageInternal(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags);
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat);
public:
~TextureImageCGL()
{
@ -334,8 +338,10 @@ private:
GLenum aWrapMode,
ContentType aContentType,
GLContext* aContext,
TextureImage::Flags aFlags = TextureImage::NoFlags)
: BasicTextureImage(aTexture, aSize, aWrapMode, aContentType, aContext, aFlags)
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown)
: BasicTextureImage(aTexture, aSize, aWrapMode, aContentType,
aContext, aFlags, aImageFormat)
, mPixelBuffer(0)
, mPixelBufferSize(0)
, mBoundPixelBuffer(false)
@ -350,7 +356,8 @@ already_AddRefed<TextureImage>
GLContextCGL::CreateTextureImageInternal(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags)
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
{
bool useNearestFilter = aFlags & TextureImage::UseNearestFilter;
MakeCurrent();
@ -368,7 +375,8 @@ GLContextCGL::CreateTextureImageInternal(const nsIntSize& aSize,
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, aWrapMode);
nsRefPtr<TextureImageCGL> teximage
(new TextureImageCGL(texture, aSize, aWrapMode, aContentType, this, aFlags));
(new TextureImageCGL(texture, aSize, aWrapMode, aContentType,
this, aFlags, aImageFormat));
return teximage.forget();
}
@ -376,25 +384,30 @@ already_AddRefed<TextureImage>
GLContextCGL::CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags)
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
{
if (!IsOffscreenSizeAllowed(gfxIntSize(aSize.width, aSize.height)) &&
gfxPlatform::OffMainThreadCompositingEnabled()) {
NS_ASSERTION(aWrapMode == LOCAL_GL_CLAMP_TO_EDGE, "Can't support wrapping with tiles!");
nsRefPtr<TextureImage> t = new gl::TiledTextureImage(this, aSize, aContentType, aFlags);
nsRefPtr<TextureImage> t = new gl::TiledTextureImage(this, aSize, aContentType,
aFlags, aImageFormat);
return t.forget();
}
return CreateBasicTextureImage(this, aSize, aContentType, aWrapMode, aFlags);
return CreateBasicTextureImage(this, aSize, aContentType, aWrapMode,
aFlags, aImageFormat);
}
already_AddRefed<TextureImage>
GLContextCGL::TileGenFunc(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
TextureImage::Flags aFlags)
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
{
return CreateTextureImageInternal(aSize, aContentType,
LOCAL_GL_CLAMP_TO_EDGE, aFlags);
LOCAL_GL_CLAMP_TO_EDGE, aFlags,
aImageFormat);
}
static GLContextCGL *

View File

@ -609,13 +609,15 @@ public:
CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags = TextureImage::NoFlags);
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown);
// a function to generate Tiles for Tiled Texture Image
virtual already_AddRefed<TextureImage>
TileGenFunc(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
TextureImage::Flags aFlags = TextureImage::NoFlags) MOZ_OVERRIDE;
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown) MOZ_OVERRIDE;
// hold a reference to the given surface
// for the lifetime of this context.
void HoldSurface(gfxASurface *aSurf) {
@ -1103,10 +1105,11 @@ public:
ContentType aContentType,
GLContext* aContext,
Flags aFlags = TextureImage::NoFlags,
TextureState aTextureState = Created)
TextureState aTextureState = Created,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown)
: TextureImage(aSize, aWrapMode, aContentType, aFlags)
, mGLContext(aContext)
, mUpdateFormat(gfxASurface::ImageFormatUnknown)
, mUpdateFormat(aImageFormat)
, mEGLImage(nullptr)
, mTexture(aTexture)
, mSurface(nullptr)
@ -1114,7 +1117,9 @@ public:
, mTextureState(aTextureState)
, mBound(false)
{
mUpdateFormat = gfxPlatform::GetPlatform()->OptimalFormatForContent(GetContentType());
if (mUpdateFormat == gfxASurface::ImageFormatUnknown) {
mUpdateFormat = gfxPlatform::GetPlatform()->OptimalFormatForContent(GetContentType());
}
if (gUseBackingSurface) {
if (mUpdateFormat != gfxASurface::ImageFormatARGB32) {
@ -1529,16 +1534,18 @@ already_AddRefed<TextureImage>
GLContextEGL::CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags)
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
{
nsRefPtr<TextureImage> t = new gl::TiledTextureImage(this, aSize, aContentType, aFlags);
nsRefPtr<TextureImage> t = new gl::TiledTextureImage(this, aSize, aContentType, aFlags, aImageFormat);
return t.forget();
}
already_AddRefed<TextureImage>
GLContextEGL::TileGenFunc(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
TextureImage::Flags aFlags)
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
{
MakeCurrent();
@ -1546,7 +1553,8 @@ GLContextEGL::TileGenFunc(const nsIntSize& aSize,
fGenTextures(1, &texture);
nsRefPtr<TextureImageEGL> teximage =
new TextureImageEGL(texture, aSize, LOCAL_GL_CLAMP_TO_EDGE, aContentType, this, aFlags);
new TextureImageEGL(texture, aSize, LOCAL_GL_CLAMP_TO_EDGE, aContentType,
this, aFlags, TextureImage::Created, aImageFormat);
teximage->BindTexture(LOCAL_GL_TEXTURE0);

View File

@ -940,7 +940,8 @@ TRY_AGAIN_NO_SHARING:
CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags = TextureImage::NoFlags);
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown);
private:
friend class GLContextProviderGLX;
@ -988,7 +989,8 @@ class TextureImageGLX : public TextureImage
GLContextGLX::CreateTextureImage(const nsIntSize&,
ContentType,
GLenum,
TextureImage::Flags);
TextureImage::Flags,
TextureImage::ImageFormat);
public:
virtual ~TextureImageGLX()
@ -1087,13 +1089,15 @@ already_AddRefed<TextureImage>
GLContextGLX::CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags)
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
{
if (!TextureImageSupportsGetBackingSurface()) {
return GLContext::CreateTextureImage(aSize,
aContentType,
aWrapMode,
aFlags);
aFlags,
aImageFormat);
}
Display *display = DefaultXDisplay();
@ -1127,7 +1131,8 @@ GLContextGLX::CreateTextureImage(const nsIntSize& aSize,
return GLContext::CreateTextureImage(aSize,
aContentType,
aWrapMode,
aFlags);
aFlags,
aImageFormat);
}
NS_ASSERTION(pixmap, "Failed to create pixmap!");

View File

@ -211,7 +211,8 @@ BasicTextureImage::Resize(const nsIntSize& aSize)
TiledTextureImage::TiledTextureImage(GLContext* aGL,
nsIntSize aSize,
TextureImage::ContentType aContentType,
TextureImage::Flags aFlags)
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
: TextureImage(aSize, LOCAL_GL_CLAMP_TO_EDGE, aContentType, aFlags)
, mCurrentImage(0)
, mIterationCallback(nullptr)
@ -220,6 +221,7 @@ TiledTextureImage::TiledTextureImage(GLContext* aGL,
, mColumns(0)
, mGL(aGL)
, mTextureState(Created)
, mImageFormat(aImageFormat)
{
if (!(aFlags & TextureImage::DisallowBigImage) && mGL->WantsSmallTiles()) {
mTileSize = 256;
@ -562,7 +564,7 @@ void TiledTextureImage::Resize(const nsIntSize& aSize)
// Create a new tile.
nsRefPtr<TextureImage> teximg =
mGL->TileGenFunc(size, mContentType, mFlags);
mGL->TileGenFunc(size, mContentType, mFlags, mImageFormat);
if (replace)
mImages.ReplaceElementAt(i, teximg.forget());
else
@ -611,7 +613,8 @@ CreateBasicTextureImage(GLContext* aGL,
const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags)
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
{
bool useNearestFilter = aFlags & TextureImage::UseNearestFilter;
aGL->MakeCurrent();
@ -628,7 +631,8 @@ CreateBasicTextureImage(GLContext* aGL,
aGL->fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, aWrapMode);
nsRefPtr<BasicTextureImage> texImage =
new BasicTextureImage(texture, aSize, aWrapMode, aContentType, aGL, aFlags);
new BasicTextureImage(texture, aSize, aWrapMode, aContentType,
aGL, aFlags, aImageFormat);
return texImage.forget();
}

View File

@ -43,8 +43,6 @@ class GLContext;
class TextureImage
{
NS_INLINE_DECL_REFCOUNTING(TextureImage)
protected:
typedef gfxASurface::gfxImageFormat ImageFormat;
public:
enum TextureState
{
@ -61,6 +59,7 @@ public:
};
typedef gfxASurface::gfxContentType ContentType;
typedef gfxASurface::gfxImageFormat ImageFormat;
static already_AddRefed<TextureImage> Create(
GLContext* gl,
@ -232,6 +231,7 @@ public:
const nsIntSize& GetSize() const { return mSize; }
ContentType GetContentType() const { return mContentType; }
ImageFormat GetImageFormat() const { return mImageFormat; }
virtual bool InUpdate() const = 0;
GLenum GetWrapMode() const { return mWrapMode; }
@ -254,10 +254,12 @@ protected:
*/
TextureImage(const nsIntSize& aSize,
GLenum aWrapMode, ContentType aContentType,
Flags aFlags = NoFlags)
Flags aFlags = NoFlags,
ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown)
: mSize(aSize)
, mWrapMode(aWrapMode)
, mContentType(aContentType)
, mImageFormat(aImageFormat)
, mFilter(gfxPattern::FILTER_GOOD)
, mFlags(aFlags)
{}
@ -269,6 +271,7 @@ protected:
nsIntSize mSize;
GLenum mWrapMode;
ContentType mContentType;
ImageFormat mImageFormat;
gfx::SurfaceFormat mTextureFormat;
gfxPattern::GraphicsFilter mFilter;
Flags mFlags;
@ -294,8 +297,9 @@ public:
GLenum aWrapMode,
ContentType aContentType,
GLContext* aContext,
TextureImage::Flags aFlags = TextureImage::NoFlags)
: TextureImage(aSize, aWrapMode, aContentType, aFlags)
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown)
: TextureImage(aSize, aWrapMode, aContentType, aFlags, aImageFormat)
, mTexture(aTexture)
, mTextureState(Created)
, mGLContext(aContext)
@ -349,8 +353,11 @@ class TiledTextureImage
: public TextureImage
{
public:
TiledTextureImage(GLContext* aGL, nsIntSize aSize,
TextureImage::ContentType, TextureImage::Flags aFlags = TextureImage::NoFlags);
TiledTextureImage(GLContext* aGL,
nsIntSize aSize,
TextureImage::ContentType,
TextureImage::Flags aFlags = TextureImage::NoFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown);
~TiledTextureImage();
void DumpDiv();
virtual gfxASurface* BeginUpdate(nsIntRegion& aRegion);
@ -388,6 +395,7 @@ protected:
// The region of update requested
nsIntRegion mUpdateRegion;
TextureState mTextureState;
TextureImage::ImageFormat mImageFormat;
};
/**
@ -400,7 +408,8 @@ CreateBasicTextureImage(GLContext* aGL,
const nsIntSize& aSize,
TextureImage::ContentType aContentType,
GLenum aWrapMode,
TextureImage::Flags aFlags);
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat = gfxASurface::ImageFormatUnknown);
} // namespace gl
} // namespace mozilla

View File

@ -27,6 +27,7 @@ class MOZ_STACK_CLASS AutoOpenSurface
{
public:
typedef gfxASurface::gfxContentType gfxContentType;
typedef gfxASurface::gfxImageFormat gfxImageFormat;
/** |aDescriptor| must be valid while AutoOpenSurface is
* in scope. */
@ -39,6 +40,7 @@ public:
* return an answer.
*/
gfxContentType ContentType();
gfxImageFormat ImageFormat();
gfxIntSize Size();
/** This can't escape the scope of AutoOpenSurface. */

View File

@ -61,6 +61,16 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
return false;
}
/*static*/ bool
ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
const SurfaceDescriptor&,
OpenMode,
gfxImageFormat*,
gfxASurface**)
{
return false;
}
bool
ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor*)
{

View File

@ -504,6 +504,23 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
return true;
}
/*static*/ bool
ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
const SurfaceDescriptor& aDescriptor,
OpenMode aMode,
gfxImageFormat* aImageFormat,
gfxASurface** aSurface)
{
if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aDescriptor.type()) {
return false;
}
sp<GraphicBuffer> buffer =
GrallocBufferActor::GetFrom(aDescriptor.get_SurfaceDescriptorGralloc());
*aImageFormat = ImageFormatForPixelFormat(buffer->getPixelFormat());
return true;
}
/*static*/ bool
ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
{

View File

@ -74,6 +74,16 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
return false;
}
/*static*/ bool
ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
const SurfaceDescriptor&,
OpenMode,
gfxImageFormat*,
gfxASurface**)
{
return false;
}
bool
ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
{

View File

@ -165,6 +165,16 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
return false;
}
/*static*/ bool
ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
const SurfaceDescriptor&,
OpenMode,
gfxImageFormat*,
gfxASurface**)
{
return false;
}
bool
ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor* aSurface)
{

View File

@ -636,6 +636,30 @@ ShadowLayerForwarder::GetDescriptorSurfaceSize(
return size;
}
/*static*/ gfxImageFormat
ShadowLayerForwarder::GetDescriptorSurfaceImageFormat(
const SurfaceDescriptor& aDescriptor, OpenMode aMode,
gfxASurface** aSurface)
{
gfxImageFormat format;
if (PlatformGetDescriptorSurfaceImageFormat(aDescriptor, aMode, &format, aSurface)) {
return format;
}
nsRefPtr<gfxASurface> surface = OpenDescriptor(aMode, aDescriptor);
NS_ENSURE_TRUE(surface, gfxASurface::ImageFormatUnknown);
nsRefPtr<gfxImageSurface> img = surface->GetAsImageSurface();
NS_ENSURE_TRUE(img, gfxASurface::ImageFormatUnknown);
format = img->Format();
NS_ASSERTION(format != gfxASurface::ImageFormatUnknown,
"ImageSurface RGB format should be known");
*aSurface = surface.forget().get();
return format;
}
/*static*/ void
ShadowLayerForwarder::CloseDescriptor(const SurfaceDescriptor& aDescriptor)
{
@ -685,6 +709,16 @@ ShadowLayerForwarder::PlatformGetDescriptorSurfaceSize(
return false;
}
/*static*/ bool
ShadowLayerForwarder::PlatformGetDescriptorSurfaceImageFormat(
const SurfaceDescriptor&,
OpenMode,
gfxImageFormat*,
gfxASurface**)
{
return false;
}
bool
ShadowLayerForwarder::PlatformDestroySharedSurface(SurfaceDescriptor*)
{
@ -730,6 +764,24 @@ AutoOpenSurface::ContentType()
mDescriptor, mMode, getter_AddRefs(mSurface));
}
gfxImageFormat
AutoOpenSurface::ImageFormat()
{
if (mSurface) {
nsRefPtr<gfxImageSurface> img = mSurface->GetAsImageSurface();
if (img) {
gfxImageFormat format = img->Format();
NS_ASSERTION(format != gfxASurface::ImageFormatUnknown,
"ImageSurface RGB format should be known");
return format;
}
}
return ShadowLayerForwarder::GetDescriptorSurfaceImageFormat(
mDescriptor, mMode, getter_AddRefs(mSurface));
}
gfxIntSize
AutoOpenSurface::Size()
{

View File

@ -140,6 +140,8 @@ class ShadowLayerForwarder : public CompositableForwarder
friend class DeprecatedTextureClientShmem;
friend class ContentClientIncremental;
typedef gfxASurface::gfxImageFormat gfxImageFormat;
public:
virtual ~ShadowLayerForwarder();
@ -454,6 +456,18 @@ private:
OpenMode aMode,
gfxIntSize* aSize,
gfxASurface** aSurface);
// And again, for the image format.
// This function will return ImageFormatUnknown only if |aDescriptor|
// describes a non-ImageSurface.
static gfxImageFormat
GetDescriptorSurfaceImageFormat(const SurfaceDescriptor& aDescriptor,
OpenMode aMode,
gfxASurface** aSurface);
static bool
PlatformGetDescriptorSurfaceImageFormat(const SurfaceDescriptor& aDescriptor,
OpenMode aMode,
gfxImageFormat* aContent,
gfxASurface** aSurface);
static already_AddRefed<gfxASurface>
PlatformOpenDescriptor(OpenMode aMode, const SurfaceDescriptor& aDescriptor);

View File

@ -422,16 +422,22 @@ TextureImageDeprecatedTextureHostOGL::UpdateImpl(const SurfaceDescriptor& aImage
NS_WARNING("trying to update TextureImageDeprecatedTextureHostOGL without a compositor?");
return;
}
AutoOpenSurface surf(OPEN_READ_ONLY, aImage);
nsIntSize size = surf.Size();
TextureImage::ImageFormat format = surf.ImageFormat();
if (!mTexture ||
(mTexture->GetSize() != size && !aOffset) ||
mTexture->GetContentType() != surf.ContentType()) {
mTexture->GetContentType() != surf.ContentType() ||
(mTexture->GetImageFormat() != format &&
mTexture->GetImageFormat() != gfxASurface::ImageFormatUnknown)) {
mTexture = mGL->CreateTextureImage(size,
surf.ContentType(),
WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
FlagsToGLFlags(mFlags));
FlagsToGLFlags(mFlags),
format);
}
// XXX this is always just ridiculously slow