@@ -121,6 +121,7 @@ public synchronized void setupPorts() {
121121 }
122122
123123 public void updateRenderMode () {
124+ if (mLogVerbose ) Log .v (TAG , "updateRenderMode. Thread: " + Thread .currentThread ());
124125 if (mRenderModeString != null ) {
125126 if (mRenderModeString .equals ("stretch" )) {
126127 mRenderMode = RENDERMODE_STRETCH ;
@@ -139,6 +140,7 @@ public void updateRenderMode() {
139140
140141 @ Override
141142 public void prepare (FilterContext context ) {
143+ if (mLogVerbose ) Log .v (TAG , "Prepare. Thread: " + Thread .currentThread ());
142144 // Create identity shader to render, and make sure to render upside-down, as textures
143145 // are stored internally bottom-to-top.
144146 mProgram = ShaderProgram .createIdentity (context );
@@ -214,8 +216,10 @@ public synchronized void process(FilterContext context) {
214216 float currentAspectRatio =
215217 (float )input .getFormat ().getWidth () / input .getFormat ().getHeight ();
216218 if (currentAspectRatio != mAspectRatio ) {
217- if (mLogVerbose ) Log .v (TAG , "New aspect ratio: " + currentAspectRatio +
218- ", previously: " + mAspectRatio );
219+ if (mLogVerbose ) {
220+ Log .v (TAG , "Process. New aspect ratio: " + currentAspectRatio +
221+ ", previously: " + mAspectRatio + ". Thread: " + Thread .currentThread ());
222+ }
219223 mAspectRatio = currentAspectRatio ;
220224 updateTargetRect ();
221225 }
@@ -249,6 +253,7 @@ public synchronized void process(FilterContext context) {
249253
250254 @ Override
251255 public void fieldPortValueUpdated (String name , FilterContext context ) {
256+ if (mLogVerbose ) Log .v (TAG , "FPVU. Thread: " + Thread .currentThread ());
252257 updateRenderMode ();
253258 }
254259
@@ -260,16 +265,22 @@ public void tearDown(FilterContext context) {
260265 }
261266
262267 private void updateTargetRect () {
268+ if (mLogVerbose ) Log .v (TAG , "updateTargetRect. Thread: " + Thread .currentThread ());
263269 if (mScreenWidth > 0 && mScreenHeight > 0 && mProgram != null ) {
264270 float screenAspectRatio = (float )mScreenWidth / mScreenHeight ;
265271 float relativeAspectRatio = screenAspectRatio / mAspectRatio ;
272+ if (mLogVerbose ) {
273+ Log .v (TAG , "UTR. screen w = " + (float )mScreenWidth + " x screen h = " +
274+ (float )mScreenHeight + " Screen AR: " + screenAspectRatio +
275+ ", frame AR: " + mAspectRatio + ", relative AR: " + relativeAspectRatio );
276+ }
266277
267278 if (relativeAspectRatio == 1.0f && mRenderMode != RENDERMODE_CUSTOMIZE ) {
279+ mProgram .setTargetRect (0 , 0 , 1 , 1 );
268280 mProgram .setClearsOutput (false );
269281 } else {
270282 switch (mRenderMode ) {
271283 case RENDERMODE_STRETCH :
272- mProgram .setTargetRect (0 , 0 , 1 , 1 );
273284 mTargetQuad .p0 .set (0f , 0.0f );
274285 mTargetQuad .p1 .set (1f , 0.0f );
275286 mTargetQuad .p2 .set (0f , 1.0f );
@@ -313,6 +324,7 @@ private void updateTargetRect() {
313324 ((ShaderProgram ) mProgram ).setSourceRegion (mSourceQuad );
314325 break ;
315326 }
327+ if (mLogVerbose ) Log .v (TAG , "UTR. quad: " + mTargetQuad );
316328 ((ShaderProgram ) mProgram ).setTargetRegion (mTargetQuad );
317329 }
318330 }
0 commit comments