Skip to content

Commit 990262c

Browse files
committed
Merge remote-tracking branch 'mdboom/agg_cliprect_bug' into v1.0.x-cleanup
2 parents 0e6dad5 + a52b2f2 commit 990262c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/_backend_agg.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,10 @@ RendererAgg::set_clipbox(const Py::Object& cliprect, R& rasterizer)
431431
double l, b, r, t;
432432
if (py_convert_bbox(cliprect.ptr(), l, b, r, t))
433433
{
434-
rasterizer.clip_box(int(mpl_round(l)), height - int(mpl_round(b)),
435-
int(mpl_round(r)), height - int(mpl_round(t)));
434+
rasterizer.clip_box(std::max(int(mpl_round(l)), 0),
435+
std::max(int(height) - int(mpl_round(b)), 0),
436+
std::min(int(mpl_round(r)), int(width)),
437+
std::min(int(height) - int(mpl_round(t)), int(height)));
436438
}
437439
else
438440
{

0 commit comments

Comments
 (0)