зеркало из https://github.com/mozilla/pjs.git
Bug 560537 - Fix indent for EGL provider. r=bas.schouten.
--HG-- extra : rebase_source : 5e2376f681dd4c638c111c74cc203c59df9c318a
This commit is contained in:
Родитель
521fb666e3
Коммит
0b4c81eac9
|
@ -156,34 +156,33 @@ public:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#define SYMBOL(name) \
|
#define SYMBOL(name) \
|
||||||
{ (PRFuncPtr*) &f##name, { "egl" #name, NULL } }
|
{ (PRFuncPtr*) &f##name, { "egl" #name, NULL } }
|
||||||
|
|
||||||
LibrarySymbolLoader::SymLoadStruct earlySymbols[] = {
|
LibrarySymbolLoader::SymLoadStruct earlySymbols[] = {
|
||||||
SYMBOL(GetDisplay),
|
SYMBOL(GetDisplay),
|
||||||
SYMBOL(GetCurrentContext),
|
SYMBOL(GetCurrentContext),
|
||||||
SYMBOL(MakeCurrent),
|
SYMBOL(MakeCurrent),
|
||||||
SYMBOL(DestroyContext),
|
SYMBOL(DestroyContext),
|
||||||
SYMBOL(CreateContext),
|
SYMBOL(CreateContext),
|
||||||
SYMBOL(DestroySurface),
|
SYMBOL(DestroySurface),
|
||||||
SYMBOL(CreateWindowSurface),
|
SYMBOL(CreateWindowSurface),
|
||||||
SYMBOL(CreatePbufferSurface),
|
SYMBOL(CreatePbufferSurface),
|
||||||
SYMBOL(CreatePixmapSurface),
|
SYMBOL(CreatePixmapSurface),
|
||||||
SYMBOL(BindAPI),
|
SYMBOL(BindAPI),
|
||||||
SYMBOL(Initialize),
|
SYMBOL(Initialize),
|
||||||
SYMBOL(ChooseConfig),
|
SYMBOL(ChooseConfig),
|
||||||
SYMBOL(GetError),
|
SYMBOL(GetError),
|
||||||
SYMBOL(GetConfigs),
|
SYMBOL(GetConfigs),
|
||||||
SYMBOL(GetConfigAttrib),
|
SYMBOL(GetConfigAttrib),
|
||||||
SYMBOL(WaitNative),
|
SYMBOL(WaitNative),
|
||||||
SYMBOL(GetProcAddress),
|
SYMBOL(GetProcAddress),
|
||||||
{ NULL, { NULL } }
|
{ NULL, { NULL } }
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!LibrarySymbolLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
|
|
||||||
NS_WARNING("Couldn't find required entry points in EGL library (early init)");
|
|
||||||
return PR_FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
if (!LibrarySymbolLoader::LoadSymbols(mEGLLibrary, &earlySymbols[0])) {
|
||||||
|
NS_WARNING("Couldn't find required entry points in EGL library (early init)");
|
||||||
|
return PR_FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
mInitialized = PR_TRUE;
|
mInitialized = PR_TRUE;
|
||||||
return PR_TRUE;
|
return PR_TRUE;
|
||||||
|
@ -197,15 +196,15 @@ private:
|
||||||
class GLContextEGL : public GLContext
|
class GLContextEGL : public GLContext
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GLContextEGL(EGLDisplay aDisplay, EGLConfig aConfig,
|
GLContextEGL(EGLDisplay aDisplay, EGLConfig aConfig,
|
||||||
EGLSurface aSurface, EGLContext aContext)
|
EGLSurface aSurface, EGLContext aContext)
|
||||||
: mDisplay(aDisplay), mConfig(aConfig),
|
: mDisplay(aDisplay), mConfig(aConfig),
|
||||||
mSurface(aSurface), mContext(aContext){}
|
mSurface(aSurface), mContext(aContext){}
|
||||||
|
|
||||||
~GLContextEGL()
|
~GLContextEGL()
|
||||||
{
|
{
|
||||||
sEGLLibrary.fDestroyContext(mDisplay, mContext);
|
sEGLLibrary.fDestroyContext(mDisplay, mContext);
|
||||||
sEGLLibrary.fDestroySurface(mDisplay, mSurface);
|
sEGLLibrary.fDestroySurface(mDisplay, mSurface);
|
||||||
}
|
}
|
||||||
|
|
||||||
PRBool Init()
|
PRBool Init()
|
||||||
|
@ -221,15 +220,15 @@ public:
|
||||||
|
|
||||||
PRBool MakeCurrent()
|
PRBool MakeCurrent()
|
||||||
{
|
{
|
||||||
PRBool succeeded = PR_TRUE;
|
PRBool succeeded = PR_TRUE;
|
||||||
|
|
||||||
// Assume that EGL has the same problem as WGL does,
|
// Assume that EGL has the same problem as WGL does,
|
||||||
// where MakeCurrent with an already-current context is
|
// where MakeCurrent with an already-current context is
|
||||||
// still expensive.
|
// still expensive.
|
||||||
if (sEGLLibrary.fGetCurrentContext() != mContext) {
|
if (sEGLLibrary.fGetCurrentContext() != mContext) {
|
||||||
succeeded = sEGLLibrary.fMakeCurrent(mDisplay, mSurface, mSurface, mContext);
|
succeeded = sEGLLibrary.fMakeCurrent(mDisplay, mSurface, mSurface, mContext);
|
||||||
NS_ASSERTION(succeeded, "Failed to make GL context current!");
|
NS_ASSERTION(succeeded, "Failed to make GL context current!");
|
||||||
}
|
}
|
||||||
|
|
||||||
return succeeded;
|
return succeeded;
|
||||||
}
|
}
|
||||||
|
@ -247,7 +246,7 @@ public:
|
||||||
return mContext;
|
return mContext;
|
||||||
|
|
||||||
case NativePBuffer:
|
case NativePBuffer:
|
||||||
return mSurface;
|
return mSurface;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
@ -311,14 +310,14 @@ GLContextProvider::CreateForWindow(nsIWidget *aWidget)
|
||||||
|
|
||||||
context = sEGLLibrary.fCreateContext(display, config, 0, cxattribs);
|
context = sEGLLibrary.fCreateContext(display, config, 0, cxattribs);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
sEGLLibrary.fDestroySurface(display, surface);
|
sEGLLibrary.fDestroySurface(display, surface);
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<GLContextEGL> glContext = new GLContextEGL(display, config, surface, context);
|
nsRefPtr<GLContextEGL> glContext = new GLContextEGL(display, config, surface, context);
|
||||||
|
|
||||||
if (!glContext->Init())
|
if (!glContext->Init())
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
return glContext.forget().get();
|
return glContext.forget().get();
|
||||||
}
|
}
|
||||||
|
@ -337,7 +336,7 @@ GLContextProvider::CreatePBuffer(const gfxIntSize &aSize, const ContextFormat &a
|
||||||
|
|
||||||
display = sEGLLibrary.fGetDisplay(EGL_DEFAULT_DISPLAY);
|
display = sEGLLibrary.fGetDisplay(EGL_DEFAULT_DISPLAY);
|
||||||
if (!sEGLLibrary.fInitialize(display, NULL, NULL))
|
if (!sEGLLibrary.fInitialize(display, NULL, NULL))
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
nsTArray<int> attribs;
|
nsTArray<int> attribs;
|
||||||
|
|
||||||
|
@ -363,12 +362,12 @@ GLContextProvider::CreatePBuffer(const gfxIntSize &aSize, const ContextFormat &a
|
||||||
int numConfigs = 32;
|
int numConfigs = 32;
|
||||||
|
|
||||||
if (!sEGLLibrary.fChooseConfig(display, attribs.Elements(),
|
if (!sEGLLibrary.fChooseConfig(display, attribs.Elements(),
|
||||||
configs, numConfigs,
|
configs, numConfigs,
|
||||||
&numConfigs))
|
&numConfigs))
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
if (numConfigs == 0)
|
if (numConfigs == 0)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
// shrug
|
// shrug
|
||||||
config = configs[0];
|
config = configs[0];
|
||||||
|
@ -381,7 +380,7 @@ GLContextProvider::CreatePBuffer(const gfxIntSize &aSize, const ContextFormat &a
|
||||||
|
|
||||||
surface = sEGLLibrary.fCreatePbufferSurface(display, config, pbattrs);
|
surface = sEGLLibrary.fCreatePbufferSurface(display, config, pbattrs);
|
||||||
if (!surface)
|
if (!surface)
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
sEGLLibrary.fBindAPI(LOCAL_EGL_OPENGL_ES_API);
|
sEGLLibrary.fBindAPI(LOCAL_EGL_OPENGL_ES_API);
|
||||||
|
|
||||||
|
@ -392,14 +391,14 @@ GLContextProvider::CreatePBuffer(const gfxIntSize &aSize, const ContextFormat &a
|
||||||
|
|
||||||
context = sEGLLibrary.fCreateContext(display, config, EGL_NO_CONTEXT, cxattrs);
|
context = sEGLLibrary.fCreateContext(display, config, EGL_NO_CONTEXT, cxattrs);
|
||||||
if (!context) {
|
if (!context) {
|
||||||
sEGLLibrary.fDestroySurface(display, surface);
|
sEGLLibrary.fDestroySurface(display, surface);
|
||||||
return nsnull;
|
return nsnull;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsRefPtr<GLContextEGL> glContext = new GLContextEGL(display, config, surface, context);
|
nsRefPtr<GLContextEGL> glContext = new GLContextEGL(display, config, surface, context);
|
||||||
|
|
||||||
if (!glContext->Init())
|
if (!glContext->Init())
|
||||||
return nsnull;
|
return nsnull;
|
||||||
|
|
||||||
return glContext.forget().get();
|
return glContext.forget().get();
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче