Bug 942501 - Part 1: remove some dead code around TextureImage functions - r=BenWa

This commit is contained in:
Benoit Jacob 2013-12-03 13:44:38 -05:00
Родитель 16bf395b6f
Коммит 4513257f15
9 изменённых файлов: 6 добавлений и 232 удалений

Просмотреть файл

@ -2523,10 +2523,6 @@ public:
virtual void DestroyEGLImage(EGLImage image) = 0;
#endif
virtual already_AddRefed<TextureImage>
CreateDirectTextureImage(::android::GraphicBuffer* aBuffer, GLenum aWrapMode)
{ return nullptr; }
// Before reads from offscreen texture
void GuaranteeResolve();
@ -2625,10 +2621,6 @@ public:
void ForceDirtyScreen();
void CleanDirtyScreen();
virtual bool TextureImageSupportsGetBackingSurface() {
return false;
}
virtual GLenum GetPreferredARGB32Format() { return LOCAL_GL_RGBA; }
virtual bool RenewSurface() { return false; }

Просмотреть файл

@ -933,11 +933,6 @@ TRY_AGAIN_NO_SHARING:
return true;
}
bool TextureImageSupportsGetBackingSurface()
{
return false;
}
virtual already_AddRefed<TextureImage>
CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
@ -985,108 +980,6 @@ private:
nsRefPtr<gfxXlibSurface> mPixmap;
};
class TextureImageGLX : public TextureImage
{
friend already_AddRefed<TextureImage>
GLContextGLX::CreateTextureImage(const nsIntSize&,
ContentType,
GLenum,
TextureImage::Flags,
TextureImage::ImageFormat);
public:
virtual ~TextureImageGLX()
{
mGLContext->MakeCurrent();
mGLContext->fDeleteTextures(1, &mTexture);
sGLXLib.DestroyPixmap(mPixmap);
}
virtual gfxASurface* BeginUpdate(nsIntRegion& aRegion)
{
mInUpdate = true;
return mUpdateSurface;
}
virtual void EndUpdate()
{
mInUpdate = false;
}
virtual bool DirectUpdate(gfxASurface* aSurface, const nsIntRegion& aRegion, const nsIntPoint& aFrom)
{
nsRefPtr<gfxContext> ctx = new gfxContext(mUpdateSurface);
gfxUtils::ClipToRegion(ctx, aRegion);
ctx->SetSource(aSurface, aFrom);
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->Paint();
return true;
}
virtual void BindTexture(GLenum aTextureUnit)
{
mGLContext->fActiveTexture(aTextureUnit);
mGLContext->fBindTexture(LOCAL_GL_TEXTURE_2D, mTexture);
sGLXLib.BindTexImage(mPixmap);
mGLContext->fActiveTexture(LOCAL_GL_TEXTURE0);
}
virtual void ReleaseTexture()
{
sGLXLib.ReleaseTexImage(mPixmap);
}
virtual already_AddRefed<gfxASurface> GetBackingSurface()
{
nsRefPtr<gfxASurface> copy = mUpdateSurface;
return copy.forget();
}
virtual bool InUpdate() const { return mInUpdate; }
virtual GLuint GetTextureID() {
return mTexture;
}
private:
TextureImageGLX(GLuint aTexture,
const nsIntSize& aSize,
GLenum aWrapMode,
ContentType aContentType,
GLContext* aContext,
gfxASurface* aSurface,
GLXPixmap aPixmap,
TextureImage::Flags aFlags,
LibType aLibType)
: TextureImage(aSize, aWrapMode, aContentType, aFlags)
, mGLContext(aContext)
, mUpdateSurface(aSurface)
, mPixmap(aPixmap)
, mInUpdate(false)
, mTexture(aTexture)
, sGLXLib(sGLXLibrary[aLibType])
{
if (aSurface->GetContentType() == GFX_CONTENT_COLOR_ALPHA) {
mTextureFormat = FORMAT_R8G8B8A8;
} else {
mTextureFormat = FORMAT_R8G8B8X8;
}
}
nsRefPtr<GLContext> mGLContext;
nsRefPtr<gfxASurface> mUpdateSurface;
GLXPixmap mPixmap;
bool mInUpdate;
GLuint mTexture;
GLXLibrary& sGLXLib;
virtual void ApplyFilter()
{
mGLContext->ApplyFilterToBoundTexture(mFilter);
}
};
already_AddRefed<TextureImage>
GLContextGLX::CreateTextureImage(const nsIntSize& aSize,
TextureImage::ContentType aContentType,
@ -1094,67 +987,11 @@ GLContextGLX::CreateTextureImage(const nsIntSize& aSize,
TextureImage::Flags aFlags,
TextureImage::ImageFormat aImageFormat)
{
if (!TextureImageSupportsGetBackingSurface()) {
return GLContext::CreateTextureImage(aSize,
aContentType,
aWrapMode,
aFlags,
aImageFormat);
}
Display *display = DefaultXDisplay();
int xscreen = DefaultScreen(display);
gfxImageFormat imageFormat =
gfxPlatform::GetPlatform()->OptimalFormatForContent(aContentType);
XRenderPictFormat* xrenderFormat =
gfxXlibSurface::FindRenderFormat(display, imageFormat);
NS_ASSERTION(xrenderFormat, "Could not find a render format for our display!");
nsRefPtr<gfxXlibSurface> surface =
gfxXlibSurface::Create(ScreenOfDisplay(display, xscreen),
xrenderFormat,
gfxIntSize(aSize.width, aSize.height));
NS_ASSERTION(surface, "Failed to create xlib surface!");
if (aContentType == GFX_CONTENT_COLOR_ALPHA) {
nsRefPtr<gfxContext> ctx = new gfxContext(surface);
ctx->SetOperator(gfxContext::OPERATOR_CLEAR);
ctx->Paint();
}
MakeCurrent();
GLXPixmap pixmap = mGLX->CreatePixmap(surface);
// GLX might not be able to give us an A8 pixmap. If so, just use CPU
// memory.
if (!pixmap && imageFormat == gfxImageFormatA8) {
return GLContext::CreateTextureImage(aSize,
aContentType,
aWrapMode,
aFlags,
aImageFormat);
}
NS_ASSERTION(pixmap, "Failed to create pixmap!");
GLuint texture;
fGenTextures(1, &texture);
fActiveTexture(LOCAL_GL_TEXTURE0);
fBindTexture(LOCAL_GL_TEXTURE_2D, texture);
nsRefPtr<TextureImageGLX> teximage =
new TextureImageGLX(texture, aSize, aWrapMode, aContentType,
this, surface, pixmap, aFlags, mLibType);
GLint texfilter = aFlags & TextureImage::UseNearestFilter ? LOCAL_GL_NEAREST : LOCAL_GL_LINEAR;
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MIN_FILTER, texfilter);
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_MAG_FILTER, texfilter);
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_S, aWrapMode);
fTexParameteri(LOCAL_GL_TEXTURE_2D, LOCAL_GL_TEXTURE_WRAP_T, aWrapMode);
return teximage.forget();
return GLContext::CreateTextureImage(aSize,
aContentType,
aWrapMode,
aFlags,
aImageFormat);
}
static GLContextGLX *

