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