BaseFilter changes

egloo2
Mattia Iavarone 5 years ago
parent aeeb9ae7fd
commit e65b7a33c0
  1. 14
      cameraview/src/main/java/com/otaliastudios/cameraview/filter/BaseFilter.java
  2. 1
      cameraview/src/main/java/com/otaliastudios/cameraview/filter/SimpleFilter.java

@ -8,7 +8,6 @@ import com.otaliastudios.cameraview.size.Size;
import com.otaliastudios.opengl.draw.GlDrawable; import com.otaliastudios.opengl.draw.GlDrawable;
import com.otaliastudios.opengl.draw.GlRect; import com.otaliastudios.opengl.draw.GlRect;
import com.otaliastudios.opengl.program.GlTextureProgram; import com.otaliastudios.opengl.program.GlTextureProgram;
import com.otaliastudios.opengl.texture.GlTexture;
/** /**
* A base implementation of {@link Filter} that just leaves the fragment shader to subclasses. * A base implementation of {@link Filter} that just leaves the fragment shader to subclasses.
@ -122,13 +121,17 @@ public abstract class BaseFilter implements Filter {
@Override @Override
public void onCreate(int programHandle) { public void onCreate(int programHandle) {
program = new GlTextureProgram( program = onCreateProgram(programHandle);
programHandle, }
@SuppressWarnings("WeakerAccess")
@NonNull
protected GlTextureProgram onCreateProgram(int programHandle) {
return new GlTextureProgram(programHandle,
vertexPositionName, vertexPositionName,
vertexModelViewProjectionMatrixName, vertexModelViewProjectionMatrixName,
vertexTextureCoordinateName, vertexTextureCoordinateName,
vertexTransformMatrixName vertexTransformMatrixName);
);
} }
@Override @Override
@ -195,6 +198,7 @@ public abstract class BaseFilter implements Filter {
return copy; return copy;
} }
@NonNull
protected BaseFilter onCopy() { protected BaseFilter onCopy() {
try { try {
return getClass().newInstance(); return getClass().newInstance();

@ -33,6 +33,7 @@ public final class SimpleFilter extends BaseFilter {
return fragmentShader; return fragmentShader;
} }
@NonNull
@Override @Override
protected BaseFilter onCopy() { protected BaseFilter onCopy() {
return new SimpleFilter(fragmentShader); return new SimpleFilter(fragmentShader);

Loading…
Cancel
Save