Fixes for auto video resizing (right part of screen was messed up on HTC Evo)
This commit is contained in:
@@ -3,5 +3,5 @@
|
||||
# Set here your own NDK path if needed
|
||||
export PATH=$PATH:~/src/endless_space/android-ndk-r4
|
||||
|
||||
cd project && ndk-build -j2 V=1 && ant debug && cd bin && adb install -r DemoActivity-debug.apk
|
||||
cd project && ndk-build V=1 && ant debug && cd bin && adb install -r DemoActivity-debug.apk
|
||||
|
||||
|
||||
@@ -29,6 +29,9 @@
|
||||
#include "SDL_pixels_c.h"
|
||||
#include "SDL_rect_c.h"
|
||||
#include "SDL_yuv_sw_c.h"
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
#if defined(__QNXNTO__)
|
||||
/* Include QNX system header to check QNX version later */
|
||||
@@ -351,9 +354,15 @@ GLES_ActivateRenderer(SDL_Renderer * renderer)
|
||||
data->glLoadIdentity();
|
||||
data->glMatrixMode(GL_MODELVIEW);
|
||||
data->glLoadIdentity();
|
||||
#if SDL_VIDEO_RENDER_RESIZE
|
||||
data->glViewport(0, 0, window->display->desktop_mode.w, window->display->desktop_mode.h);
|
||||
data->glOrthof(0.0, (GLfloat) window->display->desktop_mode.w, (GLfloat) window->display->desktop_mode.h,
|
||||
0.0, 0.0, 1.0);
|
||||
#else
|
||||
data->glViewport(0, 0, window->w, window->h);
|
||||
data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h, 0.0,
|
||||
0.0, 1.0);
|
||||
data->glOrthof(0.0, (GLfloat) window->w, (GLfloat) window->h,
|
||||
0.0, 0.0, 1.0);
|
||||
#endif
|
||||
data->updateSize = SDL_FALSE;
|
||||
}
|
||||
return 0;
|
||||
@@ -911,9 +920,10 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
cropRect[3] = -srcrect->h;
|
||||
data->glTexParameteriv(GL_TEXTURE_2D, GL_TEXTURE_CROP_RECT_OES,
|
||||
cropRect);
|
||||
data->glDrawTexiOES(dstrect->x,
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "GLES_RenderCopy glDrawTexiOES(%d, %d, %d, %d) cropRect %d:%d:%d:%d", dstrect->x, window->display->desktop_mode.h - dstrect->y - dstrect->h, dstrect->w, dstrect->h, cropRect[0], cropRect[1], cropRect[2], cropRect[3]);
|
||||
data->glDrawTexiOES(dstrect->x,
|
||||
#if SDL_VIDEO_RENDER_RESIZE
|
||||
window->display->current_mode.h - dstrect->y - dstrect->h,
|
||||
window->display->desktop_mode.h - dstrect->y - dstrect->h,
|
||||
#else
|
||||
window->h - dstrect->y - dstrect->h,
|
||||
#endif
|
||||
|
||||
@@ -33,6 +33,9 @@
|
||||
#include "SDL_renderer_sw.h"
|
||||
#include "../events/SDL_sysevents.h"
|
||||
#include "../events/SDL_events_c.h"
|
||||
#ifdef ANDROID
|
||||
#include <android/log.h>
|
||||
#endif
|
||||
|
||||
#if SDL_VIDEO_OPENGL_ES
|
||||
#include "SDL_opengles.h"
|
||||
@@ -2436,8 +2439,8 @@ SDL_RenderDrawPoints(const SDL_Point * points, int count)
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_RENDER_RESIZE
|
||||
realW = renderer->window->display->current_mode.w;
|
||||
realH = renderer->window->display->current_mode.h;
|
||||
realW = renderer->window->display->desktop_mode.w;
|
||||
realH = renderer->window->display->desktop_mode.h;
|
||||
fakeW = renderer->window->w;
|
||||
fakeH = renderer->window->h;
|
||||
//if( fakeW > realW || fakeH > realH )
|
||||
@@ -2495,8 +2498,8 @@ SDL_RenderDrawLines(const SDL_Point * points, int count)
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_RENDER_RESIZE
|
||||
realW = renderer->window->display->current_mode.w;
|
||||
realH = renderer->window->display->current_mode.h;
|
||||
realW = renderer->window->display->desktop_mode.w;
|
||||
realH = renderer->window->display->desktop_mode.h;
|
||||
fakeW = renderer->window->w;
|
||||
fakeH = renderer->window->h;
|
||||
//if( fakeW > realW || fakeH > realH )
|
||||
@@ -2564,8 +2567,8 @@ SDL_RenderDrawRects(const SDL_Rect ** rects, int count)
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_RENDER_RESIZE
|
||||
realW = renderer->window->display->current_mode.w;
|
||||
realH = renderer->window->display->current_mode.h;
|
||||
realW = renderer->window->display->desktop_mode.w;
|
||||
realH = renderer->window->display->desktop_mode.h;
|
||||
fakeW = renderer->window->w;
|
||||
fakeH = renderer->window->h;
|
||||
//if( fakeW > realW || fakeH > realH )
|
||||
@@ -2644,8 +2647,8 @@ SDL_RenderFillRects(const SDL_Rect ** rects, int count)
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_RENDER_RESIZE
|
||||
realW = renderer->window->display->current_mode.w;
|
||||
realH = renderer->window->display->current_mode.h;
|
||||
realW = renderer->window->display->desktop_mode.w;
|
||||
realH = renderer->window->display->desktop_mode.h;
|
||||
fakeW = renderer->window->w;
|
||||
fakeH = renderer->window->h;
|
||||
//if( fakeW > realW || fakeH > realH )
|
||||
@@ -2741,8 +2744,8 @@ SDL_RenderCopy(SDL_Texture * texture, const SDL_Rect * srcrect,
|
||||
}
|
||||
|
||||
#if SDL_VIDEO_RENDER_RESIZE
|
||||
realW = window->display->current_mode.w;
|
||||
realH = window->display->current_mode.h;
|
||||
realW = window->display->desktop_mode.w;
|
||||
realH = window->display->desktop_mode.h;
|
||||
fakeW = window->w;
|
||||
fakeH = window->h;
|
||||
//if( fakeW > realW || fakeH > realH )
|
||||
@@ -2755,6 +2758,7 @@ SDL_RenderCopy(SDL_Texture * texture, const SDL_Rect * srcrect,
|
||||
real_dstrect.y = real_dstrect.y * realH / fakeH;
|
||||
real_dstrect.w -= real_dstrect.x;
|
||||
real_dstrect.h -= real_dstrect.y;
|
||||
//__android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_RenderCopy dest %d:%d+%d+%d desktop_mode %d:%d", (int)real_dstrect.x, (int)real_dstrect.y, (int)real_dstrect.w, (int)real_dstrect.h, (int)realW, (int)realH);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user