Skip to content

Commit 0aefe48

Browse files
sharkwouterfjtrujy
authored andcommitted
Fix build errors and warnings
1 parent e8d7fad commit 0aefe48

File tree

1 file changed

+29
-19
lines changed

1 file changed

+29
-19
lines changed

src/render/psp/SDL_render_psp.c

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ typedef struct
5454

5555
typedef struct
5656
{
57-
void *data; /**< Image data. */
58-
void *swizzledData; /**< Swizzled image data. */
57+
void *data; /**< Image data. */
58+
void *swizzledData; /**< Swizzled image data. */
5959
uint32_t textureWidth; /**< Texture width (power of two). */
6060
uint32_t textureHeight; /**< Texture height (power of two). */
6161
uint32_t width; /**< Image width. */
@@ -66,9 +66,9 @@ typedef struct
6666
uint32_t swizzledPitch; /**< Swizzled image pitch. */
6767
uint32_t size; /**< Image size in bytes. */
6868
uint32_t swizzledSize; /**< Swizzled image size in bytes. */
69-
uint8_t format; /**< Image format - one of ::pgePixelFormat. */
70-
uint8_t filter; /**< Image filter - one of GU_NEAREST or GU_LINEAR. */
71-
uint8_t swizzled; /**< Whether the image is swizzled or not. */
69+
uint8_t format; /**< Image format - one of ::pgePixelFormat. */
70+
uint8_t filter; /**< Image filter - one of GU_NEAREST or GU_LINEAR. */
71+
uint8_t swizzled; /**< Whether the image is swizzled or not. */
7272

7373
} PSP_Texture;
7474

@@ -263,22 +263,30 @@ static inline void fillSingleSliceVertices(VertTV *vertices, const SDL_Rect *src
263263
static inline void fillSpriteVertices(VertTV *vertices, SliceSize *dimensions, SliceSize *sliceSize,
264264
const SDL_Rect *srcrect, const SDL_FRect *dstrect)
265265
{
266+
267+
int i, j;
268+
int remainingWidth, remainingHeight;
269+
int hasRemainingWidth, hasRemainingHeight;
270+
float srcrectRateWidth, srcrectRateHeight;
271+
float srcWidth, srcHeight;
272+
float remainingSrcWidth, remainingSrcHeight;
273+
266274
// For avoiding division by zero
267275
if (dimensions->width == 1 && dimensions->height == 1) {
268-
fillSingleSliceVertices((VertV *)vertices, srcrect, dstrect);
276+
fillSingleSliceVertices(vertices, srcrect, dstrect);
269277
return;
270278
}
271-
int i, j;
272-
int remainingWidth = (int)dstrect->w % sliceSize->width;
273-
int remainingHeight = (int)dstrect->h % sliceSize->height;
274-
int hasRemainingWidth = remainingWidth > 0;
275-
int hasRemainingHeight = remainingHeight > 0;
276-
float srcrectRateWidth = (float)(abs(srcrect->w - dimensions->width)) / (float)(abs(dstrect->w - dimensions->width));
277-
float srcrectRateHeight = (float)(abs(srcrect->h - dimensions->height)) / (float)(abs(dstrect->h - dimensions->height));
278-
float srcWidth = sliceSize->width * srcrectRateWidth;
279-
float srcHeight = sliceSize->height * srcrectRateHeight;
280-
float remainingSrcWidth = remainingWidth * srcrectRateWidth;
281-
float remainingSrcHeight = remainingHeight * srcrectRateHeight;
279+
280+
remainingWidth = (int)dstrect->w % sliceSize->width;
281+
remainingHeight = (int)dstrect->h % sliceSize->height;
282+
hasRemainingWidth = remainingWidth > 0;
283+
hasRemainingHeight = remainingHeight > 0;
284+
srcrectRateWidth = (float)(abs(srcrect->w - dimensions->width)) / (float)(abs(dstrect->w - dimensions->width));
285+
srcrectRateHeight = (float)(abs(srcrect->h - dimensions->height)) / (float)(abs(dstrect->h - dimensions->height));
286+
srcWidth = sliceSize->width * srcrectRateWidth;
287+
srcHeight = sliceSize->height * srcrectRateHeight;
288+
remainingSrcWidth = remainingWidth * srcrectRateWidth;
289+
remainingSrcHeight = remainingHeight * srcrectRateHeight;
282290

283291
for (i = 0; i < dimensions->width; i++) {
284292
for (j = 0; j < dimensions->height; j++) {
@@ -824,7 +832,8 @@ static inline int PSP_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL
824832
PSP_SetBlendMode(data, blendInfo);
825833

826834
if (texture) {
827-
uint32_t tbw, twp;
835+
uint32_t tbw;
836+
void *twp;
828837
const VertTCV *verts = (VertTCV *)(vertices + cmd->data.draw.first);
829838

830839
PSP_Texture *psp_tex = (PSP_Texture *)texture->driverdata;
@@ -899,7 +908,8 @@ static inline int PSP_RenderPoints(SDL_Renderer *renderer, void *vertices, SDL_R
899908

900909
static inline int PSP_RenderCopy(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cmd)
901910
{
902-
uint32_t tbw, twp;
911+
uint32_t tbw;
912+
void *twp;
903913
PSP_RenderData *data = (PSP_RenderData *)renderer->driverdata;
904914
SDL_Texture *texture = cmd->data.draw.texture;
905915
PSP_Texture *psp_tex = (PSP_Texture *)texture->driverdata;

0 commit comments

Comments
 (0)