Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/display/display_color_manager_chromeos.h" | 5 #include "ash/display/display_color_manager_chromeos.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 156 configurator_->AddObserver(this); | 156 configurator_->AddObserver(this); |
| 157 } | 157 } |
| 158 | 158 |
| 159 DisplayColorManager::~DisplayColorManager() { | 159 DisplayColorManager::~DisplayColorManager() { |
| 160 configurator_->RemoveObserver(this); | 160 configurator_->RemoveObserver(this); |
| 161 STLDeleteValues(&calibration_map_); | 161 STLDeleteValues(&calibration_map_); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void DisplayColorManager::OnDisplayModeChanged( | 164 void DisplayColorManager::OnDisplayModeChanged( |
| 165 const ui::DisplayConfigurator::DisplayStateList& display_states) { | 165 const ui::DisplayConfigurator::DisplayStateList& display_states) { |
| 166 ColorCalibrationData reset_calibration; | |
| 167 | |
| 166 for (const ui::DisplaySnapshot* state : display_states) { | 168 for (const ui::DisplaySnapshot* state : display_states) { |
| 169 // Ensure we always reset the configuration before setting a new one. | |
| 170 configurator_->SetColorCorrection( | |
| 171 state->display_id(), reset_calibration.degamma_lut, | |
|
robert.bradford
2016/04/27 12:29:46
Don't use the ColorCalibrationData to just get thr
| |
| 172 reset_calibration.gamma_lut, reset_calibration.correction_matrix); | |
| 173 | |
| 167 if (calibration_map_[state->product_id()]) { | 174 if (calibration_map_[state->product_id()]) { |
| 168 ApplyDisplayColorCalibration(state->display_id(), state->product_id()); | 175 ApplyDisplayColorCalibration(state->display_id(), state->product_id()); |
| 169 } else { | 176 } else { |
| 170 if (state->product_id() != ui::DisplaySnapshot::kInvalidProductID) | 177 if (state->product_id() != ui::DisplaySnapshot::kInvalidProductID) |
| 171 LoadCalibrationForDisplay(state); | 178 LoadCalibrationForDisplay(state); |
| 172 } | 179 } |
| 173 } | 180 } |
| 174 } | 181 } |
| 175 | 182 |
| 176 void DisplayColorManager::ApplyDisplayColorCalibration(int64_t display_id, | 183 void DisplayColorManager::ApplyDisplayColorCalibration(int64_t display_id, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 243 calibration_map_[product_id] = data.release(); | 250 calibration_map_[product_id] = data.release(); |
| 244 ApplyDisplayColorCalibration(display_id, product_id); | 251 ApplyDisplayColorCalibration(display_id, product_id); |
| 245 } | 252 } |
| 246 } | 253 } |
| 247 | 254 |
| 248 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} | 255 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} |
| 249 | 256 |
| 250 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} | 257 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} |
| 251 | 258 |
| 252 } // namespace ash | 259 } // namespace ash |
| OLD | NEW |