From 671ad208c70f9a8aa1bb59afcd7884ea1b368074 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 3 Nov 2015 01:22:30 +0100 Subject: [PATCH] Fix repeated WB clicks. --- mainwindow.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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(); } -- 2.39.2