Revision: 75379
          http://sourceforge.net/p/brlcad/code/75379
Author:   starseeker
Date:     2020-04-13 16:33:50 +0000 (Mon, 13 Apr 2020)
Log Message:
-----------
Cherrypick r75378 - fix of rtedge line color with -W option

Modified Paths:
--------------
    brlcad/branches/RELEASE/NEWS
    brlcad/branches/RELEASE/src/rt/viewedge.c

Property Changed:
----------------
    brlcad/branches/RELEASE/
    brlcad/branches/RELEASE/NEWS

Index: brlcad/branches/RELEASE
===================================================================
--- brlcad/branches/RELEASE     2020-04-13 16:30:24 UTC (rev 75378)
+++ brlcad/branches/RELEASE     2020-04-13 16:33:50 UTC (rev 75379)

Property changes on: brlcad/branches/RELEASE
___________________________________________________________________
Modified: svn:mergeinfo
## -6,4 +6,4 ##
 /brlcad/branches/opencl:65867-66137
 /brlcad/branches/osg:62110-62113
 /brlcad/branches/prep-cache:68236-68933
-/brlcad/trunk:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-74976,74981,75056,75325,75375
\ No newline at end of property
+/brlcad/trunk:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-74976,74981,75056,75325,75375,75378
\ No newline at end of property
Modified: brlcad/branches/RELEASE/NEWS
===================================================================
--- brlcad/branches/RELEASE/NEWS        2020-04-13 16:30:24 UTC (rev 75378)
+++ brlcad/branches/RELEASE/NEWS        2020-04-13 16:33:50 UTC (rev 75379)
@@ -13,6 +13,7 @@
 --- 2020-0X-XX  Release 7.30.X                                     ---
 ----------------------------------------------------------------------
 
+* fixed rtedge line drawing color when using -W flag - Cliff Yapp
 * added support to MGED for zooming with mouse wheel - Cliff Yapp
 * fixed solid editing in MGED (reverts transparency change) Cliff Yapp
 * added .r suffixes to region names in 3dm-g conversion - Cliff Yapp


Property changes on: brlcad/branches/RELEASE/NEWS
___________________________________________________________________
Modified: svn:mergeinfo
## -7,4 +7,4 ##
 /brlcad/branches/osg/NEWS:62110-62113
 /brlcad/branches/prep-cache/NEWS:68236-68933
 /brlcad/trunk:68170-68252
-/brlcad/trunk/NEWS:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-74373,74376-74976,75056,75375
\ No newline at end of property
+/brlcad/trunk/NEWS:36844-37285,37571-38764,38777-38845,41559-43155,43159-43908,44241-44324,44326-44385,44710-45373,45377,45379-47342,47370-68122,68125-74373,74376-74976,75056,75375,75378
\ No newline at end of property
Modified: brlcad/branches/RELEASE/src/rt/viewedge.c
===================================================================
--- brlcad/branches/RELEASE/src/rt/viewedge.c   2020-04-13 16:30:24 UTC (rev 
75378)
+++ brlcad/branches/RELEASE/src/rt/viewedge.c   2020-04-13 16:33:50 UTC (rev 
75379)
@@ -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

Reply via email to