Revision: 75378
http://sourceforge.net/p/brlcad/code/75378
Author: starseeker
Date: 2020-04-13 16:30:24 +0000 (Mon, 13 Apr 2020)
Log Message:
-----------
Work around the rtedge -W problem reported by a user where the rtedge lines are
still drawn white even though the white background is specified. This broke in
commit r68597, but it looks as if the implementation even prior to that does
what's intended rather oddly, in a way only considered the -W white background
case. -C 240/240/240, for example, does not produce the dark line but is
clearly a background that would benefit from it. Only -W changes the
default_background flag internally, but adjusting -C to do the same won't do
either, since -C 1/1/1 would then produce a black line and a black-on-black
image. The correct answer is to calculate a color difference metric, but until
that's solved this should restore the black/white and white/black cases where
are the most common for line drawings.
Modified Paths:
--------------
brlcad/trunk/NEWS
brlcad/trunk/src/rt/viewedge.c
Modified: brlcad/trunk/NEWS
===================================================================
--- brlcad/trunk/NEWS 2020-04-13 14:45:43 UTC (rev 75377)
+++ brlcad/trunk/NEWS 2020-04-13 16:30:24 UTC (rev 75378)
@@ -14,6 +14,7 @@
--- 20XX-XX-XX Release 7.XX.X ---
----------------------------------------------------------------------
+* fixed rtedge line drawing color when using -W flag - Cliff Yapp
* added -F option to lint cmd to test specifc solid types - Cliff Yapp
* added support to MGED for zooming with mouse wheel - Cliff Yapp
* repaired wireframe visualization during MGED solid edit - Cliff Yapp
Modified: brlcad/trunk/src/rt/viewedge.c
===================================================================
--- brlcad/trunk/src/rt/viewedge.c 2020-04-13 14:45:43 UTC (rev 75377)
+++ brlcad/trunk/src/rt/viewedge.c 2020-04-13 16:30:24 UTC (rev 75378)
@@ -519,6 +519,26 @@
bu_exit(EXIT_FAILURE, "rtedge: occlusion mode set, but no objects were
specified.\n");
}
+
+ // TODO - the setting of colors below broke the -W flag - lines and
+ // background were both white. Looks like rtedge was relying on bgcolor
+ // being black to get a black line in that mode, but it gets set to white
+ // first via -W. Work around this by stashing the "original" bgcolor in a
+ // temporary variable, but this is just a hacky workaround to restore
+ // previous behavior. If -W is just doing what it is supposed to do by
+ // setting a white background, and rtedge wants to set default line color
+ // that is far away from the background color automatically, we need a
+ // different solution for the general case. There is no guarantee that the
+ // initialized contents of bgcolor (currently hard-coded to 0,0,0 up on
+ // line 159) will be appropriate for all backgrounds - indeed, it is
+ // trivially NOT appropriate for all possible background colors.
+ color tmpcolor;
+ tmpcolor[RED] = bgcolor[RED];
+ tmpcolor[GRN] = bgcolor[GRN];
+ tmpcolor[BLU] = bgcolor[BLU];
+
+
+ // Set bgcolor and fgcolor from the floating point versions
bgcolor[0] = background[0] * 255.0 + 0.5;
bgcolor[1] = background[1] * 255.0 + 0.5;
bgcolor[2] = background[2] * 255.0 + 0.5;
@@ -532,13 +552,13 @@
if (!default_background) {
int tmp;
tmp = fgcolor[RED];
- fgcolor[RED] = bgcolor[RED];
+ fgcolor[RED] = tmpcolor[RED];
bgcolor[RED] = tmp;
tmp = fgcolor[GRN];
- fgcolor[GRN] = bgcolor[GRN];
+ fgcolor[GRN] = tmpcolor[GRN];
bgcolor[GRN] = tmp;
tmp = fgcolor[BLU];
- fgcolor[BLU] = bgcolor[BLU];
+ fgcolor[BLU] = tmpcolor[BLU];
bgcolor[BLU] = tmp;
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
_______________________________________________
BRL-CAD Source Commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/brlcad-commits