Revision 630703d1
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/monalisa/MonaLisaRenderer.java | ||
---|---|---|
86 | 86 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
87 | 87 |
|
88 | 88 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
89 |
{ |
|
90 |
float qx = (float)width /bmpWidth; |
|
91 |
float qy = (float)height/bmpHeight; |
|
92 |
|
|
89 |
{ |
|
93 | 90 |
mEffects.abortEffects(EffectTypes.MATRIX); |
94 |
mEffects.scale( qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) ); |
|
91 |
|
|
92 |
if( (float)bmpHeight/bmpWidth > (float)height/width ) |
|
93 |
{ |
|
94 |
int w = (height*bmpWidth)/bmpHeight; |
|
95 |
float factor = (float)height/bmpHeight; |
|
96 |
mEffects.move( new Static3D((width-w)/2,0,0) ); |
|
97 |
mEffects.scale(factor); |
|
98 |
} |
|
99 |
else |
|
100 |
{ |
|
101 |
int h = (width*bmpHeight)/bmpWidth; |
|
102 |
float factor = (float)width/bmpWidth; |
|
103 |
mEffects.move( new Static3D(0,(height-h)/2,0) ); |
|
104 |
mEffects.scale(factor); |
|
105 |
} |
|
95 | 106 |
|
96 | 107 |
mScreen.resize(width, height); |
97 | 108 |
} |
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.