Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(626)

Unified Diff: ui/compositor/compositor.cc

Issue 2728173004: HDR: Do nonlinear blending in the compositor (Closed)
Patch Set: Roll in sRGB-extended Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/compositor/compositor.cc
diff --git a/ui/compositor/compositor.cc b/ui/compositor/compositor.cc
index 7b49226117e98b6404fd73ce160cc5eb36c579d5..f438b216f1d17ee15a8929d81267630ef372030d 100644
--- a/ui/compositor/compositor.cc
+++ b/ui/compositor/compositor.cc
@@ -163,10 +163,10 @@ Compositor::Compositor(const cc::FrameSinkId& frame_sink_id,
settings.enable_color_correct_rendering =
command_line->HasSwitch(cc::switches::kEnableColorCorrectRendering) ||
- command_line->HasSwitch(cc::switches::kEnableTrueColorRendering) ||
- command_line->HasSwitch(switches::kEnableHDROutput);
+ command_line->HasSwitch(cc::switches::kEnableTrueColorRendering);
ccameron 2017/03/05 21:08:48 This makes it so that HDR doesn't opt us into doin
enne (OOO) 2017/03/06 19:56:12 Sorry to be confused, I'm a little lost in the sea
ccameron 2017/03/07 00:13:51 So, I complicated this a lot. Eventually all the f
settings.renderer_settings.enable_color_correct_rendering =
- settings.enable_color_correct_rendering;
+ settings.enable_color_correct_rendering ||
+ command_line->HasSwitch(switches::kEnableHDROutput);
// UI compositor always uses partial raster if not using zero-copy. Zero copy
// doesn't currently support partial raster.
@@ -282,7 +282,8 @@ void Compositor::SetCompositorFrameSink(
// to match the Compositor's.
if (context_factory_private_) {
context_factory_private_->SetDisplayVisible(this, host_->IsVisible());
- context_factory_private_->SetDisplayColorSpace(this, color_space_);
+ context_factory_private_->SetDisplayColorSpace(this, blending_color_space_,
+ output_color_space_);
}
}
@@ -354,19 +355,21 @@ void Compositor::SetScaleAndSize(float scale, const gfx::Size& size_in_pixel) {
}
void Compositor::SetDisplayColorSpace(const gfx::ColorSpace& color_space) {
+ blending_color_space_ = color_space;
+ output_color_space_ = color_space;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableHDROutput)) {
- color_space_ = gfx::ColorSpace::CreateSCRGBLinear();
- } else {
- color_space_ = color_space;
+ blending_color_space_ = gfx::ColorSpace::CreateExtendedSRGB();
+ output_color_space_ = gfx::ColorSpace::CreateSCRGBLinear();
}
- // TODO(Hubbe): Should maybe be color_space_, but currently that crashes skia.
- host_->SetDeviceColorSpace(color_space);
+ host_->SetDeviceColorSpace(blending_color_space_);
// Color space is reset when the output surface is lost, so this must also be
// updated then.
// TODO(fsamuel): Get rid of this.
- if (context_factory_private_)
- context_factory_private_->SetDisplayColorSpace(this, color_space_);
+ if (context_factory_private_) {
+ context_factory_private_->SetDisplayColorSpace(this, blending_color_space_,
+ output_color_space_);
+ }
}
void Compositor::SetBackgroundColor(SkColor color) {

Powered by Google App Engine
This is Rietveld 408576698