Просмотреть файл

@ -23,6 +23,7 @@ typedef XID GLXPbuffer;
// end of stuff from glx.h
struct PRLibrary;
class gfxASurface;
namespace mozilla {
namespace gl {

Просмотреть файл

@ -826,14 +826,6 @@ LayerManagerComposite::GetMaxTextureSize() const
#ifndef MOZ_HAVE_PLATFORM_SPECIFIC_LAYER_BUFFERS
/*static*/ already_AddRefed<TextureImage>
LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext*,
const SurfaceDescriptor&,
GLenum)
{
return nullptr;
}
/*static*/ bool
LayerManagerComposite::SupportsDirectTexturing()
{

Просмотреть файл

@ -209,16 +209,6 @@ public:
*/
float ComputeRenderIntegrity();
/**
* Try to open |aDescriptor| for direct texturing. If the
* underlying surface supports direct texturing, a non-null
* TextureImage is returned. Otherwise null is returned.
*/
static already_AddRefed<gl::TextureImage>
OpenDescriptorForDirectTexturing(gl::GLContext* aContext,
const SurfaceDescriptor& aDescriptor,
GLenum aWrapMode);
/**
* returns true if PlatformAllocBuffer will return a buffer that supports
* direct texturing

Просмотреть файл

@ -88,14 +88,6 @@ ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor*)
return false;
}
/*static*/ already_AddRefed<TextureImage>
LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext*,
const SurfaceDescriptor&,
GLenum)
{
return nullptr;
}
/*static*/ bool
LayerManagerComposite::SupportsDirectTexturing()
{

Просмотреть файл

@ -291,19 +291,6 @@ void GrallocBufferActor::RemoveDeprecatedTextureHost(DeprecatedTextureHost* aDep
MOZ_ASSERT(!mDeprecatedTextureHosts.Contains(aDeprecatedTextureHost));
}
/*static*/ already_AddRefed<TextureImage>
LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext* aGL,
const SurfaceDescriptor& aDescriptor,
GLenum aWrapMode)
{
PROFILER_LABEL("LayerManagerComposite", "OpenDescriptorForDirectTexturing");
if (SurfaceDescriptor::TSurfaceDescriptorGralloc != aDescriptor.type()) {
return nullptr;
}
sp<GraphicBuffer> buffer = GrallocBufferActor::GetFrom(aDescriptor);
return aGL->CreateDirectTextureImage(buffer.get(), aWrapMode);
}
/*static*/ bool
LayerManagerComposite::SupportsDirectTexturing()
{

Просмотреть файл

@ -106,14 +106,6 @@ ISurfaceAllocator::PlatformDestroySharedSurface(SurfaceDescriptor*)
return false;
}
/*static*/ already_AddRefed<TextureImage>
LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext*,
const SurfaceDescriptor&,
GLenum)
{
return nullptr;
}
/*static*/ bool
LayerManagerComposite::SupportsDirectTexturing()
{

Просмотреть файл

@ -227,15 +227,6 @@ LayerManagerComposite::PlatformSyncBeforeReplyUpdate()
}
}
/*static*/ already_AddRefed<TextureImage>
LayerManagerComposite::OpenDescriptorForDirectTexturing(GLContext*,
const SurfaceDescriptor&,
GLenum)
{
// FIXME/bug XXXXXX: implement this using texture-from-pixmap
return nullptr;
}
/*static*/ bool
LayerManagerComposite::SupportsDirectTexturing()
{