Clean up PSP render code to fit C standard used better
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
diff --git a/src/render/psp/SDL_render_psp.c b/src/render/psp/SDL_render_psp.c
index 05d52e7..4b7d004 100644
--- a/src/render/psp/SDL_render_psp.c
+++ b/src/render/psp/SDL_render_psp.c
@@ -210,6 +210,7 @@ TextureSwizzle(PSP_TextureData *psp_texture)
{
int bytewidth, height;
int rowblocks, rowblocksadd;
+ int i, j;
unsigned int blockaddress = 0;
unsigned int *src = NULL;
unsigned char *data = NULL;
@@ -227,13 +228,13 @@ TextureSwizzle(PSP_TextureData *psp_texture)
data = SDL_malloc(psp_texture->size);
- for(int j = 0; j < height; j++, blockaddress += 16)
+ for(j = 0; j < height; j++, blockaddress += 16)
{
unsigned int *block;
block = (unsigned int*)&data[blockaddress];
- for(int i = 0; i < rowblocks; i++)
+ for(i = 0; i < rowblocks; i++)
{
*block++ = *src++;
*block++ = *src++;
@@ -257,6 +258,8 @@ int TextureUnswizzle(PSP_TextureData *psp_texture)
int bytewidth, height;
int widthblocks, heightblocks;
int dstpitch, dstrow;
+ int blockx, blocky;
+ int j;
unsigned int *src = NULL;
unsigned char *data = NULL;
unsigned char *ydst = NULL;
@@ -284,17 +287,17 @@ int TextureUnswizzle(PSP_TextureData *psp_texture)
ydst = (unsigned char *)data;
- for(int blocky = 0; blocky < heightblocks; ++blocky)
+ for(blocky = 0; blocky < heightblocks; ++blocky)
{
unsigned char *xdst = ydst;
- for(int blockx = 0; blockx < widthblocks; ++blockx)
+ for(blockx = 0; blockx < widthblocks; ++blockx)
{
unsigned int *block;
block = (unsigned int*)xdst;
- for(int j = 0; j < 8; ++j)
+ for(j = 0; j < 8; ++j)
{
*(block++) = *(src++);
*(block++) = *(src++);
@@ -702,16 +705,14 @@ PSP_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * t
const float width = dstrect->w - centerx;
const float height = dstrect->h - centery;
float s, c;
+ float cw, sw, ch, sh;
float u0 = srcrect->x;
float v0 = srcrect->y;
float u1 = srcrect->x + srcrect->w;
float v1 = srcrect->y + srcrect->h;
- const float cw = c * width;
- const float sw = s * width;
- const float ch = c * height;
- const float sh = s * height;
+
if (!verts) {
return -1;
@@ -721,6 +722,11 @@ PSP_QueueCopyEx(SDL_Renderer * renderer, SDL_RenderCommand *cmd, SDL_Texture * t
MathSincos(degToRad(angle), &s, &c);
+ float cw = c * width;
+ float sw = s * width;
+ float ch = c * height;
+ float sh = s * height;
+
if (flip & SDL_FLIP_VERTICAL) {
Swap(&v0, &v1);
}