It seems that apparently useless public APIs are actually useful
Bug #6953651 Change-Id: Ic47ce504e63262711f5d3edc76f7d2b9c12471ad
This commit is contained in:
@@ -82,11 +82,17 @@ class GLES20RenderLayer extends GLES20Layer {
|
||||
}
|
||||
|
||||
@Override
|
||||
void end() {
|
||||
void end(Canvas currentCanvas) {
|
||||
if (currentCanvas instanceof GLES20Canvas) {
|
||||
((GLES20Canvas) currentCanvas).resume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
HardwareCanvas start() {
|
||||
HardwareCanvas start(Canvas currentCanvas) {
|
||||
if (currentCanvas instanceof GLES20Canvas) {
|
||||
((GLES20Canvas) currentCanvas).interrupt();
|
||||
}
|
||||
return getCanvas();
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
|
||||
package android.view;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.SurfaceTexture;
|
||||
@@ -56,12 +57,12 @@ class GLES20TextureLayer extends GLES20Layer {
|
||||
}
|
||||
|
||||
@Override
|
||||
HardwareCanvas start() {
|
||||
HardwareCanvas start(Canvas currentCanvas) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
void end() {
|
||||
void end(Canvas currentCanvas) {
|
||||
}
|
||||
|
||||
SurfaceTexture getSurfaceTexture() {
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
package android.view;
|
||||
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Matrix;
|
||||
import android.graphics.Rect;
|
||||
|
||||
@@ -143,13 +144,15 @@ abstract class HardwareLayer {
|
||||
|
||||
/**
|
||||
* This must be invoked before drawing onto this layer.
|
||||
* @param currentCanvas
|
||||
*/
|
||||
abstract HardwareCanvas start();
|
||||
abstract HardwareCanvas start(Canvas currentCanvas);
|
||||
|
||||
/**
|
||||
* This must be invoked after drawing onto this layer.
|
||||
* @param currentCanvas
|
||||
*/
|
||||
abstract void end();
|
||||
abstract void end(Canvas currentCanvas);
|
||||
|
||||
/**
|
||||
* Copies this layer into the specified bitmap.
|
||||
|
||||
@@ -1408,6 +1408,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
disposeResizeBuffer();
|
||||
|
||||
boolean completed = false;
|
||||
HardwareCanvas hwRendererCanvas = mAttachInfo.mHardwareRenderer.getCanvas();
|
||||
HardwareCanvas layerCanvas = null;
|
||||
try {
|
||||
if (mResizeBuffer == null) {
|
||||
@@ -1417,7 +1418,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
mResizeBuffer.getHeight() != mHeight) {
|
||||
mResizeBuffer.resize(mWidth, mHeight);
|
||||
}
|
||||
layerCanvas = mResizeBuffer.start();
|
||||
layerCanvas = mResizeBuffer.start(hwRendererCanvas);
|
||||
layerCanvas.setViewport(mWidth, mHeight);
|
||||
layerCanvas.onPreDraw(null);
|
||||
final int restoreCount = layerCanvas.save();
|
||||
@@ -1456,7 +1457,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
layerCanvas.onPostDraw();
|
||||
}
|
||||
if (mResizeBuffer != null) {
|
||||
mResizeBuffer.end();
|
||||
mResizeBuffer.end(hwRendererCanvas);
|
||||
if (!completed) {
|
||||
mResizeBuffer.destroy();
|
||||
mResizeBuffer = null;
|
||||
|
||||
@@ -720,6 +720,16 @@ static void android_view_GLES20Canvas_outputDisplayList(JNIEnv* env,
|
||||
// Layers
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
static void android_view_GLES20Canvas_interrupt(JNIEnv* env, jobject clazz,
|
||||
OpenGLRenderer* renderer) {
|
||||
renderer->interrupt();
|
||||
}
|
||||
|
||||
static void android_view_GLES20Canvas_resume(JNIEnv* env, jobject clazz,
|
||||
OpenGLRenderer* renderer) {
|
||||
renderer->resume();
|
||||
}
|
||||
|
||||
static OpenGLRenderer* android_view_GLES20Canvas_createLayerRenderer(JNIEnv* env,
|
||||
jobject clazz, Layer* layer) {
|
||||
if (layer) {
|
||||
@@ -962,6 +972,8 @@ static JNINativeMethod gMethods[] = {
|
||||
{ "nResetDisplayListRenderer", "(I)V", (void*) android_view_GLES20Canvas_resetDisplayListRenderer },
|
||||
|
||||
{ "nOutputDisplayList", "(II)V", (void*) android_view_GLES20Canvas_outputDisplayList },
|
||||
{ "nInterrupt", "(I)V", (void*) android_view_GLES20Canvas_interrupt },
|
||||
{ "nResume", "(I)V", (void*) android_view_GLES20Canvas_resume },
|
||||
|
||||
{ "nCreateLayerRenderer", "(I)I", (void*) android_view_GLES20Canvas_createLayerRenderer },
|
||||
{ "nCreateLayer", "(IIZ[I)I", (void*) android_view_GLES20Canvas_createLayer },
|
||||
|
||||
@@ -112,6 +112,21 @@ public:
|
||||
*/
|
||||
virtual void finish();
|
||||
|
||||
/**
|
||||
* This method must be invoked before handing control over to a draw functor.
|
||||
* See callDrawGLFunction() for instance.
|
||||
*
|
||||
* This command must not be recorded inside display lists.
|
||||
*/
|
||||
virtual void interrupt();
|
||||
|
||||
/**
|
||||
* This method must be invoked after getting control back from a draw functor.
|
||||
*
|
||||
* This command must not be recorded inside display lists.
|
||||
*/
|
||||
virtual void resume();
|
||||
|
||||
ANDROID_API status_t invokeFunctors(Rect& dirty);
|
||||
ANDROID_API void detachFunctor(Functor* functor);
|
||||
ANDROID_API void attachFunctor(Functor* functor);
|
||||
@@ -219,22 +234,6 @@ public:
|
||||
void endMark() const;
|
||||
|
||||
protected:
|
||||
|
||||
/**
|
||||
* This method must be invoked before handing control over to a draw functor.
|
||||
* See callDrawGLFunction() for instance.
|
||||
*
|
||||
* This command must not be recorded inside display lists.
|
||||
*/
|
||||
void interrupt();
|
||||
|
||||
/**
|
||||
* This method must be invoked after getting control back from a draw functor.
|
||||
*
|
||||
* This command must not be recorded inside display lists.
|
||||
*/
|
||||
void resume();
|
||||
|
||||
/**
|
||||
* Compose the layer defined in the current snapshot with the layer
|
||||
* defined by the previous snapshot.
|
||||
|
||||
Reference in New Issue
Block a user