Bug 958369 - 4/5 - remove the ContextFlags enum - r=jgilbert

This commit is contained in:
Benoit Jacob 2014-01-10 13:55:23 -05:00
Родитель e89c4521fc
Коммит f2062e25d7
8 изменённых файлов: 22 добавлений и 36 удалений

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

@ -873,7 +873,7 @@ CanvasRenderingContext2D::EnsureTarget()
if (!mForceSoftware && CheckSizeForSkiaGL(size))
{
glContext = GLContextProvider::CreateOffscreen(gfxIntSize(size.width, size.height),
caps, gl::ContextFlagsNone);
caps);
}
if (glContext) {

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

@ -553,8 +553,7 @@ WebGLContext::SetDimensions(int32_t width, int32_t height)
// try the default provider, whatever that is
if (!gl && useOpenGL) {
gl::ContextFlags flag = gl::ContextFlagsNone;
gl = gl::GLContextProvider::CreateOffscreen(size, caps, flag);
gl = gl::GLContextProvider::CreateOffscreen(size, caps);
if (gl && !InitAndValidateGL()) {
GenerateWarning("Error during OpenGL initialization");
return NS_ERROR_FAILURE;

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

@ -251,8 +251,7 @@ CreateOffscreenFBOContext(bool aShare = true)
already_AddRefed<GLContext>
GLContextProviderCGL::CreateOffscreen(const gfxIntSize& size,
const SurfaceCaps& caps,
const ContextFlags flags)
const SurfaceCaps& caps)
{
nsRefPtr<GLContextCGL> glContext = CreateOffscreenFBOContext();
if (glContext &&
@ -269,7 +268,7 @@ GLContextProviderCGL::CreateOffscreen(const gfxIntSize& size,
static nsRefPtr<GLContext> gGlobalContext;
GLContext *
GLContextProviderCGL::GetGlobalContext(const ContextFlags)
GLContextProviderCGL::GetGlobalContext()
{
if (!sCGLLibrary.EnsureInitialized()) {
return nullptr;

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

@ -799,8 +799,7 @@ GLContextEGL::CreateEGLPixmapOffscreenContext(const gfxIntSize& size)
// often without the ability to texture from them directly.
already_AddRefed<GLContext>
GLContextProviderEGL::CreateOffscreen(const gfxIntSize& size,
const SurfaceCaps& caps,
ContextFlags flags)
const SurfaceCaps& caps)
{
if (!sEGLLibrary.EnsureInitialized()) {
return nullptr;
@ -823,7 +822,7 @@ GLContextProviderEGL::CreateOffscreen(const gfxIntSize& size,
// and 2) some mobile devices have a very strict limit on global number of GL contexts (bug 754257)
// and 3) each EGL context eats 750k on B2G (bug 813783)
GLContext *
GLContextProviderEGL::GetGlobalContext(const ContextFlags)
GLContextProviderEGL::GetGlobalContext()
{
return nullptr;
}

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

@ -922,9 +922,9 @@ GLContextGLX::GLContextGLX(
static GLContextGLX *
GetGlobalContextGLX(const ContextFlags aFlags = ContextFlagsNone)
GetGlobalContextGLX()
{
return static_cast<GLContextGLX*>(GLContextProviderGLX::GetGlobalContext(aFlags));
return static_cast<GLContextGLX*>(GLContextProviderGLX::GetGlobalContext());
}
static bool
@ -1144,10 +1144,9 @@ DONE_CREATING_PIXMAP:
if (!error && // earlier recorded error
!serverError)
{
ContextFlags flag = ContextFlagsNone;
// We might have an alpha channel, but it doesn't matter.
SurfaceCaps dummyCaps = SurfaceCaps::Any();
GLContextGLX* shareContext = GetGlobalContextGLX(flag);
GLContextGLX* shareContext = GetGlobalContextGLX();
glContext = GLContextGLX::CreateGLContext(dummyCaps,
shareContext,
@ -1164,8 +1163,7 @@ DONE_CREATING_PIXMAP:
already_AddRefed<GLContext>
GLContextProviderGLX::CreateOffscreen(const gfxIntSize& size,
const SurfaceCaps& caps,
ContextFlags flags)
const SurfaceCaps& caps)
{
gfxIntSize dummySize = gfxIntSize(16, 16);
nsRefPtr<GLContextGLX> glContext =
@ -1185,7 +1183,7 @@ static nsRefPtr<GLContext> gGlobalContext;
static bool gUseContextSharing = getenv("MOZ_DISABLE_CONTEXT_SHARING_GLX") == 0;
GLContext*
GLContextProviderGLX::GetGlobalContext(const ContextFlags aFlag)
GLContextProviderGLX::GetGlobalContext()
{
// TODO: get GLX context sharing to work well with multiple threads
if (!gUseContextSharing) {

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

@ -59,15 +59,14 @@ public:
*/
static already_AddRefed<GLContext>
CreateOffscreen(const gfxIntSize& size,
const SurfaceCaps& caps,
ContextFlags flags = ContextFlagsNone);
const SurfaceCaps& caps);
/**
* Get a pointer to the global context, creating it if it doesn't exist.
*/
static GLContext*
GetGlobalContext(ContextFlags flags = ContextFlagsNone);
GetGlobalContext();
/**
* Free any resources held by this Context Provider.
*/

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

@ -222,12 +222,10 @@ WGLLibrary::EnsureInitialized()
mInitialized = true;
ContextFlags flag = ContextFlagsNone;
// Call this to create the global GLContext instance,
// and to check for errors. Note that this must happen /after/
// setting mInitialized to TRUE, or an infinite loop results.
if (GLContextProviderWGL::GetGlobalContext(flag) == nullptr) {
if (GLContextProviderWGL::GetGlobalContext() == nullptr) {
mInitialized = false;
return false;
}
@ -400,9 +398,9 @@ GLContextWGL::ResizeOffscreen(const gfx::IntSize& aNewSize)
}
static GLContextWGL *
GetGlobalContextWGL(const ContextFlags aFlags = ContextFlagsNone)
GetGlobalContextWGL()
{
return static_cast<GLContextWGL*>(GLContextProviderWGL::GetGlobalContext(aFlags));
return static_cast<GLContextWGL*>(GLContextProviderWGL::GetGlobalContext());
}
already_AddRefed<GLContext>
@ -559,10 +557,10 @@ CreatePBufferOffscreenContext(const gfxIntSize& aSize,
}
static already_AddRefed<GLContextWGL>
CreateWindowOffscreenContext(ContextFlags aFlags)
CreateWindowOffscreenContext()
{
// CreateWindowOffscreenContext must return a global-shared context
GLContextWGL *shareContext = GetGlobalContextWGL(aFlags);
GLContextWGL *shareContext = GetGlobalContextWGL();
if (!shareContext) {
return nullptr;
}
@ -609,8 +607,7 @@ CreateWindowOffscreenContext(ContextFlags aFlags)
already_AddRefed<GLContext>
GLContextProviderWGL::CreateOffscreen(const gfxIntSize& size,
const SurfaceCaps& caps,
ContextFlags flags)
const SurfaceCaps& caps)
{
if (!sWGLLib.EnsureInitialized()) {
return nullptr;
@ -629,7 +626,7 @@ GLContextProviderWGL::CreateOffscreen(const gfxIntSize& size,
// If it failed, then create a window context and use a FBO.
if (!glContext) {
glContext = CreateWindowOffscreenContext(flags);
glContext = CreateWindowOffscreenContext();
}
if (!glContext ||
@ -647,7 +644,7 @@ GLContextProviderWGL::CreateOffscreen(const gfxIntSize& size,
static nsRefPtr<GLContextWGL> gGlobalContext;
GLContext *
GLContextProviderWGL::GetGlobalContext(const ContextFlags flags)
GLContextProviderWGL::GetGlobalContext()
{
if (!sWGLLib.EnsureInitialized()) {
return nullptr;

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

@ -27,11 +27,6 @@ MOZ_BEGIN_ENUM_CLASS(SharedTextureBufferType)
IOSurface
MOZ_END_ENUM_CLASS(SharedTextureBufferType)
enum ContextFlags {
ContextFlagsNone = 0x0,
ContextFlagsGlobal = 0x1
};
enum GLContextType {
ContextTypeUnknown,
ContextTypeWGL,