mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-16 01:38:27 +00:00
SDL_RenderTexture() and SDL_RenderTextureRotated() take floating point source coordinates
See the discussion at https://discourse.libsdl.org/t/sdl-rendercopyf-uses-ints/36732/8
This commit is contained in:
parent
199a7af296
commit
bd2e2ee7aa
9 changed files with 82 additions and 75 deletions
|
@ -227,7 +227,7 @@ static int SW_QueueFillRects(SDL_Renderer *renderer, SDL_RenderCommand *cmd, con
|
|||
}
|
||||
|
||||
static int SW_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Texture *texture,
|
||||
const SDL_Rect *srcrect, const SDL_FRect *dstrect)
|
||||
const SDL_FRect *srcrect, const SDL_FRect *dstrect)
|
||||
{
|
||||
SDL_Rect *verts = (SDL_Rect *)SDL_AllocateRenderVertices(renderer, 2 * sizeof(SDL_Rect), 0, &cmd->data.draw.first);
|
||||
|
||||
|
@ -237,7 +237,10 @@ static int SW_QueueCopy(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Text
|
|||
|
||||
cmd->data.draw.count = 1;
|
||||
|
||||
SDL_copyp(verts, srcrect);
|
||||
verts->x = (int)srcrect->x;
|
||||
verts->y = (int)srcrect->y;
|
||||
verts->w = (int)srcrect->w;
|
||||
verts->h = (int)srcrect->h;
|
||||
verts++;
|
||||
|
||||
verts->x = (int)dstrect->x;
|
||||
|
@ -260,7 +263,7 @@ typedef struct CopyExData
|
|||
} CopyExData;
|
||||
|
||||
static int SW_QueueCopyEx(SDL_Renderer *renderer, SDL_RenderCommand *cmd, 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, float scale_x, float scale_y)
|
||||
{
|
||||
CopyExData *verts = (CopyExData *)SDL_AllocateRenderVertices(renderer, sizeof(CopyExData), 0, &cmd->data.draw.first);
|
||||
|
@ -271,8 +274,10 @@ static int SW_QueueCopyEx(SDL_Renderer *renderer, SDL_RenderCommand *cmd, SDL_Te
|
|||
|
||||
cmd->data.draw.count = 1;
|
||||
|
||||
SDL_copyp(&verts->srcrect, srcrect);
|
||||
|
||||
verts->srcrect.x = (int)srcrect->x;
|
||||
verts->srcrect.y = (int)srcrect->y;
|
||||
verts->srcrect.w = (int)srcrect->w;
|
||||
verts->srcrect.h = (int)srcrect->h;
|
||||
verts->dstrect.x = (int)dstrect->x;
|
||||
verts->dstrect.y = (int)dstrect->y;
|
||||
verts->dstrect.w = (int)dstrect->w;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue