Revision 51554e47
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/plainmonalisa/RenderThread.java | ||
---|---|---|
209 | 209 |
{ |
210 | 210 |
Log.d(TAG, "surfaceChanged " + width + "x" + height); |
211 | 211 |
|
212 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
213 |
|
|
214 |
if( (float)bmpHeight/bmpWidth > (float)height/width ) |
|
215 |
{ |
|
216 |
int w = (height*bmpWidth)/bmpHeight; |
|
217 |
float factor = (float)height/bmpHeight; |
|
218 |
|
|
219 |
mEffects.move( new Static3D((width-w)/2,0,0) ); |
|
220 |
mEffects.scale( factor ); |
|
221 |
} |
|
222 |
else |
|
223 |
{ |
|
224 |
int h = (width*bmpHeight)/bmpWidth; |
|
225 |
float factor = (float)width/bmpWidth; |
|
212 |
float qx = (float)width /bmpWidth; |
|
213 |
float qy = (float)height/bmpHeight; |
|
226 | 214 |
|
227 |
mEffects.move( new Static3D(0,(height-h)/2,0) ); |
|
228 |
mEffects.scale( factor ); |
|
229 |
} |
|
215 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
216 |
mEffects.scale( qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) ); |
|
230 | 217 |
|
231 | 218 |
mScreen.resize(width, height); |
232 | 219 |
} |
Also available in: Unified diff
Convert a few more APPs to the new resolution-independent Matrix Effects.