Code cleanup.

This commit is contained in:
Ali Juma 2012-02-09 17:39:04 -05:00
parent fdf11e0c13
commit c1890c2bfc
4 changed files with 12 additions and 62 deletions

View File

@ -1999,7 +1999,7 @@ GLContextProviderEGL::CreateForWindow(nsIWidget *aWidget)
return nsnull;
}
#ifdef MOZ_WIDGET_ANDROID
#ifdef MOZ_JAVA_COMPOSITOR
printf_stderr("... registering OGL compositor with bridge\n");
mozilla::AndroidBridge::Bridge()->RegisterCompositor();
#endif

View File

@ -146,17 +146,6 @@ CompositorParent::ScheduleComposition()
} else {
MessageLoop::current()->PostTask(FROM_HERE, mCurrentCompositeTask);
}
// Test code for async scrolling.
#ifdef OMTC_TEST_ASYNC_SCROLLING
static bool scrollScheduled = false;
if (!scrollScheduled) {
CancelableTask *composeTask2 = NewRunnableMethod(this,
&CompositorParent::TestScroll);
MessageLoop::current()->PostDelayedTask(FROM_HERE, composeTask2, 500);
scrollScheduled = true;
}
#endif
}
void
@ -387,36 +376,6 @@ CompositorParent::ShadowLayersUpdated()
ScheduleComposition();
}
// Test code for async scrolling.
#ifdef OMTC_TEST_ASYNC_SCROLLING
void
CompositorParent::TestScroll()
{
static int scrollFactor = 0;
static bool fakeScrollDownwards = true;
if (fakeScrollDownwards) {
scrollFactor++;
if (scrollFactor > 10) {
scrollFactor = 10;
fakeScrollDownwards = false;
}
} else {
scrollFactor--;
if (scrollFactor < 0) {
scrollFactor = 0;
fakeScrollDownwards = true;
}
}
SetTransformation(1.0+2.0*scrollFactor/10, nsIntPoint(-25*scrollFactor,
-25*scrollFactor));
printf_stderr("AsyncRender scroll factor:%d\n", scrollFactor);
AsyncRender();
CancelableTask *composeTask = NewRunnableMethod(this, &CompositorParent::TestScroll);
MessageLoop::current()->PostDelayedTask(FROM_HERE, composeTask, 1000/65);
}
#endif
PLayersParent*
CompositorParent::AllocPLayers(const LayersBackend &backendType)
{

View File

@ -90,13 +90,14 @@ public:
void SetTransformation(float aScale, nsIntPoint aScrollOffset);
void AsyncRender();
// Can be called from any thread
void ScheduleRenderOnCompositorThread(::base::Thread &aCompositorThread);
void SchedulePauseOnCompositorThread(::base::Thread &aCompositorThread);
void ScheduleResumeOnCompositorThread(::base::Thread &aCompositorThread);
void PauseComposition();
void ResumeComposition();
void SchedulePauseOnCompositorThread(::base::Thread &aCompositorThread);
void ScheduleResumeOnCompositorThread(::base::Thread &aCompositorThread);
protected:
virtual PLayersParent* AllocPLayers(const LayersBackend &backendType);
@ -105,9 +106,6 @@ protected:
private:
void ScheduleComposition();
void Composite();
#ifdef OMTC_TEST_ASYNC_SCROLLING
void TestScroll();
#endif
void TransformShadowTree(Layer* aLayer, const ViewTransform& aTransform,
float aTempScaleDiffX = 1.0,
float aTempScaleDiffY = 1.0);

View File

@ -180,7 +180,7 @@ public class GLController {
mHeight = newHeight;
}
private void initEGLContext() {
private void initEGL() {
mEGL = (EGL10)EGLContext.getEGL();
mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
@ -194,6 +194,10 @@ public class GLController {
}
mEGLConfig = chooseConfig();
}
private void initEGLContext() {
initEGL();
int[] attribList = { EGL_CONTEXT_CLIENT_VERSION, mGLVersion, EGL10.EGL_NONE };
mEGLContext = mEGL.eglCreateContext(mEGLDisplay, mEGLConfig, EGL10.EGL_NO_CONTEXT,
@ -248,22 +252,11 @@ public class GLController {
mView.getRenderer().onSurfaceChanged((GL10)mGL, mView.getWidth(), mView.getHeight());
}
}
// Provides an EGLSurface without assuming ownership of this surface.
private EGLSurface provideEGLSurface() {
if (mEGL == null) {
mEGL = (EGL10)EGLContext.getEGL();
mEGLDisplay = mEGL.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
if (mEGLDisplay == EGL10.EGL_NO_DISPLAY) {
throw new GLControllerException("eglGetDisplay() failed");
}
int[] version = new int[2];
if (!mEGL.eglInitialize(mEGLDisplay, version)) {
throw new GLControllerException("eglInitialize() failed");
}
mEGLConfig = chooseConfig();
initEGL();
}
SurfaceHolder surfaceHolder = mView.getHolder();