@@ -619,7 +619,11 @@ RendererAgg::render_clippath(const Py::Object& clippath,
619
619
rendererBaseAlphaMask.clear (agg::gray8 (0 , 0 ));
620
620
transformed_path_t transformed_clippath (clippath_iter, trans);
621
621
agg::conv_curve<transformed_path_t > curved_clippath (transformed_clippath);
622
- theRasterizer.add_path (curved_clippath);
622
+ try {
623
+ theRasterizer.add_path (curved_clippath);
624
+ } catch (std::overflow_error &e) {
625
+ throw Py::OverflowError (e.what ());
626
+ }
623
627
rendererAlphaMask.color (agg::gray8 (255 , 255 ));
624
628
agg::render_scanlines (theRasterizer, scanlineAlphaMask, rendererAlphaMask);
625
629
lastclippath = clippath;
@@ -698,7 +702,11 @@ RendererAgg::draw_markers(const Py::Tuple& args)
698
702
unsigned fillSize = 0 ;
699
703
if (face.first )
700
704
{
701
- theRasterizer.add_path (marker_path_curve);
705
+ try {
706
+ theRasterizer.add_path (marker_path_curve);
707
+ } catch (std::overflow_error &e) {
708
+ throw Py::OverflowError (e.what ());
709
+ }
702
710
agg::render_scanlines (theRasterizer, slineP8, scanlines);
703
711
fillSize = scanlines.byte_size ();
704
712
if (fillSize >= MARKER_CACHE_SIZE)
@@ -713,7 +721,11 @@ RendererAgg::draw_markers(const Py::Tuple& args)
713
721
stroke.line_cap (gc.cap );
714
722
stroke.line_join (gc.join );
715
723 theRasterizer.reset ();
716
- theRasterizer.add_path (stroke);
724
+ try {
725
+ theRasterizer.add_path (stroke);
726
+ } catch (std::overflow_error &e) {
727
+ throw Py::OverflowError (e.what ());
728
+ }
717
729
agg::render_scanlines (theRasterizer, slineP8, scanlines);
718
730
unsigned strokeSize = scanlines.byte_size ();
719
731
if (strokeSize >= MARKER_CACHE_SIZE)
@@ -980,7 +992,11 @@ RendererAgg::draw_text_image(const Py::Tuple& args)
980
992
span_gen_type output_span_generator (&image_span_generator, gc.color );
981
993
renderer_type ri (rendererBase, sa, output_span_generator);
982
994
983
- theRasterizer.add_path (rect2);
995
+ try {
996
+ theRasterizer.add_path (rect2);
997
+ } catch (std::overflow_error &e) {
998
+ throw Py::OverflowError (e.what ());
999
+ }
984
1000
agg::render_scanlines (theRasterizer, slineP8, ri);
985
1001
986
1002
return Py::Object ();
@@ -1117,7 +1133,11 @@ RendererAgg::draw_image(const Py::Tuple& args)
1117
1133
amask_ren_type r (pfa);
1118
1134
renderer_type_alpha ri (r, sa, spans);
1119
1135
1120
- theRasterizer.add_path (rect2);
1136
+ try {
1137
+ theRasterizer.add_path (rect2);
1138
+ } catch (std::overflow_error &e) {
1139
+ throw Py::OverflowError (e.what ());
1140
+ }
1121
1141
agg::render_scanlines (theRasterizer, slineP8, ri);
1122
1142
}
1123
1143
else
@@ -1131,7 +1151,11 @@ RendererAgg::draw_image(const Py::Tuple& args)
1131
1151
ren_type r (pixFmt);
1132
1152
renderer_type ri (r, sa, spans);
1133
1153
1134
- theRasterizer.add_path (rect2);
1154
+ try {
1155
+ theRasterizer.add_path (rect2);
1156
+ } catch (std::overflow_error &e) {
1157
+ throw Py::OverflowError (e.what ());
1158
+ }
1135
1159
agg::render_scanlines (theRasterizer, slineP8, ri);
1136
1160
}
1137
1161
@@ -1166,7 +1190,11 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
1166
1190
// Render face
1167
1191
if (face.first )
1168
1192
{
1169
- theRasterizer.add_path (path);
1193
+ try {
1194
+ theRasterizer.add_path (path);
1195
+ } catch (std::overflow_error &e) {
1196
+ throw Py::OverflowError (e.what ());
1197
+ }
1170
1198
1171
1199
if (gc.isaa )
1172
1200
{
@@ -1233,9 +1261,17 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
1233
1261
rb.clear (agg::rgba (0.0 , 0.0 , 0.0 , 0.0 ));
1234
1262
rs.color (gc.color );
1235
1263
1236
- theRasterizer.add_path (hatch_path_curve);
1264
+ try {
1265
+ theRasterizer.add_path (hatch_path_curve);
1266
+ } catch (std::overflow_error &e) {
1267
+ throw Py::OverflowError (e.what ());
1268
+ }
1237
1269
agg::render_scanlines (theRasterizer, slineP8, rs);
1238
- theRasterizer.add_path (hatch_path_stroke);
1270
+ try {
1271
+ theRasterizer.add_path (hatch_path_stroke);
1272
+ } catch (std::overflow_error &e) {
1273
+ throw Py::OverflowError (e.what ());
1274
+ }
1239
1275
agg::render_scanlines (theRasterizer, slineP8, rs);
1240
1276
1241
1277
// Put clipping back on, if originally set on entry to this
@@ -1252,7 +1288,11 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
1252
1288
agg::span_allocator<agg::rgba8> sa;
1253
1289
img_source_type img_src (hatch_img_pixf);
1254
1290
span_gen_type sg (img_src, 0 , 0 );
1255
- theRasterizer.add_path (path);
1291
+ try {
1292
+ theRasterizer.add_path (path);
1293
+ } catch (std::overflow_error &e) {
1294
+ throw Py::OverflowError (e.what ());
1295
+ }
1256
1296
agg::render_scanlines_aa (theRasterizer, slineP8, rendererBase, sa, sg);
1257
1297
}
1258
1298
@@ -1270,7 +1310,11 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
1270
1310
stroke.width (linewidth);
1271
1311
stroke.line_cap (gc.cap );
1272
1312
stroke.line_join (gc.join );
1273
- theRasterizer.add_path (stroke);
1313
+ try {
1314
+ theRasterizer.add_path (stroke);
1315
+ } catch (std::overflow_error &e) {
1316
+ throw Py::OverflowError (e.what ());
1317
+ }
1274
1318
}
1275
1319
else
1276
1320
{
@@ -1291,7 +1335,11 @@ void RendererAgg::_draw_path(path_t& path, bool has_clippath,
1291
1335
stroke.line_cap (gc.cap );
1292
1336
stroke.line_join (gc.join );
1293
1337
stroke.width (linewidth);
1294
- theRasterizer.add_path (stroke);
1338
+ try {
1339
+ theRasterizer.add_path (stroke);
1340
+ } catch (std::overflow_error &e) {
1341
+ throw Py::OverflowError (e.what ());
1342
+ }
1295
1343
}
1296
1344
1297
1345
if (gc.isaa )
@@ -1888,7 +1936,12 @@ RendererAgg::_draw_gouraud_triangle(const double* points,
1888
1936
tpoints[4 ], tpoints[5 ],
1889
1937
0.5 );
1890
1938
1891
- theRasterizer.add_path (span_gen);
1939
+ try {
1940
+ theRasterizer.add_path (span_gen);
1941
+ } catch (std::overflow_error &e) {
1942
+ throw Py::OverflowError (e.what ()
1943
+ );
1944
+ }
1892
1945
1893
1946
if (has_clippath)
1894
1947
{
0 commit comments