]> git.sesse.net Git - nageru/commitdiff
When grabbing the white balance, grab a single pixel instead of the entire framebuffer.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 26 Apr 2018 20:31:27 +0000 (22:31 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Thu, 26 Apr 2018 20:31:27 +0000 (22:31 +0200)
glwidget.cpp

index 574bf61a6b3e116fa219a5df1245fddb780f37e2..bf537de2dbdb0806d2c41fec0b8ebf3fcd74d8e7 100644 (file)
@@ -152,11 +152,12 @@ void GLWidget::paintGL()
        }
 
        if (should_grab) {
-               QRgb reference_color = grabFrameBuffer().pixel(grab_x, grab_y);
+               GLfloat reference_color[4];
+               glReadPixels(grab_x, current_height - grab_y - 1, 1, 1, GL_BGRA, GL_FLOAT, reference_color);
 
-               double r = srgb_to_linear(qRed(reference_color) / 255.0);
-               double g = srgb_to_linear(qGreen(reference_color) / 255.0);
-               double b = srgb_to_linear(qBlue(reference_color) / 255.0);
+               double r = srgb_to_linear(reference_color[2]);
+               double g = srgb_to_linear(reference_color[1]);
+               double b = srgb_to_linear(reference_color[0]);
                global_mixer->set_wb(grab_output, r, g, b);
                should_grab = false;
        }