Revision d79a56d3
Added by Leszek Koltunski about 7 years ago
src/main/java/org/distorted/examples/check/CheckRenderer.java | ||
---|---|---|
88 | 88 |
|
89 | 89 |
public void onSurfaceChanged(GL10 glUnused, int width, int height) |
90 | 90 |
{ |
91 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
92 |
|
|
93 |
if( (float)bmpHeight/bmpWidth > (float)height/width ) |
|
94 |
{ |
|
95 |
int w = (height*bmpWidth)/bmpHeight; |
|
96 |
float factor = (float)height/bmpHeight; |
|
97 |
|
|
98 |
mEffects.move( new Static3D((width-w)/2,0,0) ); |
|
99 |
mEffects.scale(factor); |
|
100 |
} |
|
101 |
else |
|
102 |
{ |
|
103 |
int h = (width*bmpHeight)/bmpWidth; |
|
104 |
float factor = (float)width/bmpWidth; |
|
91 |
float qx = (float)width /bmpWidth; |
|
92 |
float qy = (float)height/bmpHeight; |
|
105 | 93 |
|
106 |
mEffects.move( new Static3D(0,(height-h)/2,0) ); |
|
107 |
mEffects.scale(factor); |
|
108 |
} |
|
94 |
mEffects.abortEffects(EffectTypes.MATRIX); |
|
95 |
mEffects.scale( qx<qy ? (new Static3D(1,qx/qy,1)) : (new Static3D(qy/qx,1,1)) ); |
|
109 | 96 |
|
110 | 97 |
mScreen.resize(width, height); |
111 | 98 |
} |
Also available in: Unified diff
Major refactoring: convert the Matrix Effects to be independent of the resolution of the surface we render to.
Re-write the first 15 apps to work with this.