Revision 630703d1
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/listener/ListenerRenderer.java | ||
---|---|---|
110 | 110 |
|
111 | 111 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
112 | 112 |
{ |
113 |
float qx = (float)width /bmpWidth; |
|
114 |
float qy = (float)height/bmpHeight; |
|
115 |
|
|
116 | 113 |
mEffects.abortEffects(EffectTypes.MATRIX); |
117 |
mEffects.scale( qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) ); |
|
114 |
|
|
115 |
if( (float)bmpHeight/bmpWidth > (float)height/width ) |
|
116 |
{ |
|
117 |
int w = (height*bmpWidth)/bmpHeight; |
|
118 |
float factor = (float)height/bmpHeight; |
|
119 |
|
|
120 |
mEffects.move( new Static3D((width-w)/2,0,0) ); |
|
121 |
mEffects.scale(factor); |
|
122 |
} |
|
123 |
else |
|
124 |
{ |
|
125 |
int h = (width*bmpHeight)/bmpWidth; |
|
126 |
float factor = (float)width/bmpWidth; |
|
127 |
|
|
128 |
mEffects.move( new Static3D(0,(height-h)/2,0) ); |
|
129 |
mEffects.scale(factor); |
|
130 |
} |
|
118 | 131 |
|
119 | 132 |
mScreen.resize(width, height); |
120 | 133 |
} |
Also available in: Unified diff
Revert "Major refactoring: convert the Matrix Effects to be independent of the resolution of the surface we render to."
This reverts commit d79a56d3bc6cc7a22b21abeb180353a1818bd6ad.