Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
Merge pull request #7448 from livecodepanos/bugfix-19016
Browse files Browse the repository at this point in the history
[[ Bug 19016 ]] Fix printing with vGrid enabled on Windows
  • Loading branch information
livecodepanos committed Oct 12, 2020
2 parents 45db9bf + 45466bb commit bff54e2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 8 deletions.
1 change: 1 addition & 0 deletions docs/notes/bugfix-19016.md
@@ -0,0 +1 @@
# Ensure printing a field with vGrid enabled does not print black rectangles on Windows
6 changes: 3 additions & 3 deletions engine/src/customprinter.cpp
Expand Up @@ -402,7 +402,7 @@ void MCCustomMetaContext::domark(MCMark *p_mark)
// MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since MCPath only accepts ints, if the inset value is uneven,
// round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
// SN-2014-10-17: [[ Bug 13351 ]] Only round up existing inset
if (p_mark -> rectangle . inset && !(p_mark -> rectangle . inset % 2))
if (p_mark -> rectangle . inset && (p_mark -> rectangle . inset % 2))
p_mark -> rectangle . inset ++;
// SN-2014-10-17: [[ Bug 13351 ]] Be careful not to underflow the bounds
p_mark -> rectangle . bounds = MCRectangleMake(p_mark -> rectangle . bounds . x + p_mark -> rectangle . inset / 2,
Expand Down Expand Up @@ -431,7 +431,7 @@ void MCCustomMetaContext::domark(MCMark *p_mark)
// MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since MCPath only accepts ints, if the inset value is uneven,
// round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
// SN-2014-10-17: [[ Bug 13351 ]] Only round up existing inset
if (!(p_mark -> round_rectangle . inset % 2))
if (p_mark -> round_rectangle . inset % 2)
p_mark -> round_rectangle . inset ++;
// SN-2014-10-17: [[ Bug 13351 ]] Be careful not to underflow the bounds
p_mark -> round_rectangle . bounds = MCRectangleMake(p_mark -> round_rectangle . bounds . x + p_mark -> round_rectangle . inset / 2,
Expand All @@ -455,7 +455,7 @@ void MCCustomMetaContext::domark(MCMark *p_mark)
// MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since MCPath only accepts ints, if the inset value is uneven,
// round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
// SN-2014-10-17: [[ Bug 13351 ]] Only round up existing inset
if (!(p_mark -> arc . inset % 2))
if (p_mark -> arc . inset % 2)
p_mark -> arc . inset ++;
// SN-2014-10-17: [[ Bug 13351 ]] Be careful not to underflow the bounds
p_mark -> arc . bounds = MCRectangleMake(p_mark -> arc . bounds . x + p_mark -> arc . inset / 2,
Expand Down
8 changes: 3 additions & 5 deletions engine/src/w32printer.cpp
Expand Up @@ -829,7 +829,7 @@ void MCGDIMetaContext::domark(MCMark *p_mark)
{
// MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since GDI only accepts ints, if the inset value is uneven,
// round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
if (!(p_mark -> rectangle . inset % 2))
if (p_mark -> rectangle . inset % 2)
p_mark -> rectangle . inset ++;
p_mark -> rectangle . bounds = MCRectangleMake(p_mark -> rectangle . bounds . x + p_mark -> rectangle . inset / 2,
p_mark -> rectangle . bounds . y + p_mark -> rectangle . inset / 2,
Expand All @@ -849,16 +849,14 @@ void MCGDIMetaContext::domark(MCMark *p_mark)
{
// MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since GDI only accepts ints, if the inset value is uneven,
// round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
if (!(p_mark -> round_rectangle . inset % 2))
if (p_mark -> round_rectangle . inset % 2)
p_mark -> round_rectangle . inset ++;
p_mark -> round_rectangle . bounds = MCRectangleMake(p_mark -> round_rectangle . bounds . x + p_mark -> round_rectangle . inset / 2,
p_mark -> round_rectangle . bounds . y + p_mark -> round_rectangle . inset / 2,
p_mark -> round_rectangle . bounds . width - p_mark -> round_rectangle . inset,
p_mark -> round_rectangle . bounds . height - p_mark -> round_rectangle . inset);
}

int4 t_adjust;
t_adjust = p_mark -> stroke != NULL ? 0 : 1;
RoundRect(t_dc, p_mark -> round_rectangle . bounds . x, p_mark -> round_rectangle . bounds . y,
p_mark -> round_rectangle . bounds . x + p_mark -> round_rectangle . bounds . width,
p_mark -> round_rectangle . bounds . y + p_mark -> round_rectangle . bounds . height, p_mark -> round_rectangle . radius,
Expand All @@ -871,7 +869,7 @@ void MCGDIMetaContext::domark(MCMark *p_mark)
{
// MM-2014-04-23: [[ Bug 11884 ]] Inset the bounds. Since GDI only accepts ints, if the inset value is uneven,
// round up to the nearest even value, keeping behaviour as close to that of the graphics context as possible.
if (!(p_mark -> arc . inset % 2))
if (p_mark -> arc . inset % 2)
p_mark -> arc . inset ++;
p_mark -> arc . bounds = MCRectangleMake(p_mark -> arc . bounds . x + p_mark -> arc . inset / 2,
p_mark -> arc . bounds . y + p_mark -> arc . inset / 2,
Expand Down

0 comments on commit bff54e2

Please sign in to comment.