From 01cf05cfa6219af5fcc0bc14710c79e54066fca6 Mon Sep 17 00:00:00 2001 From: Mattia Iavarone Date: Thu, 23 Jan 2020 14:51:08 -0300 Subject: [PATCH] Improve BaseFilter --- .../otaliastudios/cameraview/filter/BaseFilter.java | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cameraview/src/main/java/com/otaliastudios/cameraview/filter/BaseFilter.java b/cameraview/src/main/java/com/otaliastudios/cameraview/filter/BaseFilter.java index 1fa2d937..b7aa2cc7 100644 --- a/cameraview/src/main/java/com/otaliastudios/cameraview/filter/BaseFilter.java +++ b/cameraview/src/main/java/com/otaliastudios/cameraview/filter/BaseFilter.java @@ -89,7 +89,7 @@ public abstract class BaseFilter implements Filter { } @VisibleForTesting GlTextureProgram program = null; - private final GlDrawable programDrawable = new GlRect(); + private GlDrawable programDrawable = null; @VisibleForTesting Size size; @SuppressWarnings("WeakerAccess") @@ -121,17 +121,12 @@ public abstract class BaseFilter implements Filter { @Override public void onCreate(int programHandle) { - program = onCreateProgram(programHandle); - } - - @SuppressWarnings("WeakerAccess") - @NonNull - protected GlTextureProgram onCreateProgram(int programHandle) { - return new GlTextureProgram(programHandle, + program = new GlTextureProgram(programHandle, vertexPositionName, vertexModelViewProjectionMatrixName, vertexTextureCoordinateName, vertexTransformMatrixName); + programDrawable = new GlRect(); } @Override @@ -142,6 +137,7 @@ public abstract class BaseFilter implements Filter { // would cause an error. program.release(); program = null; + programDrawable = null; } @NonNull