Skip to content

Commit fabb3d6

Browse files
committed
Use super classe's variable instead of creating another one
Signed-off-by: Umair Khan <[email protected]>
1 parent a08ae4b commit fabb3d6

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

src/in/omerjerk/processing/video/android/Capture.java

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ public static void log(String log) {
3131
System.out.println(log);
3232
}
3333

34-
private PApplet applet;
35-
3634
private Camera mCamera;
3735

3836
private static ArrayList<String> camerasList = new ArrayList<String>();
@@ -63,24 +61,24 @@ public static void log(String log) {
6361

6462
private boolean isAvailable = false;
6563

66-
public Capture(PApplet context) {
67-
this(context, -1, -1);
64+
public Capture(PApplet parent) {
65+
this(parent, -1, -1);
6866
}
6967

70-
public Capture(final PApplet applet, int width, int height) {
68+
public Capture(final PApplet parent, int width, int height) {
7169
super();
72-
this.applet = applet;
70+
this.parent = parent;
7371
if (width == -1 || height == -1) {
7472
//TODO: Temp hack. Needs to be handled intelligently.
7573
width = 720;
7674
height = 1280;
7775
}
7876
init(width, height, ARGB);
7977

80-
applet.registerMethod("pause", this);
81-
applet.registerMethod("resume", this);
82-
glView = (GLSurfaceView) applet.getSurfaceView();
83-
pg = (PGraphicsOpenGL)applet.g;
78+
parent.registerMethod("pause", this);
79+
parent.registerMethod("resume", this);
80+
glView = (GLSurfaceView) parent.getSurfaceView();
81+
pg = (PGraphicsOpenGL)parent.g;
8482
// customTexture = new Texture(pg, width, height);
8583
// customTexture.invertedY(true);
8684
glView.queueEvent(new Runnable() {
@@ -91,7 +89,7 @@ public void run() {
9189
}
9290
});
9391
// pg.setCache(this, customTexture);
94-
applet.runOnUiThread(new Runnable() {
92+
parent.runOnUiThread(new Runnable() {
9593
@Override
9694
public void run() {
9795
mCameraHandler = new CameraHandler(Capture.this);
@@ -303,7 +301,7 @@ public void stopCamera() {
303301

304302
@Override
305303
public void startPreview() {
306-
if (applet.getSurfaceHolder().getSurface() == null) {
304+
if (parent.getSurfaceHolder().getSurface() == null) {
307305
// preview surface does not exist
308306
return;
309307
}
@@ -417,7 +415,7 @@ private void prepareFrameBuffers() {
417415
public void getImage(boolean loadPixels) {
418416

419417
if (destpg == null || destpg.width != width || destpg.height != height) {
420-
destpg = (PGraphicsOpenGL) applet.createGraphics(width, height, PConstants.P2D);
418+
destpg = (PGraphicsOpenGL) parent.createGraphics(width, height, PConstants.P2D);
421419
destpg.pgl.setGlThread(Thread.currentThread());
422420
}
423421

0 commit comments

Comments
 (0)