Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/fbgraphics.c
Original file line number Diff line number Diff line change
Expand Up @@ -1601,10 +1601,19 @@ void fbg_imageEx(struct _fbg *fbg, struct _fbg_img *img, int x, int y, float sx,
int h2 = (float)(ch + cy) * sy;
int i, j;

int d = w2 - cx2;
int dw = w2 - cx2;
int dh = h2 - cy2;

if (d >= (fbg->width - x)) {
w2 -= (d - (fbg->width - x));
if (dw >= (fbg->width - x)) {
w2 -= (dw - (fbg->width - x));
printf("Warning: Resulting width is greater than framebuffer width. \
Image will be compromised\n");
}

if (dh >= (fbg->height - y)) {
h2 -= (dh - (fbg->height - y));
printf("Warning: Resulting height is greater than framebuffer height. \
Image will be compromised\n");
}

unsigned char *pix_pointer = (unsigned char *)(fbg->back_buffer + (y * fbg->line_length + x * fbg->components));
Expand Down