- subfile coloring now works again

Tue, 11 Mar 2014 15:44:27 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Tue, 11 Mar 2014 15:44:27 +0200
changeset 702
8e3058cb9281
parent 701
25b7b4aa9916
child 703
ce2a76cebdbb

- subfile coloring now works again

src/Colors.cc file | annotate | diff | comparison | revisions
src/Colors.h file | annotate | diff | comparison | revisions
src/GLCompiler.cc file | annotate | diff | comparison | revisions
--- a/src/Colors.cc	Tue Mar 11 14:35:21 2014 +0200
+++ b/src/Colors.cc	Tue Mar 11 15:44:27 2014 +0200
@@ -74,7 +74,7 @@
 
 // =============================================================================
 // =============================================================================
-int luma (QColor& col)
+int luma (const QColor& col)
 {
 	return (0.2126f * col.red()) +
 		   (0.7152f * col.green()) +
--- a/src/Colors.h	Tue Mar 11 14:35:21 2014 +0200
+++ b/src/Colors.h	Tue Mar 11 15:44:27 2014 +0200
@@ -31,7 +31,7 @@
 };
 
 void initColors();
-int luma (QColor& col);
+int luma (const QColor& col);
 
 // Safely gets a color with the given number or null if no such color.
 LDColor* getColor (int colnum);
--- a/src/GLCompiler.cc	Tue Mar 11 14:35:21 2014 +0200
+++ b/src/GLCompiler.cc	Tue Mar 11 15:44:27 2014 +0200
@@ -46,6 +46,7 @@
 #define DEBUG_PRINT(...) fprint (stdout, __VA_ARGS__)
 
 extern_cfg (Bool, gl_blackedges);
+extern_cfg (String, gl_bgcolor);
 static QList<short>		g_warnedColors;
 static const QColor		g_BFCFrontColor (40, 192, 40);
 static const QColor		g_BFCBackColor (224, 40, 40);
@@ -127,7 +128,16 @@
 	QColor qcol;
 
 	if (poly.color == maincolor)
-		qcol = GLRenderer::getMainColor();
+	{
+		if (topobj->color() == maincolor)
+			qcol = GLRenderer::getMainColor();
+		else
+			qcol = getColor (topobj->color())->faceColor;
+	}
+	elif (poly.color == edgecolor)
+	{
+		qcol = luma (QColor (gl_bgcolor)) > 40 ? Qt::black : Qt::white;
+	}
 	else
 	{
 		LDColor* col = getColor (poly.color);
@@ -136,16 +146,6 @@
 			qcol = col->faceColor;
 	}
 
-	if (poly.color == edgecolor)
-	{
-		qcol = QColor (32, 32, 32); // luma (m_bgcolor) < 40 ? QColor (64, 64, 64) : Qt::black;
-
-		/*
-		if (!gl_blackedges && poly.obj->getParent() && (col = getColor (poly.obj->getParent()->getColor())))
-			qcol = col->edgeColor;
-		*/
-	}
-
 	if (qcol.isValid() == false)
 	{
 		// The color was unknown. Use main color to make the poly.object at least

mercurial