Improve BaseFilter

egloo2
Mattia Iavarone 5 years ago
parent e65b7a33c0
commit 01cf05cfa6
  1. 12
      cameraview/src/main/java/com/otaliastudios/cameraview/filter/BaseFilter.java

@ -89,7 +89,7 @@ public abstract class BaseFilter implements Filter {
} }
@VisibleForTesting GlTextureProgram program = null; @VisibleForTesting GlTextureProgram program = null;
private final GlDrawable programDrawable = new GlRect(); private GlDrawable programDrawable = null;
@VisibleForTesting Size size; @VisibleForTesting Size size;
@SuppressWarnings("WeakerAccess") @SuppressWarnings("WeakerAccess")
@ -121,17 +121,12 @@ public abstract class BaseFilter implements Filter {
@Override @Override
public void onCreate(int programHandle) { public void onCreate(int programHandle) {
program = onCreateProgram(programHandle); program = new GlTextureProgram(programHandle,
}
@SuppressWarnings("WeakerAccess")
@NonNull
protected GlTextureProgram onCreateProgram(int programHandle) {
return new GlTextureProgram(programHandle,
vertexPositionName, vertexPositionName,
vertexModelViewProjectionMatrixName, vertexModelViewProjectionMatrixName,
vertexTextureCoordinateName, vertexTextureCoordinateName,
vertexTransformMatrixName); vertexTransformMatrixName);
programDrawable = new GlRect();
} }
@Override @Override
@ -142,6 +137,7 @@ public abstract class BaseFilter implements Filter {
// would cause an error. // would cause an error.
program.release(); program.release();
program = null; program = null;
programDrawable = null;
} }
@NonNull @NonNull

Loading…
Cancel
Save