Skip to content

Commit

Permalink
Fix Image.cropRect (#189)
Browse files Browse the repository at this point in the history
* Fix `Image.cropRect`

* Update Umka
  • Loading branch information
skejeton authored Jul 7, 2024
1 parent 535012b commit 148067c
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/staembed.c
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,8 @@ const char *th_em_modulesrc[] = {
"\t\tth::__error(\"image is invalid\")\n"
"\t}\n"
"\n"
"\tumth_image_crop(i^, r.getPos(), r.getEnd())\n"
"\tdm := i.getDims()\n"
"\tumth_image_crop(i^, r.getPos().div(dm), r.getEnd().div(dm))\n"
"}\n"
"\n"
"fn umth_image_crop_quad(img: Image, q: ^th::Quad)\n"
Expand Down
3 changes: 2 additions & 1 deletion umka/image.um
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ fn (i: ^Image) cropRect*(r: rect::Rect) {
th::__error("image is invalid")
}

umth_image_crop(i^, r.getPos(), r.getEnd())
dm := i.getDims()
umth_image_crop(i^, r.getPos().div(dm), r.getEnd().div(dm))
}

fn umth_image_crop_quad(img: Image, q: ^th::Quad)
Expand Down

0 comments on commit 148067c

Please sign in to comment.