Skip to content

Commit

Permalink
Fix declaration-after-statement and remove tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
1bsyl committed Aug 18, 2021
1 parent cd4663d commit cd0663e
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 38 deletions.
16 changes: 8 additions & 8 deletions src/render/SDL_render.c
Original file line number Diff line number Diff line change
Expand Up @@ -3356,7 +3356,7 @@ remap_one_indice(
SDL_Texture *texture,
const float *xy, int xy_stride,
const int *color, int color_stride,
const float *uv, int uv_stride)
const float *uv, int uv_stride)
{
const float *xy0_, *xy1_, *uv0_, *uv1_;
int col0_, col1_;
Expand Down Expand Up @@ -3429,7 +3429,7 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
int texw = 0, texh = 0;

if (texture) {
SDL_QueryTexture(texture, NULL, NULL, &texw, &texh);
SDL_QueryTexture(texture, NULL, NULL, &texw, &texh);
}

prev[0] = -1; prev[1] = -1; prev[2] = -1;
Expand Down Expand Up @@ -3468,7 +3468,7 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
prev[0] = k0;
prev[1] = k1;
prev[2] = k2;
continue;
continue;
}

/* Two triangles forming a quadialateral,
Expand Down Expand Up @@ -3551,7 +3551,7 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
x1 = xy1_[0]; y1 = xy1_[1];
x2 = xy2_[0]; y2 = xy2_[1];

/* Check if triangle A B C is rectangle */
/* Check if triangle A B C is rectangle */
if ((x0 == x2 && y1 == y2) || (y0 == y2 && x1 == x2)){
/* ok */
} else {
Expand All @@ -3562,7 +3562,7 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
xy2_ = (const float *)((const char*)xy + C2 * xy_stride);
x2 = xy2_[0]; y2 = xy2_[1];

/* Check if triangle A B C2 is rectangle */
/* Check if triangle A B C2 is rectangle */
if ((x0 == x2 && y1 == y2) || (y0 == y2 && x1 == x2)){
/* ok */
} else {
Expand Down Expand Up @@ -3616,7 +3616,7 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
SDL_RenderCopyF(renderer, texture, &s, &d);

if (debug) {
SDL_Log("Rect-COPY: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a,
SDL_Log("Rect-COPY: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a,
(void *)texture, s.x, s.y, s.w, s.h, d.x, d.y, d.w, d.h);
}
} else if (d.w != 0.0f && d.h != 0.0f) { /* Rect, no texture */
Expand All @@ -3625,12 +3625,12 @@ SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
SDL_RenderFillRectF(renderer, &d);

if (debug) {
SDL_Log("Rect-FILL: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a,
SDL_Log("Rect-FILL: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a,
(void *)texture, s.x, s.y, s.w, s.h, d.x, d.y, d.w, d.h);
}
} else {
if (debug) {
SDL_Log("Rect-DISMISS: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a,
SDL_Log("Rect-DISMISS: RGB %d %d %d - Alpha:%d - texture=%p: src=(%d,%d, %d x %d) dst (%f, %f, %f x %f)", col0_.r, col0_.g, col0_.b, col0_.a,
(void *)texture, s.x, s.y, s.w, s.h, d.x, d.y, d.w, d.h);
}
}
Expand Down
39 changes: 19 additions & 20 deletions src/render/direct3d11/SDL_render_d3d11.c
Original file line number Diff line number Diff line change
Expand Up @@ -1867,9 +1867,9 @@ D3D11_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture *

static int
D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
int num_vertices, const void *indices, int num_indices, int size_indice,
float scale_x, float scale_y)
const float *xy, int xy_stride, const int *color, int color_stride, const float *uv, int uv_stride,
int num_vertices, const void *indices, int num_indices, int size_indice,
float scale_x, float scale_y)
{
int i;
int count = indices ? num_indices : num_vertices;
Expand All @@ -1882,22 +1882,21 @@ D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
cmd->data.draw.count = count;

for (i = 0; i < count; i++) {
int j;
if (size_indice == 4) {
j = ((const Uint32 *)indices)[i];
}
else if (size_indice == 2) {
j = ((const Uint16 *)indices)[i];
}
else if (size_indice == 1) {
j = ((const Uint8 *)indices)[i];
}
else {
j = i;
}

float *xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride);
int j;
float *xy_;
SDL_Color col_;
if (size_indice == 4) {
j = ((const Uint32 *)indices)[i];
} else if (size_indice == 2) {
j = ((const Uint16 *)indices)[i];
} else if (size_indice == 1) {
j = ((const Uint8 *)indices)[i];
} else {
j = i;
}

xy_ = (float *)((char*)xy + j * xy_stride);
col_ = *(SDL_Color *)((char*)color + j * color_stride);

verts->pos.x = xy_[0] * scale_x;
verts->pos.y = xy_[1] * scale_y;
Expand All @@ -1908,7 +1907,7 @@ D3D11_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
verts->color.w = col_.a / 255.0f;

if (texture) {
float *uv_ = (float *)((char*)uv + j * uv_stride);
float *uv_ = (float *)((char*)uv + j * uv_stride);
verts->tex.x = uv_[0];
verts->tex.y = uv_[1];
} else {
Expand Down
7 changes: 4 additions & 3 deletions src/render/opengl/SDL_render_gl.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include "../../SDL_internal.h"

#if SDL_VIDEO_RENDER_OGL && !SDL_RENDER_DISABLED

#include "SDL_hints.h"
#include "SDL_opengl.h"
#include "../SDL_sysrender.h"
Expand Down Expand Up @@ -1077,6 +1076,8 @@ GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te

for (i = 0; i < count; i++) {
int j;
float *xy_;
SDL_Color col_;
if (size_indice == 4) {
j = ((const Uint32 *)indices)[i];
} else if (size_indice == 2) {
Expand All @@ -1087,8 +1088,8 @@ GL_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
j = i;
}

float *xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride);
xy_ = (float *)((char*)xy + j * xy_stride);
col_ = *(SDL_Color *)((char*)color + j * color_stride);

*(verts++) = xy_[0] * scale_x;
*(verts++) = xy_[1] * scale_y;
Expand Down
6 changes: 4 additions & 2 deletions src/render/opengles2/SDL_render_gles2.c
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,8 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture

for (i = 0; i < count; i++) {
int j;
float *xy_;
SDL_Color col_;
if (size_indice == 4) {
j = ((const Uint32 *)indices)[i];
} else if (size_indice == 2) {
Expand All @@ -989,8 +991,8 @@ GLES2_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture
j = i;
}

float *xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride);
xy_ = (float *)((char*)xy + j * xy_stride);
col_ = *(SDL_Color *)((char*)color + j * color_stride);

*(verts++) = xy_[0] * scale_x;
*(verts++) = xy_[1] * scale_y;
Expand Down
15 changes: 10 additions & 5 deletions src/render/software/SDL_render_sw.c
Original file line number Diff line number Diff line change
Expand Up @@ -597,6 +597,9 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
GeometryCopyData *ptr = (GeometryCopyData *) verts;
for (i = 0; i < count; i++) {
int j;
float *xy_;
SDL_Color col_;
float *uv_;
if (size_indice == 4) {
j = ((const Uint32 *)indices)[i];
} else if (size_indice == 2) {
Expand All @@ -607,10 +610,10 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
j = i;
}

float *xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride);
xy_ = (float *)((char*)xy + j * xy_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.y = uv_[1] * texture->h;
Expand All @@ -628,6 +631,8 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te

for (i = 0; i < count; i++) {
int j;
float *xy_;
SDL_Color col_;
if (size_indice == 4) {
j = ((const Uint32 *)indices)[i];
} else if (size_indice == 2) {
Expand All @@ -638,8 +643,8 @@ SW_QueueGeometry(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *te
j = i;
}

float *xy_ = (float *)((char*)xy + j * xy_stride);
SDL_Color col_ = *(SDL_Color *)((char*)color + j * color_stride);
xy_ = (float *)((char*)xy + j * xy_stride);
col_ = *(SDL_Color *)((char*)color + j * color_stride);

ptr->dst.x = xy_[0] * scale_x + renderer->viewport.x;
ptr->dst.y = xy_[1] * scale_y + renderer->viewport.y;
Expand Down

0 comments on commit cd0663e

Please sign in to comment.