gecko/gfx/gl/SharedSurfaceIO.h
jdashg a8a4d97f00 Bug 1066280 - Add TexClient for ShSurf. - r=kamidphish,mattwoodrow
From a7c09c0f17e19fd2254cb1d7a8ddd07b327151ad Mon Sep 17 00:00:00 2001
---
 gfx/2d/HelpersCairo.h                   |   2 +
 gfx/gl/GLContext.cpp                    |   3 +-
 gfx/gl/GLContext.h                      |   2 -
 gfx/gl/GLReadTexImageHelper.cpp         |  21 +--
 gfx/gl/GLReadTexImageHelper.h           |   6 +
 gfx/gl/GLScreenBuffer.h                 |   6 +-
 gfx/gl/ScopedGLHelpers.cpp              |  40 +++++
 gfx/gl/ScopedGLHelpers.h                |  26 ++-
 gfx/gl/SharedSurface.cpp                |  94 +++++++++++
 gfx/gl/SharedSurface.h                  |  19 +++
 gfx/gl/SharedSurfaceIO.h                |   4 +
 gfx/layers/CopyableCanvasLayer.cpp      |   3 +-
 gfx/layers/client/CanvasClient.cpp      | 276 +++++++++++++++++++++++++++++---
 gfx/layers/client/CanvasClient.h        |  34 ++++
 gfx/layers/client/ClientCanvasLayer.cpp |  21 ++-
 gfx/layers/client/ClientCanvasLayer.h   |   9 +-
 gfx/layers/client/TextureClient.cpp     |  35 ++++
 gfx/layers/client/TextureClient.h       |  85 +++++++++-
 gfx/layers/composite/TextureHost.cpp    | 131 ++++++++++++++-
 gfx/layers/composite/TextureHost.h      |  64 ++++++++
 gfx/layers/d3d10/CanvasLayerD3D10.cpp   |   5 +-
 gfx/layers/ipc/LayersSurfaces.ipdlh     |   5 +
 22 files changed, 828 insertions(+), 63 deletions(-)
2014-10-07 21:01:51 -07:00

98 lines
2.8 KiB
C++

/* -*- Mode: c++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40; -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef SHARED_SURFACEIO_H_
#define SHARED_SURFACEIO_H_
#include "mozilla/RefPtr.h"
#include "SharedSurface.h"
class MacIOSurface;
namespace mozilla {
namespace gl {
class SharedSurface_IOSurface : public SharedSurface
{
public:
static UniquePtr<SharedSurface_IOSurface> Create(const RefPtr<MacIOSurface>& ioSurf,
GLContext* gl,
bool hasAlpha);
~SharedSurface_IOSurface();
virtual void LockProdImpl() MOZ_OVERRIDE { }
virtual void UnlockProdImpl() MOZ_OVERRIDE { }
virtual void Fence() MOZ_OVERRIDE;
virtual bool WaitSync() MOZ_OVERRIDE { return true; }
virtual bool PollSync() MOZ_OVERRIDE { return true; }
virtual bool ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height,
GLenum format, GLenum type, GLvoid *pixels) MOZ_OVERRIDE;
virtual GLuint ProdTexture() MOZ_OVERRIDE {
return mProdTex;
}
virtual GLenum ProdTextureTarget() const MOZ_OVERRIDE {
return LOCAL_GL_TEXTURE_RECTANGLE_ARB;
}
static SharedSurface_IOSurface* Cast(SharedSurface *surf) {
MOZ_ASSERT(surf->mType == SharedSurfaceType::IOSurface);
return static_cast<SharedSurface_IOSurface*>(surf);
}
GLuint ConsTexture(GLContext* consGL);
GLenum ConsTextureTarget() const {
return LOCAL_GL_TEXTURE_RECTANGLE_ARB;
}
MacIOSurface* GetIOSurface() const {
return mIOSurf;
}
virtual bool NeedsIndirectReads() const MOZ_OVERRIDE {
return true;
}
private:
SharedSurface_IOSurface(const RefPtr<MacIOSurface>& ioSurf,
GLContext* gl, const gfx::IntSize& size,
bool hasAlpha);
RefPtr<MacIOSurface> mIOSurf;
GLuint mProdTex;
const GLContext* mCurConsGL;
GLuint mConsTex;
};
class SurfaceFactory_IOSurface : public SurfaceFactory
{
public:
// Infallible.
static UniquePtr<SurfaceFactory_IOSurface> Create(GLContext* gl,
const SurfaceCaps& caps);
protected:
const gfx::IntSize mMaxDims;
SurfaceFactory_IOSurface(GLContext* gl,
const SurfaceCaps& caps,
const gfx::IntSize& maxDims)
: SurfaceFactory(gl, SharedSurfaceType::IOSurface, caps)
, mMaxDims(maxDims)
{
}
virtual UniquePtr<SharedSurface> CreateShared(const gfx::IntSize& size) MOZ_OVERRIDE;
};
} /* namespace gfx */
} /* namespace mozilla */
#endif /* SHARED_SURFACEIO_H_ */