Fix declaration-after-statement and remove tabs

This commit is contained in:
Sylvain 2021-04-01 11:47:45 +02:00 committed by Sylvain Becker
parent cd4663dfcb
commit cd0663e053
5 changed files with 44 additions and 37 deletions

View File

@ -1883,21 +1883,20 @@ D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
int j; int j;
float *xy_;
SDL_Color col_;
if (size_indice == 4) { if (size_indice == 4) {
j = ((const Uint32 *)indices)[i]; j = ((const Uint32 *)indices)[i];
} } else if (size_indice == 2) {
else if (size_indice == 2) {
j = ((const Uint16 *)indices)[i]; j = ((const Uint16 *)indices)[i];
} } else if (size_indice == 1) {
else if (size_indice == 1) {
j = ((const Uint8 *)indices)[i]; j = ((const Uint8 *)indices)[i];
} } else {
else {
j = i; j = i;
} }
float *xy_ = (float *)((char*)xy + j * xy_stride); xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride); col_ = *(SDL_Color *)((char*)color + j * color_stride);
verts->pos.x = xy_[0] * scale_x; verts->pos.x = xy_[0] * scale_x;
verts->pos.y = xy_[1] * scale_y; verts->pos.y = xy_[1] * scale_y;

View File

@ -21,7 +21,6 @@
#include "../../SDL_internal.h" #include "../../SDL_internal.h"
#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED #if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED
#include "SDL_hints.h" #include "SDL_hints.h"
#include "SDL_opengl.h" #include "SDL_opengl.h"
#include "../SDL_sysrender.h" #include "../SDL_sysrender.h"
@ -1077,6 +1076,8 @@ GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
int j; int j;
float *xy_;
SDL_Color col_;
if (size_indice == 4) { if (size_indice == 4) {
j = ((const Uint32 *)indices)[i]; j = ((const Uint32 *)indices)[i];
} else if (size_indice == 2) { } else if (size_indice == 2) {
@ -1087,8 +1088,8 @@ GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
j = i; j = i;
} }
float *xy_ = (float *)((char*)xy + j * xy_stride); xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride); col_ = *(SDL_Color *)((char*)color + j * color_stride);
*(verts++) = xy_[0] * scale_x; *(verts++) = xy_[0] * scale_x;
*(verts++) = xy_[1] * scale_y; *(verts++) = xy_[1] * scale_y;

View File

@ -979,6 +979,8 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
int j; int j;
float *xy_;
SDL_Color col_;
if (size_indice == 4) { if (size_indice == 4) {
j = ((const Uint32 *)indices)[i]; j = ((const Uint32 *)indices)[i];
} else if (size_indice == 2) { } else if (size_indice == 2) {
@ -989,8 +991,8 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
j = i; j = i;
} }
float *xy_ = (float *)((char*)xy + j * xy_stride); xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride); col_ = *(SDL_Color *)((char*)color + j * color_stride);
*(verts++) = xy_[0] * scale_x; *(verts++) = xy_[0] * scale_x;
*(verts++) = xy_[1] * scale_y; *(verts++) = xy_[1] * scale_y;

View File

@ -597,6 +597,9 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
GeometryCopyData *ptr = (GeometryCopyData *) verts; GeometryCopyData *ptr = (GeometryCopyData *) verts;
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
int j; int j;
float *xy_;
SDL_Color col_;
float *uv_;
if (size_indice == 4) { if (size_indice == 4) {
j = ((const Uint32 *)indices)[i]; j = ((const Uint32 *)indices)[i];
} else if (size_indice == 2) { } else if (size_indice == 2) {
@ -607,10 +610,10 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
j = i; j = i;
} }
float *xy_ = (float *)((char*)xy + j * xy_stride); xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride); col_ = *(SDL_Color *)((char*)color + j * color_stride);
float *uv_ = (float *)((char*)uv + j * uv_stride); uv_ = (float *)((char*)uv + j * uv_stride);
ptr->src.x = uv_[0] * texture->w; ptr->src.x = uv_[0] * texture->w;
ptr->src.y = uv_[1] * texture->h; ptr->src.y = uv_[1] * texture->h;
@ -628,6 +631,8 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
int j; int j;
float *xy_;
SDL_Color col_;
if (size_indice == 4) { if (size_indice == 4) {
j = ((const Uint32 *)indices)[i]; j = ((const Uint32 *)indices)[i];
} else if (size_indice == 2) { } else if (size_indice == 2) {
@ -638,8 +643,8 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
j = i; j = i;
} }
float *xy_ = (float *)((char*)xy + j * xy_stride); xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride); col_ = *(SDL_Color *)((char*)color + j * color_stride);
ptr->dst.x = xy_[0] * scale_x + renderer->viewport.x; ptr->dst.x = xy_[0] * scale_x + renderer->viewport.x;
ptr->dst.y = xy_[1] * scale_y + renderer->viewport.y; ptr->dst.y = xy_[1] * scale_y + renderer->viewport.y;