From: Steinar H. Gunderson Date: Thu, 26 Apr 2018 20:31:27 +0000 (+0200) Subject: When grabbing the white balance, grab a single pixel instead of the entire framebuffer. X-Git-Tag: 1.7.2~12 X-Git-Url: https://git.sesse.net/?p=nageru;a=commitdiff_plain;h=aca8e7f15c4fd9d49875ad2bde27f7f467a6869e When grabbing the white balance, grab a single pixel instead of the entire framebuffer. --- diff --git a/glwidget.cpp b/glwidget.cpp index 574bf61..bf537de 100644 --- a/glwidget.cpp +++ b/glwidget.cpp @@ -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; }