Bug 614832. Android: renew surface after it's been destroyed. r=vlad,a=blocking

Uses the new RenewSurface() to renew the surface when it is destroyed.
This commit is contained in:
Jeff Muizelaar 2010-12-13 14:37:25 -08:00
Родитель a7aeefa060
Коммит a496d26653
4 изменённых файлов: 25 добавлений и 0 удалений

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

@ -68,6 +68,9 @@ public class GeckoEvent {
public static final int ACTIVITY_SHUTDOWN = 10;
public static final int LOAD_URI = 11;
public static final int SURFACE_CREATED = 12;
public static final int SURFACE_DESTROYED = 13;
public static final int IME_COMPOSITION_END = 0;
public static final int IME_COMPOSITION_BEGIN = 1;
public static final int IME_SET_TEXT = 2;

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

@ -159,12 +159,17 @@ class GeckoSurfaceView
}
public void surfaceCreated(SurfaceHolder holder) {
Log.i("GeckoAppJava", "surface created");
GeckoEvent e = new GeckoEvent(GeckoEvent.SURFACE_CREATED);
GeckoAppShell.sendEventToGecko(e);
}
public void surfaceDestroyed(SurfaceHolder holder) {
Log.i("GeckoAppJava", "surface destroyed");
mSurfaceValid = false;
mSoftwareBuffer = null;
GeckoEvent e = new GeckoEvent(GeckoEvent.SURFACE_DESTROYED);
GeckoAppShell.sendEventToGecko(e);
}
public ByteBuffer getSoftwareDrawBuffer() {

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

@ -451,6 +451,8 @@ public:
ACTIVITY_PAUSING = 9,
ACTIVITY_SHUTDOWN = 10,
LOAD_URI = 11,
SURFACE_CREATED = 12,
SURFACE_DESTROYED = 13,
dummy_java_enum_list_end
};

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

@ -135,6 +135,7 @@ static nsWindow* gFocusedWindow = nsnull;
static nsRefPtr<gl::GLContext> sGLContext;
static bool sFailedToCreateGLContext = false;
static bool sValidSurface;
// Multitouch swipe thresholds in inches
static const double SWIPE_MAX_PINCH_DELTA_INCHES = 0.4;
@ -697,6 +698,7 @@ nsWindow::GetLayerManager(LayerManagerPersistence, bool* aAllowRetaining)
if (layerManager && layerManager->Initialize(sGLContext))
mLayerManager = layerManager;
sValidSurface = true;
}
if (!sGLContext || !mLayerManager) {
@ -820,6 +822,13 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
}
break;
case AndroidGeckoEvent::SURFACE_CREATED:
break;
case AndroidGeckoEvent::SURFACE_DESTROYED:
sValidSurface = false;
break;
default:
break;
}
@ -990,6 +999,12 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
return;
}
if (!sValidSurface) {
sGLContext->RenewSurface();
sValidSurface = true;
}
NS_ASSERTION(sGLContext, "Drawing with GLES without a GL context?");
DrawTo(nsnull);