@@ -54,8 +54,8 @@ typedef struct
54
54
55
55
typedef struct
56
56
{
57
- void * data ; /**< Image data. */
58
- void * swizzledData ; /**< Swizzled image data. */
57
+ void * data ; /**< Image data. */
58
+ void * swizzledData ; /**< Swizzled image data. */
59
59
uint32_t textureWidth ; /**< Texture width (power of two). */
60
60
uint32_t textureHeight ; /**< Texture height (power of two). */
61
61
uint32_t width ; /**< Image width. */
@@ -66,9 +66,9 @@ typedef struct
66
66
uint32_t swizzledPitch ; /**< Swizzled image pitch. */
67
67
uint32_t size ; /**< Image size in bytes. */
68
68
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. */
72
72
73
73
} PSP_Texture ;
74
74
@@ -263,22 +263,30 @@ static inline void fillSingleSliceVertices(VertTV *vertices, const SDL_Rect *src
263
263
static inline void fillSpriteVertices (VertTV * vertices , SliceSize * dimensions , SliceSize * sliceSize ,
264
264
const SDL_Rect * srcrect , const SDL_FRect * dstrect )
265
265
{
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
+
266
274
// For avoiding division by zero
267
275
if (dimensions -> width == 1 && dimensions -> height == 1 ) {
268
- fillSingleSliceVertices (( VertV * ) vertices , srcrect , dstrect );
276
+ fillSingleSliceVertices (vertices , srcrect , dstrect );
269
277
return ;
270
278
}
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 ;
282
290
283
291
for (i = 0 ; i < dimensions -> width ; i ++ ) {
284
292
for (j = 0 ; j < dimensions -> height ; j ++ ) {
@@ -824,7 +832,8 @@ static inline int PSP_RenderGeometry(SDL_Renderer *renderer, void *vertices, SDL
824
832
PSP_SetBlendMode (data , blendInfo );
825
833
826
834
if (texture ) {
827
- uint32_t tbw , twp ;
835
+ uint32_t tbw ;
836
+ void * twp ;
828
837
const VertTCV * verts = (VertTCV * )(vertices + cmd -> data .draw .first );
829
838
830
839
PSP_Texture * psp_tex = (PSP_Texture * )texture -> driverdata ;
@@ -899,7 +908,8 @@ static inline int PSP_RenderPoints(SDL_Renderer *renderer, void *vertices, SDL_R
899
908
900
909
static inline int PSP_RenderCopy (SDL_Renderer * renderer , void * vertices , SDL_RenderCommand * cmd )
901
910
{
902
- uint32_t tbw , twp ;
911
+ uint32_t tbw ;
912
+ void * twp ;
903
913
PSP_RenderData * data = (PSP_RenderData * )renderer -> driverdata ;
904
914
SDL_Texture * texture = cmd -> data .draw .texture ;
905
915
PSP_Texture * psp_tex = (PSP_Texture * )texture -> driverdata ;
0 commit comments