graphics: fix clipping from bad rounding when drawing with transformations
This commit is contained in:
parent
928383a323
commit
652f3f8d4b
@ -976,8 +976,8 @@ void draw_sprite_transform(gfx_context_t * ctx, const sprite_t * sprite, gfx_mat
|
||||
/* Use the corners to calculate bounds within the target context. */
|
||||
int32_t _left = clamp(fmin(fmin(ul_x, ll_x), fmin(ur_x, lr_x)), 0, ctx->width);
|
||||
int32_t _top = clamp(fmin(fmin(ul_y, ll_y), fmin(ur_y, lr_y)), 0, ctx->height);
|
||||
int32_t _right = clamp(fmax(fmax(ul_x+1, ll_x+1), fmax(ur_x+1, lr_x+1)), 0, ctx->width);
|
||||
int32_t _bottom = clamp(fmax(fmax(ul_y+1, ll_y+1), fmax(ur_y+1, lr_y+1)), 0, ctx->height);
|
||||
int32_t _right = clamp(fmax(fmax(ul_x+2, ll_x+2), fmax(ur_x+2, lr_x+2)), 0, ctx->width);
|
||||
int32_t _bottom = clamp(fmax(fmax(ul_y+2, ll_y+2), fmax(ur_y+2, lr_y+2)), 0, ctx->height);
|
||||
|
||||
sprite_t * scanline = create_sprite(_right - _left, 1, ALPHA_EMBEDDED);
|
||||
uint8_t alp = alpha * 255;
|
||||
@ -1031,8 +1031,8 @@ void draw_sprite_transform_blur(gfx_context_t * ctx, gfx_context_t * blur_ctx, c
|
||||
/* Use the corners to calculate bounds within the target context. */
|
||||
int32_t _left = clamp(fmin(fmin(ul_x, ll_x), fmin(ur_x, lr_x)), 0, ctx->width);
|
||||
int32_t _top = clamp(fmin(fmin(ul_y, ll_y), fmin(ur_y, lr_y)), 0, ctx->height);
|
||||
int32_t _right = clamp(fmax(fmax(ul_x+1, ll_x+1), fmax(ur_x+1, lr_x+1)), 0, ctx->width);
|
||||
int32_t _bottom = clamp(fmax(fmax(ul_y+1, ll_y+1), fmax(ur_y+1, lr_y+1)), 0, ctx->height);
|
||||
int32_t _right = clamp(fmax(fmax(ul_x+2, ll_x+2), fmax(ur_x+2, lr_x+2)), 0, ctx->width);
|
||||
int32_t _bottom = clamp(fmax(fmax(ul_y+2, ll_y+2), fmax(ur_y+2, lr_y+2)), 0, ctx->height);
|
||||
|
||||
blur_ctx->clips_size = ctx->clips_size;
|
||||
blur_ctx->clips = ctx->clips;
|
||||
|
Loading…
Reference in New Issue
Block a user