Revision 630703d1
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/bean/BeanRenderer.java | ||
---|---|---|
102 | 102 |
|
103 | 103 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
104 | 104 |
{ |
105 |
float qx = (float)width /bmpWidth; |
|
106 |
float qy = (float)height/bmpHeight; |
|
107 |
|
|
108 | 105 |
mEffects.abortEffects(EffectTypes.MATRIX); |
109 |
mEffects.scale( qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) ); |
|
106 |
|
|
107 |
if( (float)bmpHeight/bmpWidth > (float)height/width ) |
|
108 |
{ |
|
109 |
int w = (height*bmpWidth)/bmpHeight; |
|
110 |
float factor = (float)height/bmpHeight; |
|
111 |
|
|
112 |
mEffects.move( new Static3D((width-w)/2,0,0) ); |
|
113 |
mEffects.scale(factor); |
|
114 |
} |
|
115 |
else |
|
116 |
{ |
|
117 |
int h = (width*bmpHeight)/bmpWidth; |
|
118 |
float factor = (float)width/bmpWidth; |
|
119 |
|
|
120 |
mEffects.move( new Static3D(0,(height-h)/2,0) ); |
|
121 |
mEffects.scale(factor); |
|
122 |
} |
|
110 | 123 |
|
111 | 124 |
mScreen.resize(width, height); |
112 | 125 |
} |
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.