|
@@ -599,7 +599,7 @@ static int QueueCmdFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, con
|
|
|
return retval;
|
|
|
}
|
|
|
|
|
|
-static int QueueCmdCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
|
|
|
+static int QueueCmdCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect)
|
|
|
{
|
|
|
SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_COPY, texture);
|
|
|
int retval = -1;
|
|
@@ -613,7 +613,7 @@ static int QueueCmdCopy(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_
|
|
|
}
|
|
|
|
|
|
static int QueueCmdCopyEx(SDL_Renderer *renderer, SDL_Texture *texture,
|
|
|
- const SDL_Rect *srcquad, const SDL_FRect *dstrect,
|
|
|
+ const SDL_FRect *srcquad, const SDL_FRect *dstrect,
|
|
|
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip, float scale_x, float scale_y)
|
|
|
{
|
|
|
SDL_RenderCommand *cmd = PrepQueueCmdDraw(renderer, SDL_RENDERCMD_COPY_EX, texture);
|
|
@@ -2150,10 +2150,10 @@ static int UpdateLogicalPresentation(SDL_Renderer *renderer)
|
|
|
real_aspect = (float)output_w / output_h;
|
|
|
}
|
|
|
|
|
|
- renderer->logical_src_rect.x = 0;
|
|
|
- renderer->logical_src_rect.y = 0;
|
|
|
- renderer->logical_src_rect.w = logical_w;
|
|
|
- renderer->logical_src_rect.h = logical_h;
|
|
|
+ renderer->logical_src_rect.x = 0.0f;
|
|
|
+ renderer->logical_src_rect.y = 0.0f;
|
|
|
+ renderer->logical_src_rect.w = (float)logical_w;
|
|
|
+ renderer->logical_src_rect.h = (float)logical_h;
|
|
|
|
|
|
if (renderer->logical_presentation_mode == SDL_LOGICAL_PRESENTATION_INTEGER_SCALE) {
|
|
|
if (want_aspect > real_aspect) {
|
|
@@ -2309,7 +2309,7 @@ int SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, floa
|
|
|
|
|
|
/* Convert from pixels within the window to pixels within the view */
|
|
|
if (renderer->logical_target) {
|
|
|
- const SDL_Rect *src = &renderer->logical_src_rect;
|
|
|
+ const SDL_FRect *src = &renderer->logical_src_rect;
|
|
|
const SDL_FRect *dst = &renderer->logical_dst_rect;
|
|
|
render_x = ((render_x - dst->x) * src->w) / dst->w;
|
|
|
render_y = ((render_y - dst->y) * src->h) / dst->h;
|
|
@@ -2350,7 +2350,7 @@ int SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, floa
|
|
|
|
|
|
/* Convert from pixels within the view to pixels within the window */
|
|
|
if (renderer->logical_target) {
|
|
|
- const SDL_Rect *src = &renderer->logical_src_rect;
|
|
|
+ const SDL_FRect *src = &renderer->logical_src_rect;
|
|
|
const SDL_FRect *dst = &renderer->logical_dst_rect;
|
|
|
x = dst->x + ((x * dst->w) / src->w);
|
|
|
y = dst->y + ((y * dst->h) / src->h);
|
|
@@ -2386,7 +2386,7 @@ int SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event
|
|
|
|
|
|
/* Convert from pixels within the window to pixels within the view */
|
|
|
if (renderer->logical_target) {
|
|
|
- const SDL_Rect *src = &renderer->logical_src_rect;
|
|
|
+ const SDL_FRect *src = &renderer->logical_src_rect;
|
|
|
const SDL_FRect *dst = &renderer->logical_dst_rect;
|
|
|
scale = (scale * src->w) / dst->w;
|
|
|
}
|
|
@@ -2409,7 +2409,7 @@ int SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event
|
|
|
|
|
|
/* Convert from pixels within the window to pixels within the view */
|
|
|
if (renderer->logical_target) {
|
|
|
- const SDL_Rect *src = &renderer->logical_src_rect;
|
|
|
+ const SDL_FRect *src = &renderer->logical_src_rect;
|
|
|
const SDL_FRect *dst = &renderer->logical_dst_rect;
|
|
|
scale = (scale * src->h) / dst->h;
|
|
|
}
|
|
@@ -3129,9 +3129,9 @@ int SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int coun
|
|
|
return retval < 0 ? retval : FlushRenderCommandsIfNotBatching(renderer);
|
|
|
}
|
|
|
|
|
|
-int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Rect *srcrect, const SDL_FRect *dstrect)
|
|
|
+int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect)
|
|
|
{
|
|
|
- SDL_Rect real_srcrect;
|
|
|
+ SDL_FRect real_srcrect;
|
|
|
SDL_FRect real_dstrect;
|
|
|
int retval;
|
|
|
int use_rendergeometry;
|
|
@@ -3152,12 +3152,12 @@ int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Re
|
|
|
|
|
|
use_rendergeometry = (renderer->QueueCopy == NULL);
|
|
|
|
|
|
- real_srcrect.x = 0;
|
|
|
- real_srcrect.y = 0;
|
|
|
- real_srcrect.w = texture->w;
|
|
|
- real_srcrect.h = texture->h;
|
|
|
+ real_srcrect.x = 0.0f;
|
|
|
+ real_srcrect.y = 0.0f;
|
|
|
+ real_srcrect.w = (float)texture->w;
|
|
|
+ real_srcrect.h = (float)texture->h;
|
|
|
if (srcrect) {
|
|
|
- if (!SDL_GetRectIntersection(srcrect, &real_srcrect, &real_srcrect)) {
|
|
|
+ if (!SDL_GetRectIntersectionFloat(srcrect, &real_srcrect, &real_srcrect)) {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
@@ -3188,10 +3188,10 @@ int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Re
|
|
|
float minu, minv, maxu, maxv;
|
|
|
float minx, miny, maxx, maxy;
|
|
|
|
|
|
- minu = (float)(real_srcrect.x) / (float)texture->w;
|
|
|
- minv = (float)(real_srcrect.y) / (float)texture->h;
|
|
|
- maxu = (float)(real_srcrect.x + real_srcrect.w) / (float)texture->w;
|
|
|
- maxv = (float)(real_srcrect.y + real_srcrect.h) / (float)texture->h;
|
|
|
+ minu = real_srcrect.x / texture->w;
|
|
|
+ minv = real_srcrect.y / texture->h;
|
|
|
+ maxu = (real_srcrect.x + real_srcrect.w) / texture->w;
|
|
|
+ maxv = (real_srcrect.y + real_srcrect.h) / texture->h;
|
|
|
|
|
|
minx = real_dstrect.x;
|
|
|
miny = real_dstrect.y;
|
|
@@ -3235,10 +3235,10 @@ int SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Re
|
|
|
}
|
|
|
|
|
|
int SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
|
|
|
- const SDL_Rect *srcrect, const SDL_FRect *dstrect,
|
|
|
+ const SDL_FRect *srcrect, const SDL_FRect *dstrect,
|
|
|
const double angle, const SDL_FPoint *center, const SDL_RendererFlip flip)
|
|
|
{
|
|
|
- SDL_Rect real_srcrect;
|
|
|
+ SDL_FRect real_srcrect;
|
|
|
SDL_FRect real_dstrect;
|
|
|
SDL_FPoint real_center;
|
|
|
int retval;
|
|
@@ -3267,12 +3267,12 @@ int SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
|
|
|
|
|
|
use_rendergeometry = (renderer->QueueCopyEx == NULL);
|
|
|
|
|
|
- real_srcrect.x = 0;
|
|
|
- real_srcrect.y = 0;
|
|
|
- real_srcrect.w = texture->w;
|
|
|
- real_srcrect.h = texture->h;
|
|
|
+ real_srcrect.x = 0.0f;
|
|
|
+ real_srcrect.y = 0.0f;
|
|
|
+ real_srcrect.w = (float)texture->w;
|
|
|
+ real_srcrect.h = (float)texture->h;
|
|
|
if (srcrect) {
|
|
|
- if (!SDL_GetRectIntersection(srcrect, &real_srcrect, &real_srcrect)) {
|
|
|
+ if (!SDL_GetRectIntersectionFloat(srcrect, &real_srcrect, &real_srcrect)) {
|
|
|
return 0;
|
|
|
}
|
|
|
}
|
|
@@ -3317,10 +3317,10 @@ int SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
|
|
|
const float s = SDL_sinf(radian_angle);
|
|
|
const float c = SDL_cosf(radian_angle);
|
|
|
|
|
|
- minu = (float)(real_srcrect.x) / (float)texture->w;
|
|
|
- minv = (float)(real_srcrect.y) / (float)texture->h;
|
|
|
- maxu = (float)(real_srcrect.x + real_srcrect.w) / (float)texture->w;
|
|
|
- maxv = (float)(real_srcrect.y + real_srcrect.h) / (float)texture->h;
|
|
|
+ minu = real_srcrect.x / texture->w;
|
|
|
+ minv = real_srcrect.y / texture->h;
|
|
|
+ maxu = (real_srcrect.x + real_srcrect.w) / texture->w;
|
|
|
+ maxv = (real_srcrect.y + real_srcrect.h) / texture->h;
|
|
|
|
|
|
centerx = real_center.x + real_dstrect.x;
|
|
|
centery = real_center.y + real_dstrect.y;
|
|
@@ -3667,7 +3667,7 @@ static int SDLCALL SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
|
|
|
|
|
|
/* Start rendering rect */
|
|
|
if (is_quad) {
|
|
|
- SDL_Rect s;
|
|
|
+ SDL_FRect s;
|
|
|
SDL_FRect d;
|
|
|
const float *xy0_, *xy1_, *uv0_, *uv1_;
|
|
|
SDL_Color col0_ = *(const SDL_Color *)((const char *)color + k0 * color_stride);
|
|
@@ -3678,10 +3678,10 @@ static int SDLCALL SDL_SW_RenderGeometryRaw(SDL_Renderer *renderer,
|
|
|
if (texture) {
|
|
|
uv0_ = (const float *)((const char *)uv + A * uv_stride);
|
|
|
uv1_ = (const float *)((const char *)uv + B * uv_stride);
|
|
|
- s.x = (int)(uv0_[0] * texw);
|
|
|
- s.y = (int)(uv0_[1] * texh);
|
|
|
- s.w = (int)(uv1_[0] * texw - s.x);
|
|
|
- s.h = (int)(uv1_[1] * texh - s.y);
|
|
|
+ s.x = uv0_[0] * texw;
|
|
|
+ s.y = uv0_[1] * texh;
|
|
|
+ s.w = uv1_[0] * texw - s.x;
|
|
|
+ s.h = uv1_[1] * texh - s.y;
|
|
|
}
|
|
|
|
|
|
d.x = xy0_[0];
|