@@ -358,12 +358,14 @@ void MCCustomMetaContext::domark(MCMark *p_mark)
358358 {
359359 // MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since MCPath only accepts ints, if the inset value is uneven,
360360 // round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
361- if (!(p_mark -> rectangle . inset % 2 ))
361+ // SN-2014-10-17: [[ Bug 13351 ]] Only round up existing inset
362+ if (p_mark -> rectangle . inset && !(p_mark -> rectangle . inset % 2 ))
362363 p_mark -> rectangle . inset ++;
364+ // SN-2014-10-17: [[ Bug 13351 ]] Be careful not to underflow the bounds
363365 p_mark -> rectangle . bounds = MCRectangleMake (p_mark -> rectangle . bounds . x + p_mark -> rectangle . inset / 2 ,
364366 p_mark -> rectangle . bounds . y + p_mark -> rectangle . inset / 2 ,
365- p_mark -> rectangle . bounds . width - p_mark -> rectangle . inset,
366- p_mark -> rectangle . bounds . height - p_mark -> rectangle . inset);
367+ MCMin ( p_mark -> rectangle . bounds . width, p_mark -> rectangle . bounds . width - p_mark -> rectangle . inset),
368+ MCMin ( p_mark -> rectangle . bounds . height, p_mark -> rectangle . bounds . height - p_mark -> rectangle . inset) );
367369
368370 MCPath *t_path;
369371 if (p_mark -> stroke != nil && p_mark -> rectangle . bounds . height == 1 )
@@ -385,12 +387,14 @@ void MCCustomMetaContext::domark(MCMark *p_mark)
385387 {
386388 // MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since MCPath only accepts ints, if the inset value is uneven,
387389 // round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
390+ // SN-2014-10-17: [[ Bug 13351 ]] Only round up existing inset
388391 if (!(p_mark -> round_rectangle . inset % 2 ))
389392 p_mark -> round_rectangle . inset ++;
393+ // SN-2014-10-17: [[ Bug 13351 ]] Be careful not to underflow the bounds
390394 p_mark -> round_rectangle . bounds = MCRectangleMake (p_mark -> round_rectangle . bounds . x + p_mark -> round_rectangle . inset / 2 ,
391395 p_mark -> round_rectangle . bounds . y + p_mark -> round_rectangle . inset / 2 ,
392- p_mark -> round_rectangle . bounds . width - p_mark -> round_rectangle . inset,
393- p_mark -> round_rectangle . bounds . height - p_mark -> round_rectangle . inset);
396+ MCMin ( p_mark -> round_rectangle . bounds . width, p_mark -> round_rectangle . bounds . width - p_mark -> round_rectangle . inset),
397+ MCMin ( p_mark -> round_rectangle . bounds . height, p_mark -> round_rectangle . bounds . height - p_mark -> round_rectangle . inset) );
394398
395399 MCPath *t_path;
396400 t_path = MCPath::create_rounded_rectangle (p_mark -> round_rectangle . bounds, p_mark -> round_rectangle . radius / 2 , p_mark -> stroke != nil);
@@ -407,12 +411,14 @@ void MCCustomMetaContext::domark(MCMark *p_mark)
407411 {
408412 // MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since MCPath only accepts ints, if the inset value is uneven,
409413 // round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
414+ // SN-2014-10-17: [[ Bug 13351 ]] Only round up existing inset
410415 if (!(p_mark -> arc . inset % 2 ))
411416 p_mark -> arc . inset ++;
417+ // SN-2014-10-17: [[ Bug 13351 ]] Be careful not to underflow the bounds
412418 p_mark -> arc . bounds = MCRectangleMake (p_mark -> arc . bounds . x + p_mark -> arc . inset / 2 ,
413419 p_mark -> arc . bounds . y + p_mark -> arc . inset / 2 ,
414- p_mark -> arc . bounds . width - p_mark -> arc . inset,
415- p_mark -> arc . bounds . height - p_mark -> arc . inset);
420+ MCMin ( p_mark -> arc . bounds . width, p_mark -> arc . bounds . width - p_mark -> arc . inset),
421+ MCMin ( p_mark -> arc . bounds . height, p_mark -> arc . bounds . height - p_mark -> arc . inset) );
416422
417423 MCPath *t_path;
418424 if (p_mark -> arc . complete)
0 commit comments