Skip to content
Snippets Groups Projects
Commit f535aa8b authored by Christophe Geuzaine's avatar Christophe Geuzaine
Browse files

remove dead code

parent 7f62de41
Branches
Tags
No related merge requests found
...@@ -13,13 +13,9 @@ import android.opengl.GLSurfaceView.Renderer; ...@@ -13,13 +13,9 @@ import android.opengl.GLSurfaceView.Renderer;
public class GLESRender implements Renderer{ public class GLESRender implements Renderer{
private Gmsh mGModel; private Gmsh mGModel;
private int _width, _height; private int _width, _height;
private Bitmap _screenshot;
private boolean _needScreenshot;
public GLESRender(Gmsh model) public GLESRender(Gmsh model)
{ {
this.mGModel = model; this.mGModel = model;
_needScreenshot = false;
} }
public void load(String filename){ mGModel.load(filename); } public void load(String filename){ mGModel.load(filename); }
public void startInteraction(float x, float y) { mGModel.startEvent(x, y); } public void startInteraction(float x, float y) { mGModel.startEvent(x, y); }
...@@ -36,7 +32,6 @@ public class GLESRender implements Renderer{ ...@@ -36,7 +32,6 @@ public class GLESRender implements Renderer{
public void onDrawFrame(GL10 gl) public void onDrawFrame(GL10 gl)
{ {
mGModel.viewDraw(); mGModel.viewDraw();
if(_needScreenshot) this.screenshot(gl);
} }
public void onSurfaceChanged(GL10 gl, int width, int height) public void onSurfaceChanged(GL10 gl, int width, int height)
{ {
...@@ -45,29 +40,4 @@ public class GLESRender implements Renderer{ ...@@ -45,29 +40,4 @@ public class GLESRender implements Renderer{
_height = height; _height = height;
} }
public void onSurfaceCreated(GL10 gl, EGLConfig config) { } public void onSurfaceCreated(GL10 gl, EGLConfig config) { }
public void needScreenshot() { _screenshot = null; _needScreenshot = true; }
public Bitmap getScreenshot(){ return _screenshot; }
private void screenshot(GL10 gl)
{
_needScreenshot = false;
int bitmapBuffer[] = new int[_width * _height];
int bitmapSource[] = new int[_width * _height];
IntBuffer intBuffer = IntBuffer.wrap(bitmapBuffer);
intBuffer.position(0);
gl.glReadPixels(0, 0, _width, _height, GL10.GL_RGBA, GL10.GL_UNSIGNED_BYTE,
intBuffer);
int offset1, offset2;
for (int i = 0; i < _height; i++) {
offset1 = i * _width;
offset2 = (_height - i - 1) * _width;
for (int j = 0; j < _width; j++) {
int pixel = bitmapBuffer[offset1 + j];
bitmapSource[offset2 + j] = (pixel & 0xFF00FF00) |
(pixel << 16) & 0x00FF0000 | (pixel >> 16) & 0x000000FF;
}
}
_screenshot = Bitmap.createBitmap(bitmapSource, _width, _height,
Bitmap.Config.ARGB_8888);
}
} }
...@@ -264,17 +264,4 @@ public class ModelFragment extends Fragment{ ...@@ -264,17 +264,4 @@ public class ModelFragment extends Fragment{
{ {
_glView.requestRender(); _glView.requestRender();
} }
public void takeScreenshot(File out)
{
Bitmap screenshot = _glView.getScreenshot();
try {
FileOutputStream f = new FileOutputStream(out);
screenshot.compress(Bitmap.CompressFormat.PNG, 85, f);
} catch (FileNotFoundException e) {
e.printStackTrace();
}
finally {
_glView.setDrawingCacheEnabled(false);
}
}
} }
...@@ -97,11 +97,4 @@ class mGLSurfaceView extends GLSurfaceView { ...@@ -97,11 +97,4 @@ class mGLSurfaceView extends GLSurfaceView {
scaleFactor = 1f; scaleFactor = 1f;
_renderer.scaleModel(scaleFactor); _renderer.scaleModel(scaleFactor);
} }
public Bitmap getScreenshot()
{
_renderer.needScreenshot();
this.requestRender();
while(_renderer.getScreenshot() == null);
return _renderer.getScreenshot();
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment