Skip to content

Commit

Permalink
Clip it right
Browse files Browse the repository at this point in the history
  • Loading branch information
erkkah committed Feb 28, 2022
1 parent 1d89c79 commit 29f9364
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/tigr_bitmaps.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,13 @@ TPixel tigrGet(Tigr* bmp, int x, int y) {

void tigrPlot(Tigr* bmp, int x, int y, TPixel pix) {
int xa, i, a;
if (x >= bmp->cx && y >= bmp->cy && x < bmp->cx + bmp->cw && y < bmp->cy + bmp->h) {

int cx = bmp->cx;
int cy = bmp->cy;
int cw = bmp->cw >= 0 ? bmp->cw : bmp->w;
int ch = bmp->ch >= 0 ? bmp->ch : bmp->h;

if (x >= cx && y >= cy && x < cx + cw && y < cy + ch) {
xa = EXPAND(pix.a);
a = xa * xa;
i = y * bmp->w + x;
Expand Down
8 changes: 7 additions & 1 deletion tigr.c
Original file line number Diff line number Diff line change
Expand Up @@ -548,7 +548,13 @@ TPixel tigrGet(Tigr* bmp, int x, int y) {

void tigrPlot(Tigr* bmp, int x, int y, TPixel pix) {
int xa, i, a;
if (x >= bmp->cx && y >= bmp->cy && x < bmp->cx + bmp->cw && y < bmp->cy + bmp->h) {

int cx = bmp->cx;
int cy = bmp->cy;
int cw = bmp->cw >= 0 ? bmp->cw : bmp->w;
int ch = bmp->ch >= 0 ? bmp->ch : bmp->h;

if (x >= cx && y >= cy && x < cx + cw && y < cy + ch) {
xa = EXPAND(pix.a);
a = xa * xa;
i = y * bmp->w + x;
Expand Down

0 comments on commit 29f9364

Please sign in to comment.