From: Steinar H. Gunderson Date: Tue, 3 Nov 2015 00:22:30 +0000 (+0100) Subject: Fix repeated WB clicks. X-Git-Tag: 1.0.0~170 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=671ad208c70f9a8aa1bb59afcd7884ea1b368074;p=nageru Fix repeated WB clicks. --- diff --git a/mainwindow.cpp b/mainwindow.cpp index be46ded..97f9b2c 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -213,11 +213,15 @@ double srgb_to_linear(double x) void MainWindow::set_white_balance(int channel_number, int x, int y) { - // FIXME: This is wrong. We should really reset the white balance and then - // re-render, but renderToPixmap() crashes for me. + // Set the white balance to neutral for the grab. It's probably going to + // flicker a bit, but hopefully this display is not live anyway. + global_mixer->set_wb(Mixer::OUTPUT_INPUT0 + channel_number, 0.5, 0.5, 0.5); + previews[channel_number]->display->updateGL(); QRgb reference_color = previews[channel_number]->display->grabFrameBuffer().pixel(x, y); + 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); global_mixer->set_wb(Mixer::OUTPUT_INPUT0 + channel_number, r, g, b); + previews[channel_number]->display->updateGL(); }