From cad67012de5f7b044dca3e2b91612bc50f24d8ee Mon Sep 17 00:00:00 2001 From: Mathieu Faverge <mathieu.faverge@inria.fr> Date: Thu, 1 Mar 2018 18:00:32 +0100 Subject: [PATCH] Better drawing of the color, and don't draw empty pixels --- .../MatrixVisualizer/Windows/MatrixGLWidget.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/plugins/MatrixVisualizer/Windows/MatrixGLWidget.cpp b/plugins/MatrixVisualizer/Windows/MatrixGLWidget.cpp index a255fe27..a9c98a91 100644 --- a/plugins/MatrixVisualizer/Windows/MatrixGLWidget.cpp +++ b/plugins/MatrixVisualizer/Windows/MatrixGLWidget.cpp @@ -2,9 +2,9 @@ #include "MatrixWindow.hpp" -#define BACKGROUND_COLOR_R 0.2f -#define BACKGROUND_COLOR_G 0.2f -#define BACKGROUND_COLOR_B 0.2f +#define BACKGROUND_COLOR_R 0.9f +#define BACKGROUND_COLOR_G 0.9f +#define BACKGROUND_COLOR_B 0.9f /* Helpers */ static void drawSquare(GLfloat x, GLfloat y, GLfloat dx, GLfloat dy, GLfloat r, GLfloat g, GLfloat b) @@ -139,8 +139,13 @@ void MatrixGLWidget::paintGL() { GLfloat grey = m_zooming->getColor(i, j); - if (grey != 0.f) { - drawSquare(i, j, 1, 1, grey, grey, grey); + if (grey != 1.f) { + if (grey != 0.f) { + drawSquare(i, j, 1, 1, 0., 0., grey); + } + else { + drawSquare(i, j, 1, 1, grey, grey, grey); + } } } } -- GitLab