From c0326f7d6b65020b70dd0eb3bc38ab73ebd25273 Mon Sep 17 00:00:00 2001 From: David Capello Date: Tue, 23 Oct 2018 16:16:03 -0300 Subject: [PATCH] Use working color space to draw ColorSliders (#1576) --- src/app/ui/color_sliders.cpp | 11 ++++++++++- src/app/ui/color_sliders.h | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app/ui/color_sliders.cpp b/src/app/ui/color_sliders.cpp index ee70e6d18..97617df9e 100644 --- a/src/app/ui/color_sliders.cpp +++ b/src/app/ui/color_sliders.cpp @@ -1,4 +1,5 @@ // Aseprite +// Copyright (C) 2018 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -8,6 +9,8 @@ #include "config.h" #endif +#include "app/app.h" +#include "app/color_spaces.h" #include "app/color_utils.h" #include "app/modules/gfx.h" #include "app/ui/color_sliders.h" @@ -55,6 +58,9 @@ namespace { return; } + // Color space conversion + auto convertColor = convert_from_current_to_screen_color_space(); + gfx::Color color = gfx::ColorNone; int w = MAX(rc.w-1, 1); @@ -113,7 +119,7 @@ namespace { app::Color::fromGray(255 * x / w)); break; } - g->drawVLine(color, rc.x+x, rc.y, rc.h); + g->drawVLine(convertColor(color), rc.x+x, rc.y, rc.h); } } @@ -251,6 +257,9 @@ ColorSliders::ColorSliders() addSlider(Channel::HslLightness, "L", 0, 100, -100, 100); addSlider(Channel::Gray, "V", 0, 255, -100, 100); addSlider(Channel::Alpha, "A", 0, 255, -100, 100); + + m_appConn = App::instance() + ->ColorSpaceChange.connect([this]{ invalidate(); }); } void ColorSliders::setColor(const app::Color& color) diff --git a/src/app/ui/color_sliders.h b/src/app/ui/color_sliders.h index 8a0a16e89..36d6b7703 100644 --- a/src/app/ui/color_sliders.h +++ b/src/app/ui/color_sliders.h @@ -1,4 +1,5 @@ // Aseprite +// Copyright (c) 2018 Igara Studio S.A. // Copyright (C) 2001-2018 David Capello // // This program is distributed under the terms of @@ -9,6 +10,7 @@ #pragma once #include "app/color.h" +#include "obs/connection.h" #include "obs/signal.h" #include "ui/event.h" #include "ui/grid.h" @@ -88,6 +90,7 @@ namespace app { int m_lockSlider; int m_lockEntry; app::Color m_color; + obs::scoped_connection m_appConn; }; //////////////////////////////////////////////////////////////////////