| 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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 for (const ui::DisplaySnapshot* state : display_states) { | 166 for (const ui::DisplaySnapshot* state : display_states) { |
| 167 // Ensure we always reset the configuration before setting a new one. | |
| 168 configurator_->SetColorCorrection( | |
| 169 state->display_id(), std::vector<ui::GammaRampRGBEntry>(), | |
| 170 std::vector<ui::GammaRampRGBEntry>(), std::vector<float>()); | |
| 171 | |
| 172 if (calibration_map_[state->product_id()]) { | 167 if (calibration_map_[state->product_id()]) { |
| 173 ApplyDisplayColorCalibration(state->display_id(), state->product_id()); | 168 ApplyDisplayColorCalibration(state->display_id(), state->product_id()); |
| 174 } else { | 169 } else { |
| 175 if (state->product_id() != ui::DisplaySnapshot::kInvalidProductID) | 170 if (state->product_id() != ui::DisplaySnapshot::kInvalidProductID) |
| 176 LoadCalibrationForDisplay(state); | 171 LoadCalibrationForDisplay(state); |
| 177 } | 172 } |
| 178 } | 173 } |
| 179 } | 174 } |
| 180 | 175 |
| 181 void DisplayColorManager::ApplyDisplayColorCalibration(int64_t display_id, | 176 void DisplayColorManager::ApplyDisplayColorCalibration(int64_t display_id, |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 248 calibration_map_[product_id] = data.release(); | 243 calibration_map_[product_id] = data.release(); |
| 249 ApplyDisplayColorCalibration(display_id, product_id); | 244 ApplyDisplayColorCalibration(display_id, product_id); |
| 250 } | 245 } |
| 251 } | 246 } |
| 252 | 247 |
| 253 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} | 248 DisplayColorManager::ColorCalibrationData::ColorCalibrationData() {} |
| 254 | 249 |
| 255 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} | 250 DisplayColorManager::ColorCalibrationData::~ColorCalibrationData() {} |
| 256 | 251 |
| 257 } // namespace ash | 252 } // namespace ash |
| OLD | NEW |