@@ -3869,9 +3869,6 @@ static bool SDL_RenderTextureInternal(SDL_Renderer *renderer, SDL_Texture *textu
3869
3869
3870
3870
bool SDL_RenderTexture (SDL_Renderer * renderer , SDL_Texture * texture , const SDL_FRect * srcrect , const SDL_FRect * dstrect )
3871
3871
{
3872
- SDL_FRect real_srcrect ;
3873
- SDL_FRect real_dstrect ;
3874
-
3875
3872
CHECK_RENDERER_MAGIC (renderer , false);
3876
3873
CHECK_TEXTURE_MAGIC (texture , false);
3877
3874
@@ -3886,6 +3883,7 @@ bool SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_F
3886
3883
}
3887
3884
#endif
3888
3885
3886
+ SDL_FRect real_srcrect ;
3889
3887
real_srcrect .x = 0.0f ;
3890
3888
real_srcrect .y = 0.0f ;
3891
3889
real_srcrect .w = (float )texture -> w ;
@@ -3896,9 +3894,10 @@ bool SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_F
3896
3894
}
3897
3895
}
3898
3896
3899
- GetRenderViewportSize (renderer , & real_dstrect );
3900
- if (dstrect ) {
3901
- real_dstrect = * dstrect ;
3897
+ SDL_FRect full_dstrect ;
3898
+ if (!dstrect ) {
3899
+ GetRenderViewportSize (renderer , & full_dstrect );
3900
+ dstrect = & full_dstrect ;
3902
3901
}
3903
3902
3904
3903
if (texture -> native ) {
@@ -3907,7 +3906,7 @@ bool SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_F
3907
3906
3908
3907
texture -> last_command_generation = renderer -> render_command_generation ;
3909
3908
3910
- return SDL_RenderTextureInternal (renderer , texture , & real_srcrect , & real_dstrect );
3909
+ return SDL_RenderTextureInternal (renderer , texture , & real_srcrect , dstrect );
3911
3910
}
3912
3911
3913
3912
bool SDL_RenderTextureAffine (SDL_Renderer * renderer , SDL_Texture * texture ,
@@ -4032,7 +4031,6 @@ bool SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
4032
4031
const double angle , const SDL_FPoint * center , const SDL_FlipMode flip )
4033
4032
{
4034
4033
SDL_FRect real_srcrect ;
4035
- SDL_FRect real_dstrect ;
4036
4034
SDL_FPoint real_center ;
4037
4035
bool result ;
4038
4036
@@ -4068,10 +4066,10 @@ bool SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
4068
4066
}
4069
4067
4070
4068
// We don't intersect the dstrect with the viewport as RenderCopy does because of potential rotation clipping issues... TODO: should we?
4071
- if ( dstrect ) {
4072
- real_dstrect = * dstrect ;
4073
- } else {
4074
- GetRenderViewportSize ( renderer , & real_dstrect ) ;
4069
+ SDL_FRect full_dstrect ;
4070
+ if (! dstrect ) {
4071
+ GetRenderViewportSize ( renderer , & full_dstrect );
4072
+ dstrect = & full_dstrect ;
4075
4073
}
4076
4074
4077
4075
if (texture -> native ) {
@@ -4081,8 +4079,8 @@ bool SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
4081
4079
if (center ) {
4082
4080
real_center = * center ;
4083
4081
} else {
4084
- real_center .x = real_dstrect . w / 2.0f ;
4085
- real_center .y = real_dstrect . h / 2.0f ;
4082
+ real_center .x = dstrect -> w / 2.0f ;
4083
+ real_center .y = dstrect -> h / 2.0f ;
4086
4084
}
4087
4085
4088
4086
texture -> last_command_generation = renderer -> render_command_generation ;
@@ -4116,23 +4114,23 @@ bool SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
4116
4114
maxu = (real_srcrect .x + real_srcrect .w ) / texture -> w ;
4117
4115
maxv = (real_srcrect .y + real_srcrect .h ) / texture -> h ;
4118
4116
4119
- centerx = real_center .x + real_dstrect . x ;
4120
- centery = real_center .y + real_dstrect . y ;
4117
+ centerx = real_center .x + dstrect -> x ;
4118
+ centery = real_center .y + dstrect -> y ;
4121
4119
4122
4120
if (flip & SDL_FLIP_HORIZONTAL ) {
4123
- minx = real_dstrect . x + real_dstrect . w ;
4124
- maxx = real_dstrect . x ;
4121
+ minx = dstrect -> x + dstrect -> w ;
4122
+ maxx = dstrect -> x ;
4125
4123
} else {
4126
- minx = real_dstrect . x ;
4127
- maxx = real_dstrect . x + real_dstrect . w ;
4124
+ minx = dstrect -> x ;
4125
+ maxx = dstrect -> x + dstrect -> w ;
4128
4126
}
4129
4127
4130
4128
if (flip & SDL_FLIP_VERTICAL ) {
4131
- miny = real_dstrect . y + real_dstrect . h ;
4132
- maxy = real_dstrect . y ;
4129
+ miny = dstrect -> y + dstrect -> h ;
4130
+ maxy = dstrect -> y ;
4133
4131
} else {
4134
- miny = real_dstrect . y ;
4135
- maxy = real_dstrect . y + real_dstrect . h ;
4132
+ miny = dstrect -> y ;
4133
+ maxy = dstrect -> y + dstrect -> h ;
4136
4134
}
4137
4135
4138
4136
uv [0 ] = minu ;
@@ -4173,7 +4171,7 @@ bool SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
4173
4171
num_vertices , indices , num_indices , size_indices ,
4174
4172
scale_x , scale_y , SDL_TEXTURE_ADDRESS_CLAMP );
4175
4173
} else {
4176
- result = QueueCmdCopyEx (renderer , texture , & real_srcrect , & real_dstrect , angle , & real_center , flip , scale_x , scale_y );
4174
+ result = QueueCmdCopyEx (renderer , texture , & real_srcrect , dstrect , angle , & real_center , flip , scale_x , scale_y );
4177
4175
}
4178
4176
return result ;
4179
4177
}
0 commit comments