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.GlRect;
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.
@ -122,13 +121,17 @@ public abstract class BaseFilter implements Filter {
@Override
public void onCreate(int programHandle) {
program = new GlTextureProgram(
programHandle,
program = onCreateProgram(programHandle);
}
@SuppressWarnings("WeakerAccess")
@NonNull
protected GlTextureProgram onCreateProgram(int programHandle) {
return new GlTextureProgram(programHandle,
vertexPositionName,
vertexModelViewProjectionMatrixName,
vertexTextureCoordinateName,
vertexTransformMatrixName
);
vertexTransformMatrixName);
}
@Override
@ -195,6 +198,7 @@ public abstract class BaseFilter implements Filter {
return copy;
}
@NonNull
protected BaseFilter onCopy() {
try {
return getClass().newInstance();

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

Loading…
Cancel
Save