@@ -545,39 +545,23 @@ static int PSP_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Tex
545
545
const float u1 = srcrect -> x + srcrect -> w ;
546
546
const float v1 = srcrect -> y + srcrect -> h ;
547
547
548
- // We need to split in slices because we have a texture bigger than 64 pixel width
549
- if (texture ) {
550
- SliceSize sliceSize , sliceDimension , uvSize ;
551
- uvSize .width = abs (u1 - u0 );
552
- uvSize .height = abs (v1 - v0 );
553
- if (calculateBestSliceSizeForTexture (texture , & uvSize , & sliceSize , & sliceDimension ))
554
- return -1 ;
555
-
556
- verticesCount = sliceDimension .width * sliceDimension .height * 2 ;
557
- verts = (VertTV * )SDL_AllocateRenderVertices (renderer , verticesCount * sizeof (VertTV ), 4 , & cmd -> data .draw .first );
558
- if (verts == NULL )
559
- return -1 ;
560
-
561
- fillSpriteVertices (verts , & sliceDimension , & sliceSize , srcrect , dstrect );
562
- } else {
563
- // We don't need to split in slices because we don't have a texture
564
- verticesCount = 2 ;
565
- verts = (VertTV * )SDL_AllocateRenderVertices (renderer , verticesCount * sizeof (VertTV ), 4 , & cmd -> data .draw .first );
566
- if (verts == NULL )
567
- return -1 ;
548
+ SliceSize sliceSize , sliceDimension , uvSize ;
568
549
569
- verts [0 ].u = u0 ;
570
- verts [0 ].v = v0 ;
571
- verts [0 ].x = x ;
572
- verts [0 ].y = y ;
573
- verts [0 ].z = 0 ;
574
-
575
- verts [1 ].u = u1 ;
576
- verts [1 ].v = v1 ;
577
- verts [1 ].x = x + width ;
578
- verts [1 ].y = y + height ;
579
- verts [1 ].z = 0 ;
580
- }
550
+ // In this function texture must be created
551
+ if (!texture )
552
+ return -1 ;
553
+
554
+ uvSize .width = abs (u1 - u0 );
555
+ uvSize .height = abs (v1 - v0 );
556
+ if (calculateBestSliceSizeForTexture (texture , & uvSize , & sliceSize , & sliceDimension ))
557
+ return -1 ;
558
+
559
+ verticesCount = sliceDimension .width * sliceDimension .height * 2 ;
560
+ verts = (VertTV * )SDL_AllocateRenderVertices (renderer , verticesCount * sizeof (VertTV ), 4 , & cmd -> data .draw .first );
561
+ if (verts == NULL )
562
+ return -1 ;
563
+
564
+ fillSpriteVertices (verts , & sliceDimension , & sliceSize , srcrect , dstrect );
581
565
582
566
cmd -> data .draw .count = verticesCount ;
583
567
@@ -788,18 +772,14 @@ int PSP_RenderCopy(SDL_Renderer *renderer, void *vertices, SDL_RenderCommand *cm
788
772
789
773
PSP_SetBlendMode (data , blendInfo );
790
774
791
- if (cmd -> data .draw .texture ) {
792
- PSP_Texture * psp_tex = (PSP_Texture * )cmd -> data .draw .texture -> driverdata ;
775
+ PSP_Texture * psp_tex = (PSP_Texture * )cmd -> data .draw .texture -> driverdata ;
793
776
794
- sceGuTexMode (psp_tex -> format , 0 , 0 , GU_FALSE );
795
- sceGuTexImage (0 , psp_tex -> textureWidth , psp_tex -> textureHeight , psp_tex -> width , psp_tex -> data );
796
- sceGuTexFilter (psp_tex -> filter , psp_tex -> filter );
797
- sceGuEnable (GU_TEXTURE_2D );
798
- sceGuDrawArray (GU_SPRITES , GU_TEXTURE_32BITF | GU_VERTEX_32BITF | GU_TRANSFORM_2D , count , 0 , verts );
799
- sceGuDisable (GU_TEXTURE_2D );
800
- } else {
801
- sceGuDrawArray (GU_SPRITES , GU_VERTEX_32BITF | GU_TRANSFORM_2D , count , 0 , verts );
802
- }
777
+ sceGuTexMode (psp_tex -> format , 0 , 0 , GU_FALSE );
778
+ sceGuTexImage (0 , psp_tex -> textureWidth , psp_tex -> textureHeight , psp_tex -> width , psp_tex -> data );
779
+ sceGuTexFilter (psp_tex -> filter , psp_tex -> filter );
780
+ sceGuEnable (GU_TEXTURE_2D );
781
+ sceGuDrawArray (GU_SPRITES , GU_TEXTURE_32BITF | GU_VERTEX_32BITF | GU_TRANSFORM_2D , count , 0 , verts );
782
+ sceGuDisable (GU_TEXTURE_2D );
803
783
804
784
return 0 ;
805
785
}
0 commit comments