Commit 284086f9 authored by Christopher Cameron's avatar Christopher Cameron Committed by Commit Bot

color: Ensure window tree host gets updates

This logic was incorrectly inverted.

Bug: 735613
Change-Id: Ib07302612c02e860c006f0cc2e9929a04f5de009
Reviewed-on: https://chromium-review.googlesource.com/596710
Commit-Queue: ccameron chromium <ccameron@chromium.org>
Reviewed-by: default avatarFredrik Hubinette <hubbe@chromium.org>
Cr-Commit-Position: refs/heads/master@{#491655}
parent d1cd7f56
...@@ -68,6 +68,12 @@ void TestScreen::SetDeviceScaleFactor(float device_scale_factor) { ...@@ -68,6 +68,12 @@ void TestScreen::SetDeviceScaleFactor(float device_scale_factor) {
host_->OnHostResizedInPixels(bounds_in_pixel.size()); host_->OnHostResizedInPixels(bounds_in_pixel.size());
} }
void TestScreen::SetColorSpace(const gfx::ColorSpace& color_space) {
display::Display display(GetPrimaryDisplay());
display.set_color_space(color_space);
display_list().UpdateDisplay(display);
}
void TestScreen::SetDisplayRotation(display::Display::Rotation rotation) { void TestScreen::SetDisplayRotation(display::Display::Rotation rotation) {
display::Display display(GetPrimaryDisplay()); display::Display display(GetPrimaryDisplay());
gfx::Rect bounds_in_pixel(display.GetSizeInPixel()); gfx::Rect bounds_in_pixel(display.GetSizeInPixel());
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include "ui/display/screen_base.h" #include "ui/display/screen_base.h"
namespace gfx { namespace gfx {
class ColorSpace;
class Insets; class Insets;
class Rect; class Rect;
class Transform; class Transform;
...@@ -35,6 +36,7 @@ class TestScreen : public display::ScreenBase, public WindowObserver { ...@@ -35,6 +36,7 @@ class TestScreen : public display::ScreenBase, public WindowObserver {
WindowTreeHost* CreateHostForPrimaryDisplay(); WindowTreeHost* CreateHostForPrimaryDisplay();
void SetDeviceScaleFactor(float device_scale_fator); void SetDeviceScaleFactor(float device_scale_fator);
void SetColorSpace(const gfx::ColorSpace& color_space);
void SetDisplayRotation(display::Display::Rotation rotation); void SetDisplayRotation(display::Display::Rotation rotation);
void SetUIScale(float ui_scale); void SetUIScale(float ui_scale);
void SetWorkAreaInsets(const gfx::Insets& insets); void SetWorkAreaInsets(const gfx::Insets& insets);
......
...@@ -356,7 +356,7 @@ void WindowTreeHost::OnDisplayMetricsChanged(const display::Display& display, ...@@ -356,7 +356,7 @@ void WindowTreeHost::OnDisplayMetricsChanged(const display::Display& display,
if (metrics & DisplayObserver::DISPLAY_METRIC_COLOR_SPACE) { if (metrics & DisplayObserver::DISPLAY_METRIC_COLOR_SPACE) {
display::Screen* screen = display::Screen::GetScreen(); display::Screen* screen = display::Screen::GetScreen();
if (compositor_ && if (compositor_ &&
display.id() != screen->GetDisplayNearestView(window()).id()) { display.id() == screen->GetDisplayNearestView(window()).id()) {
compositor_->SetDisplayColorSpace(display.color_space()); compositor_->SetDisplayColorSpace(display.color_space());
} }
} }
......
...@@ -86,4 +86,12 @@ TEST_F(WindowTreeHostTest, NoRewritesPostIME) { ...@@ -86,4 +86,12 @@ TEST_F(WindowTreeHostTest, NoRewritesPostIME) {
host()->RemoveEventRewriter(&event_rewriter); host()->RemoveEventRewriter(&event_rewriter);
} }
TEST_F(WindowTreeHostTest, ColorSpace) {
EXPECT_EQ(gfx::ColorSpace::CreateSRGB(),
host()->compositor()->output_color_space());
test_screen()->SetColorSpace(gfx::ColorSpace::CreateSCRGBLinear());
EXPECT_EQ(gfx::ColorSpace::CreateSCRGBLinear(),
host()->compositor()->output_color_space());
}
} // namespace aura } // namespace aura
...@@ -234,6 +234,11 @@ class COMPOSITOR_EXPORT Compositor ...@@ -234,6 +234,11 @@ class COMPOSITOR_EXPORT Compositor
// compositing layers on. // compositing layers on.
float device_scale_factor() const { return device_scale_factor_; } float device_scale_factor() const { return device_scale_factor_; }
// The color space of the device that this compositor is being displayed on.
const gfx::ColorSpace& output_color_space() const {
return output_color_space_;
}
// Where possible, draws are scissored to a damage region calculated from // Where possible, draws are scissored to a damage region calculated from
// changes to layer properties. This bypasses that and indicates that // changes to layer properties. This bypasses that and indicates that
// the whole frame needs to be drawn. // the whole frame needs to be drawn.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment