mirror of https://github.com/encounter/SDL.git
Fix C89 build errors in Windows builds
This commit is contained in:
parent
0cca71a846
commit
c8eea02071
|
@ -1079,7 +1079,13 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
|
|
||||||
if (data->drawstate.viewport_dirty) {
|
if (data->drawstate.viewport_dirty) {
|
||||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||||
const D3DVIEWPORT9 d3dviewport = { viewport->x, viewport->y, viewport->w, viewport->h, 0.0f, 1.0f };
|
D3DVIEWPORT9 d3dviewport;
|
||||||
|
d3dviewport.X = viewport->x;
|
||||||
|
d3dviewport.Y = viewport->y;
|
||||||
|
d3dviewport.Width = viewport->w;
|
||||||
|
d3dviewport.Height = viewport->h;
|
||||||
|
d3dviewport.MinZ = 0.0f;
|
||||||
|
d3dviewport.MaxZ = 1.0f;
|
||||||
IDirect3DDevice9_SetViewport(data->device, &d3dviewport);
|
IDirect3DDevice9_SetViewport(data->device, &d3dviewport);
|
||||||
|
|
||||||
/* Set an orthographic projection matrix */
|
/* Set an orthographic projection matrix */
|
||||||
|
@ -1106,7 +1112,11 @@ SetDrawState(D3D_RenderData *data, const SDL_RenderCommand *cmd)
|
||||||
if (data->drawstate.cliprect_dirty) {
|
if (data->drawstate.cliprect_dirty) {
|
||||||
const SDL_Rect *viewport = &data->drawstate.viewport;
|
const SDL_Rect *viewport = &data->drawstate.viewport;
|
||||||
const SDL_Rect *rect = &data->drawstate.cliprect;
|
const SDL_Rect *rect = &data->drawstate.cliprect;
|
||||||
const RECT d3drect = { viewport->x + rect->x, viewport->y + rect->y, viewport->x + rect->x + rect->w, viewport->y + rect->y + rect->h };
|
RECT d3drect;
|
||||||
|
d3drect.left = viewport->x + rect->x;
|
||||||
|
d3drect.top = viewport->y + rect->y;
|
||||||
|
d3drect.right = viewport->x + rect->x + rect->w;
|
||||||
|
d3drect.bottom = viewport->y + rect->y + rect->h;
|
||||||
IDirect3DDevice9_SetScissorRect(data->device, &d3drect);
|
IDirect3DDevice9_SetScissorRect(data->device, &d3drect);
|
||||||
data->drawstate.cliprect_dirty = SDL_FALSE;
|
data->drawstate.cliprect_dirty = SDL_FALSE;
|
||||||
}
|
}
|
||||||
|
@ -1221,7 +1231,9 @@ D3D_RunCommandQueue(SDL_Renderer * renderer, SDL_RenderCommand *cmd, void *verti
|
||||||
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
|
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
|
||||||
} else {
|
} else {
|
||||||
/* Clear is defined to clear the entire render target */
|
/* Clear is defined to clear the entire render target */
|
||||||
const D3DVIEWPORT9 wholeviewport = { 0, 0, backw, backh, 0.0f, 1.0f };
|
D3DVIEWPORT9 wholeviewport = { 0, 0, 0, 0, 0.0f, 1.0f };
|
||||||
|
wholeviewport.Width = backw;
|
||||||
|
wholeviewport.Height = backh;
|
||||||
IDirect3DDevice9_SetViewport(data->device, &wholeviewport);
|
IDirect3DDevice9_SetViewport(data->device, &wholeviewport);
|
||||||
data->drawstate.viewport_dirty = SDL_TRUE; /* we still need to (re)set orthographic projection, so always mark it dirty. */
|
data->drawstate.viewport_dirty = SDL_TRUE; /* we still need to (re)set orthographic projection, so always mark it dirty. */
|
||||||
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
|
IDirect3DDevice9_Clear(data->device, 0, NULL, D3DCLEAR_TARGET, color, 0.0f, 0);
|
||||||
|
|
|
@ -1250,10 +1250,12 @@ EGLSurface
|
||||||
SDL_EGL_CreateOffscreenSurface(_THIS, int width, int height)
|
SDL_EGL_CreateOffscreenSurface(_THIS, int width, int height)
|
||||||
{
|
{
|
||||||
EGLint attributes[] = {
|
EGLint attributes[] = {
|
||||||
EGL_WIDTH, width,
|
EGL_WIDTH, 0,
|
||||||
EGL_HEIGHT, height,
|
EGL_HEIGHT, 0,
|
||||||
EGL_NONE
|
EGL_NONE
|
||||||
};
|
};
|
||||||
|
attributes[1] = width;
|
||||||
|
attributes[3] = height;
|
||||||
|
|
||||||
if (SDL_EGL_ChooseConfig(_this) != 0) {
|
if (SDL_EGL_ChooseConfig(_this) != 0) {
|
||||||
return EGL_NO_SURFACE;
|
return EGL_NO_SURFACE;
|
||||||
|
|
|
@ -1371,10 +1371,15 @@ WIN_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
SDL_Window *window = data->window;
|
SDL_Window *window = data->window;
|
||||||
if (window->hit_test) {
|
if (window->hit_test) {
|
||||||
POINT winpoint = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) };
|
POINT winpoint;
|
||||||
|
winpoint.x = GET_X_LPARAM(lParam);
|
||||||
|
winpoint.y = GET_Y_LPARAM(lParam);
|
||||||
if (ScreenToClient(hwnd, &winpoint)) {
|
if (ScreenToClient(hwnd, &winpoint)) {
|
||||||
const SDL_Point point = { (int) winpoint.x, (int) winpoint.y };
|
SDL_Point point;
|
||||||
const SDL_HitTestResult rc = window->hit_test(window, &point, window->hit_test_data);
|
SDL_HitTestResult rc;
|
||||||
|
point.x = winpoint.x;
|
||||||
|
point.y = winpoint.y;
|
||||||
|
rc = window->hit_test(window, &point, window->hit_test_data);
|
||||||
switch (rc) {
|
switch (rc) {
|
||||||
#define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; }
|
#define POST_HIT_TEST(ret) { SDL_SendWindowEvent(data->window, SDL_WINDOWEVENT_HIT_TEST, 0, 0); return ret; }
|
||||||
case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION);
|
case SDL_HITTEST_DRAGGABLE: POST_HIT_TEST(HTCAPTION);
|
||||||
|
|
Loading…
Reference in New Issue