@@ -53,6 +53,8 @@ public class RotationFilterRender extends BaseFilterRender {
5353 private int uSamplerHandle = -1 ;
5454
5555 private int rotation = 0 ;
56+ private boolean horizontalFlip = false ;
57+ private boolean verticalFlip = false ;
5658
5759 public RotationFilterRender () {
5860 squareVertex = ByteBuffer .allocateDirect (squareVertexDataFilter .length * FLOAT_SIZE_BYTES )
@@ -117,10 +119,7 @@ public int getRotation() {
117119
118120 public void setRotation (int rotation ) {
119121 this .rotation = rotation ;
120- //Set rotation
121- Matrix .setIdentityM (MVPMatrix , 0 );
122- Matrix .scaleM (MVPMatrix , 0 , 1f , 1f , 1f );
123- Matrix .rotateM (MVPMatrix , 0 , rotation , 0f , 0f , -1f );
122+ updateMatrix ();
124123 }
125124
126125 /**
@@ -144,4 +143,16 @@ public void setRotationFixed(int rotation, int width, int height, boolean isPort
144143 Matrix .scaleM (MVPMatrix , 0 , 1f , 1f , 0f );
145144 }
146145 }
146+
147+ public void flip (boolean horizontalFlip , boolean verticalFlip ) {
148+ this .horizontalFlip = horizontalFlip ;
149+ this .verticalFlip = verticalFlip ;
150+ updateMatrix ();
151+ }
152+
153+ private void updateMatrix () {
154+ Matrix .setIdentityM (MVPMatrix , 0 );
155+ Matrix .scaleM (MVPMatrix , 0 , horizontalFlip ? -1f : 1f , verticalFlip ? -1f : 1f , 1f );
156+ Matrix .rotateM (MVPMatrix , 0 , rotation , 0f , 0f , -1f );
157+ }
147158}
0 commit comments