Bug 1049957 - Fix compilation errors. - r=kamidphish

This commit is contained in:
Jeff Gilbert 2014-08-15 17:38:08 -07:00
parent ebe1200d76
commit 462da9f9df
12 changed files with 68 additions and 47 deletions

View File

@ -20,6 +20,7 @@
#endif
#include "ScopedGLHelpers.h"
#include "gfx2DGlue.h"
#include "../layers/ipc/ShadowLayers.h"
namespace mozilla {
namespace gl {
@ -31,10 +32,11 @@ GLScreenBuffer::Create(GLContext* gl,
const gfx::IntSize& size,
const SurfaceCaps& caps)
{
UniquePtr<GLScreenBuffer> ret;
if (caps.antialias &&
!gl->IsSupported(GLFeature::framebuffer_multisample))
{
return nullptr;
return Move(ret);
}
UniquePtr<SurfaceFactory> factory;
@ -64,9 +66,7 @@ GLScreenBuffer::Create(GLContext* gl,
RefPtr<SurfaceStream> stream;
stream = SurfaceStream::CreateForType(streamType, gl, nullptr);
UniquePtr<GLScreenBuffer> ret( new GLScreenBuffer(gl, caps,
Move(factory),
stream) );
ret.reset( new GLScreenBuffer(gl, caps, Move(factory), stream) );
return Move(ret);
}
@ -651,8 +651,9 @@ ReadBuffer::Create(GLContext* gl,
UniquePtr<ReadBuffer> ret( new ReadBuffer(gl, fb, depthRB,
stencilRB, surf) );
if (!gl->IsFramebufferComplete(fb))
return nullptr;
if (!gl->IsFramebufferComplete(fb)) {
ret = nullptr;
}
return Move(ret);
}

View File

@ -21,6 +21,7 @@
#include "GLDefs.h"
#include "mozilla/gfx/2D.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/UniquePtr.h"
namespace mozilla {
namespace gl {

View File

@ -22,6 +22,7 @@
#include "GLDefs.h"
#include "mozilla/Attributes.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/WeakPtr.h"
#include "SurfaceTypes.h"

View File

@ -192,8 +192,9 @@ SharedSurface_ANGLEShareHandle::Create(GLContext* gl,
}
typedef SharedSurface_ANGLEShareHandle ptrT;
return UniquePtr<ptrT>( new ptrT(gl, egl, size, hasAlpha, context,
pbuffer, shareHandle) );
UniquePtr<ptrT> ret( new ptrT(gl, egl, size, hasAlpha, context,
pbuffer, shareHandle) );
return Move(ret);
}
/*static*/ UniquePtr<SurfaceFactory_ANGLEShareHandle>
@ -204,14 +205,15 @@ SurfaceFactory_ANGLEShareHandle::Create(GLContext* gl,
if (!egl)
return nullptr;
if (!egl->IsExtensionSupported(
GLLibraryEGL::ANGLE_surface_d3d_texture_2d_share_handle))
auto ext = GLLibraryEGL::ANGLE_surface_d3d_texture_2d_share_handle;
if (!egl->IsExtensionSupported(ext))
{
return nullptr;
}
typedef SurfaceFactory_ANGLEShareHandle ptrT;
return UniquePtr<ptrT>( new ptrT(gl, egl, caps) );
UniquePtr<ptrT> ret( new ptrT(gl, egl, caps) );
return Move(ret);
}
SurfaceFactory_ANGLEShareHandle::SurfaceFactory_ANGLEShareHandle(GLContext* gl,

View File

@ -27,14 +27,16 @@ SharedSurface_EGLImage::Create(GLContext* prodGL,
MOZ_ASSERT(egl);
MOZ_ASSERT(context);
UniquePtr<SharedSurface_EGLImage> ret;
if (!HasExtensions(egl, prodGL)) {
return nullptr;
return Move(ret);
}
MOZ_ALWAYS_TRUE(prodGL->MakeCurrent());
GLuint prodTex = CreateTextureForOffscreen(prodGL, formats, size);
if (!prodTex) {
return nullptr;
return Move(ret);
}
EGLClientBuffer buffer = reinterpret_cast<EGLClientBuffer>(prodTex);
@ -43,12 +45,12 @@ SharedSurface_EGLImage::Create(GLContext* prodGL,
nullptr);
if (!image) {
prodGL->fDeleteTextures(1, &prodTex);
return nullptr;
return Move(ret);
}
typedef SharedSurface_EGLImage ptrT;
return UniquePtr<ptrT>( new ptrT(prodGL, egl, size, hasAlpha,
formats, prodTex, image) );
ret.reset( new SharedSurface_EGLImage(prodGL, egl, size, hasAlpha,
formats, prodTex, image) );
return Move(ret);
}
bool
@ -221,13 +223,15 @@ SurfaceFactory_EGLImage::Create(GLContext* prodGL,
{
EGLContext context = GLContextEGL::Cast(prodGL)->GetEGLContext();
typedef SurfaceFactory_EGLImage ptrT;
UniquePtr<ptrT> ret;
GLLibraryEGL* egl = &sEGLLibrary;
if (!SharedSurface_EGLImage::HasExtensions(egl, prodGL)) {
return nullptr;
if (SharedSurface_EGLImage::HasExtensions(egl, prodGL)) {
ret.reset( new ptrT(prodGL, context, caps) );
}
typedef SurfaceFactory_EGLImage ptrT;
return UniquePtr<ptrT>( new ptrT(prodGL, context, caps) );
return Move(ret);
}
} /* namespace gfx */

View File

@ -47,7 +47,8 @@ SharedSurface_Basic::Create(GLContext* gl,
}
typedef SharedSurface_Basic ptrT;
return UniquePtr<ptrT>( new ptrT(gl, size, hasAlpha, format, tex) );
UniquePtr<ptrT> ret( new ptrT(gl, size, hasAlpha, format, tex) );
return Move(ret);
}
SharedSurface_Basic::SharedSurface_Basic(GLContext* gl,
@ -128,8 +129,9 @@ SharedSurface_GLTexture::Create(GLContext* prodGL,
}
typedef SharedSurface_GLTexture ptrT;
return UniquePtr<ptrT>( new ptrT(prodGL, consGL, size, hasAlpha,
tex, ownsTex) );
UniquePtr<ptrT> ret( new ptrT(prodGL, consGL, size, hasAlpha, tex,
ownsTex) );
return Move(ret);
}
SharedSurface_GLTexture::~SharedSurface_GLTexture()

View File

@ -59,10 +59,12 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
GLLibraryEGL* egl = &sEGLLibrary;
MOZ_ASSERT(egl);
UniquePtr<SharedSurface_Gralloc> ret;
DEBUG_PRINT("SharedSurface_Gralloc::Create -------\n");
if (!HasExtensions(egl, prodGL))
return nullptr;
return Move(ret);
gfxContentType type = hasAlpha ? gfxContentType::COLOR_ALPHA
: gfxContentType::COLOR;
@ -78,7 +80,7 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
layers::TextureFlags::DEFAULT);
if (!grallocTC->AllocateForGLRendering(size)) {
return nullptr;
return Move(ret);
}
sp<GraphicBuffer> buffer = grallocTC->GetGraphicBuffer();
@ -93,7 +95,7 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
LOCAL_EGL_NATIVE_BUFFER_ANDROID,
clientBuffer, attrs);
if (!image) {
return nullptr;
return Move(ret);
}
prodGL->MakeCurrent();
@ -110,14 +112,15 @@ SharedSurface_Gralloc::Create(GLContext* prodGL,
egl->fDestroyImage(display, image);
ret.reset( new SharedSurface_Gralloc(prodGL, size, hasAlpha, egl,
allocator, grallocTC,
prodTex) );
typedef SharedSurface_Gralloc ptrT;
UniquePtr<ptrT> surf( new ptrT(prodGL, size, hasAlpha, egl,
allocator, grallocTC, prodTex) );
DEBUG_PRINT("SharedSurface_Gralloc::Create: success -- surface %p,"
" GraphicBuffer %p.\n",
ret.get(), buffer.get());
DEBUG_PRINT("SharedSurface_Gralloc::Create: success -- surface %p, GraphicBuffer %p.\n", surf, buffer.get());
return Move(surf);
return Move(ret);
}

View File

@ -86,10 +86,13 @@ public:
virtual UniquePtr<SharedSurface> CreateShared(const gfx::IntSize& size) MOZ_OVERRIDE {
bool hasAlpha = mReadCaps.alpha;
if (!mAllocator) {
return nullptr;
UniquePtr<SharedSurface> ret;
if (mAllocator) {
ret = SharedSurface_Gralloc::Create(mGL, mFormats, size,
hasAlpha, mAllocator);
}
return SharedSurface_Gralloc::Create(mGL, mFormats, size, hasAlpha, mAllocator);
return Move(ret);
}
};

View File

@ -18,13 +18,14 @@ SharedSurface_IOSurface::Create(const RefPtr<MacIOSurface>& ioSurf,
GLContext* gl,
bool hasAlpha)
{
MOZ_ASSERT(surface);
MOZ_ASSERT(ioSurf);
MOZ_ASSERT(gl);
gfx::IntSize size(surface->GetWidth(), surface->GetHeight());
gfx::IntSize size(ioSurf->GetWidth(), ioSurf->GetHeight());
typedef SharedSurface_IOSurface ptrT;
return UniquePtr<ptrT>( new ptrT(ioSurf, gl, size, hasAlpha) );
UniquePtr<ptrT> ret( new ptrT(ioSurf, gl, size, hasAlpha) );
return Move(ret);
}
void
@ -107,7 +108,7 @@ SharedSurface_IOSurface::SharedSurface_IOSurface(const RefPtr<MacIOSurface>& ioS
gl->MakeCurrent();
mProdTex = 0;
gl->fGenTextures(1, &mProdTex);
BackTextureWithIOSurf(gl, mProdTex, surface);
BackTextureWithIOSurf(gl, mProdTex, mIOSurf);
}
GLuint
@ -149,7 +150,8 @@ SurfaceFactory_IOSurface::Create(GLContext* gl,
MacIOSurface::GetMaxHeight());
typedef SurfaceFactory_IOSurface ptrT;
return UniquePtr<ptrT>( new ptrT(gl, caps, maxDims) );
UniquePtr<ptrT> ret( new ptrT(gl, caps, maxDims) );
return Move(ret);
}
UniquePtr<SharedSurface>
@ -166,7 +168,7 @@ SurfaceFactory_IOSurface::CreateShared(const gfx::IntSize& size)
ioSurf = MacIOSurface::CreateIOSurface(size.width, size.height, 1.0,
hasAlpha);
if (!surf) {
if (!ioSurf) {
NS_WARNING("Failed to create MacIOSurface.");
return nullptr;
}

View File

@ -17,7 +17,7 @@ namespace gl {
class SharedSurface_IOSurface : public SharedSurface
{
public:
static UniquePtr<SharedSurface_IOSurface> Create(MacIOSurface* surface,
static UniquePtr<SharedSurface_IOSurface> Create(const RefPtr<MacIOSurface>& ioSurf,
GLContext* gl,
bool hasAlpha);
@ -53,12 +53,13 @@ public:
}
MacIOSurface* GetIOSurface() const {
return mSurface;
return mIOSurf;
}
private:
SharedSurface_IOSurface(MacIOSurface* ioSurf, GLContext* gl,
const gfx::IntSize& size, bool hasAlpha);
SharedSurface_IOSurface(const RefPtr<MacIOSurface>& ioSurf,
GLContext* gl, const gfx::IntSize& size,
bool hasAlpha);
RefPtr<MacIOSurface> mIOSurf;
GLuint mProdTex;

View File

@ -12,6 +12,7 @@
#include "mozilla/Attributes.h"
#include "mozilla/gfx/Point.h"
#include "mozilla/GenericRefCounted.h"
#include "mozilla/UniquePtr.h"
#include "SurfaceTypes.h"
#include "SharedSurface.h"

View File

@ -73,7 +73,7 @@ ClientCanvasLayer::Initialize(const Data& aData)
SurfaceStreamType streamType =
SurfaceStream::ChooseGLStreamType(SurfaceStream::OffMainThread,
screen->PreserveBuffer());
UniquePtr<SurfaceFactory> factory = nullptr;
UniquePtr<SurfaceFactory> factory;
if (!gfxPrefs::WebGLForceLayersReadback()) {
switch (ClientManager()->AsShadowForwarder()->GetCompositorBackendType()) {