mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 720144 - Allow listening for draw updates and obtaining a copy of the composited surface for robocop testing. r=Cwiiis
This commit is contained in:
parent
e0ad67e5bf
commit
c2137e83db
@ -112,6 +112,9 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
// inside a transaction, so no synchronization is needed.
|
// inside a transaction, so no synchronization is needed.
|
||||||
private boolean mUpdateViewportOnEndDraw;
|
private boolean mUpdateViewportOnEndDraw;
|
||||||
|
|
||||||
|
/* Used by robocop for testing purposes */
|
||||||
|
private DrawListener mDrawListener;
|
||||||
|
|
||||||
private static Pattern sColorPattern;
|
private static Pattern sColorPattern;
|
||||||
|
|
||||||
public GeckoSoftwareLayerClient(Context context) {
|
public GeckoSoftwareLayerClient(Context context) {
|
||||||
@ -325,6 +328,11 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
Log.i(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - endDrawing");
|
Log.i(LOGTAG, "zerdatime " + SystemClock.uptimeMillis() + " - endDrawing");
|
||||||
|
|
||||||
|
/* Used by robocop for testing purposes */
|
||||||
|
if (mDrawListener != null) {
|
||||||
|
mDrawListener.drawFinished(x, y, width, height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ViewportMetrics getGeckoViewportMetrics() {
|
public ViewportMetrics getGeckoViewportMetrics() {
|
||||||
@ -536,5 +544,15 @@ public class GeckoSoftwareLayerClient extends LayerClient implements GeckoEventL
|
|||||||
int b = Integer.parseInt(matcher.group(3));
|
int b = Integer.parseInt(matcher.group(3));
|
||||||
return Color.rgb(r, g, b);
|
return Color.rgb(r, g, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Used by robocop for testing purposes. Not for production use! */
|
||||||
|
public void setDrawListener(DrawListener listener) {
|
||||||
|
mDrawListener = listener;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Used by robocop for testing purposes. Not for production use! */
|
||||||
|
public interface DrawListener {
|
||||||
|
public void drawFinished(int x, int y, int width, int height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ import android.util.Log;
|
|||||||
import android.view.WindowManager;
|
import android.view.WindowManager;
|
||||||
import javax.microedition.khronos.egl.EGLConfig;
|
import javax.microedition.khronos.egl.EGLConfig;
|
||||||
import javax.microedition.khronos.opengles.GL10;
|
import javax.microedition.khronos.opengles.GL10;
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.IntBuffer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The layer renderer implements the rendering logic for a layer view.
|
* The layer renderer implements the rendering logic for a layer view.
|
||||||
@ -95,6 +95,9 @@ public class LayerRenderer implements GLSurfaceView.Renderer {
|
|||||||
private int mCurrentFrame, mFrameTimingsSum, mDroppedFrames;
|
private int mCurrentFrame, mFrameTimingsSum, mDroppedFrames;
|
||||||
private boolean mShowFrameRate;
|
private boolean mShowFrameRate;
|
||||||
|
|
||||||
|
/* Used by robocop for testing purposes */
|
||||||
|
private IntBuffer mPixelBuffer;
|
||||||
|
|
||||||
public LayerRenderer(LayerView view) {
|
public LayerRenderer(LayerView view) {
|
||||||
mView = view;
|
mView = view;
|
||||||
|
|
||||||
@ -246,6 +249,31 @@ public class LayerRenderer implements GLSurfaceView.Renderer {
|
|||||||
mView.requestRender();
|
mView.requestRender();
|
||||||
|
|
||||||
PanningPerfAPI.recordFrameTime();
|
PanningPerfAPI.recordFrameTime();
|
||||||
|
|
||||||
|
/* Used by robocop for testing purposes */
|
||||||
|
IntBuffer pixelBuffer = mPixelBuffer;
|
||||||
|
if (updated && pixelBuffer != null) {
|
||||||
|
synchronized (pixelBuffer) {
|
||||||
|
pixelBuffer.position(0);
|
||||||
|
gl.glReadPixels(0, 0, (int)screenContext.viewport.width(), (int)screenContext.viewport.height(), GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE, pixelBuffer);
|
||||||
|
pixelBuffer.notify();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Used by robocop for testing purposes. Not for production use! */
|
||||||
|
IntBuffer getPixels() {
|
||||||
|
IntBuffer pixelBuffer = IntBuffer.allocate(mView.getWidth() * mView.getHeight());
|
||||||
|
synchronized (pixelBuffer) {
|
||||||
|
mPixelBuffer = pixelBuffer;
|
||||||
|
mView.requestRender();
|
||||||
|
try {
|
||||||
|
pixelBuffer.wait();
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
|
}
|
||||||
|
mPixelBuffer = null;
|
||||||
|
}
|
||||||
|
return pixelBuffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
private RenderContext createScreenContext() {
|
private RenderContext createScreenContext() {
|
||||||
|
@ -52,6 +52,7 @@ import android.view.MotionEvent;
|
|||||||
import android.view.inputmethod.EditorInfo;
|
import android.view.inputmethod.EditorInfo;
|
||||||
import android.view.inputmethod.InputConnection;
|
import android.view.inputmethod.InputConnection;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
import java.nio.IntBuffer;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
|
|
||||||
import org.json.JSONArray;
|
import org.json.JSONArray;
|
||||||
@ -237,5 +238,10 @@ public class LayerView extends GLSurfaceView
|
|||||||
public int getMaxTextureSize() {
|
public int getMaxTextureSize() {
|
||||||
return mRenderer.getMaxTextureSize();
|
return mRenderer.getMaxTextureSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Used by robocop for testing purposes. Not for production use! */
|
||||||
|
public IntBuffer getPixels() {
|
||||||
|
return mRenderer.getPixels();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user