| 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 #ifndef ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ | 5 #ifndef ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ | 6 #define ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "ash/ash_export.h" | 14 #include "ash/ash_export.h" |
| 15 #include "base/files/file_path.h" | 15 #include "base/files/file_path.h" |
| 16 #include "base/macros.h" | 16 #include "base/macros.h" |
| 17 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
| 19 #include "ui/display/manager/chromeos/display_configurator.h" | 19 #include "ui/display/manager/chromeos/display_configurator.h" |
| 20 #include "ui/display/types/display_constants.h" | 20 #include "ui/display/types/display_constants.h" |
| 21 | 21 |
| 22 namespace base { | 22 namespace base { |
| 23 class SequencedWorkerPool; | 23 class SequencedWorkerPool; |
| 24 } | 24 } |
| 25 | 25 |
| 26 namespace ui { | 26 namespace display { |
| 27 class DisplaySnapshot; | 27 class DisplaySnapshot; |
| 28 struct GammaRampRGBEntry; | 28 struct GammaRampRGBEntry; |
| 29 } // namespace ui | 29 } // namespace display |
| 30 | 30 |
| 31 namespace ash { | 31 namespace ash { |
| 32 | 32 |
| 33 // An object that observes changes in display configuration applies any color | 33 // An object that observes changes in display configuration applies any color |
| 34 // calibration where needed. | 34 // calibration where needed. |
| 35 class ASH_EXPORT DisplayColorManager | 35 class ASH_EXPORT DisplayColorManager |
| 36 : public ui::DisplayConfigurator::Observer { | 36 : public display::DisplayConfigurator::Observer { |
| 37 public: | 37 public: |
| 38 DisplayColorManager(ui::DisplayConfigurator* configurator, | 38 DisplayColorManager(display::DisplayConfigurator* configurator, |
| 39 base::SequencedWorkerPool* blocking_pool); | 39 base::SequencedWorkerPool* blocking_pool); |
| 40 ~DisplayColorManager() override; | 40 ~DisplayColorManager() override; |
| 41 | 41 |
| 42 // ui::DisplayConfigurator::Observer | 42 // display::DisplayConfigurator::Observer |
| 43 void OnDisplayModeChanged( | 43 void OnDisplayModeChanged( |
| 44 const ui::DisplayConfigurator::DisplayStateList& outputs) override; | 44 const display::DisplayConfigurator::DisplayStateList& outputs) override; |
| 45 void OnDisplayModeChangeFailed( | 45 void OnDisplayModeChangeFailed( |
| 46 const ui::DisplayConfigurator::DisplayStateList& displays, | 46 const display::DisplayConfigurator::DisplayStateList& displays, |
| 47 ui::MultipleDisplayState failed_new_state) override {} | 47 display::MultipleDisplayState failed_new_state) override {} |
| 48 | 48 |
| 49 struct ColorCalibrationData { | 49 struct ColorCalibrationData { |
| 50 ColorCalibrationData(); | 50 ColorCalibrationData(); |
| 51 ~ColorCalibrationData(); | 51 ~ColorCalibrationData(); |
| 52 | 52 |
| 53 std::vector<ui::GammaRampRGBEntry> degamma_lut; | 53 std::vector<display::GammaRampRGBEntry> degamma_lut; |
| 54 std::vector<ui::GammaRampRGBEntry> gamma_lut; | 54 std::vector<display::GammaRampRGBEntry> gamma_lut; |
| 55 std::vector<float> correction_matrix; | 55 std::vector<float> correction_matrix; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 protected: | 58 protected: |
| 59 virtual void FinishLoadCalibrationForDisplay(int64_t display_id, | 59 virtual void FinishLoadCalibrationForDisplay( |
| 60 int64_t product_id, | 60 int64_t display_id, |
| 61 bool has_color_correction_matrix, | 61 int64_t product_id, |
| 62 ui::DisplayConnectionType type, | 62 bool has_color_correction_matrix, |
| 63 const base::FilePath& path, | 63 display::DisplayConnectionType type, |
| 64 bool file_downloaded); | 64 const base::FilePath& path, |
| 65 bool file_downloaded); |
| 65 virtual void UpdateCalibrationData( | 66 virtual void UpdateCalibrationData( |
| 66 int64_t display_id, | 67 int64_t display_id, |
| 67 int64_t product_id, | 68 int64_t product_id, |
| 68 std::unique_ptr<ColorCalibrationData> data); | 69 std::unique_ptr<ColorCalibrationData> data); |
| 69 | 70 |
| 70 private: | 71 private: |
| 71 void ApplyDisplayColorCalibration(int64_t display_id, int64_t product_id); | 72 void ApplyDisplayColorCalibration(int64_t display_id, int64_t product_id); |
| 72 void LoadCalibrationForDisplay(const ui::DisplaySnapshot* display); | 73 void LoadCalibrationForDisplay(const display::DisplaySnapshot* display); |
| 73 | 74 |
| 74 ui::DisplayConfigurator* configurator_; | 75 display::DisplayConfigurator* configurator_; |
| 75 std::map<int64_t, std::unique_ptr<ColorCalibrationData>> calibration_map_; | 76 std::map<int64_t, std::unique_ptr<ColorCalibrationData>> calibration_map_; |
| 76 base::ThreadChecker thread_checker_; | 77 base::ThreadChecker thread_checker_; |
| 77 base::SequencedWorkerPool* blocking_pool_; | 78 base::SequencedWorkerPool* blocking_pool_; |
| 78 | 79 |
| 79 // Factory for callbacks. | 80 // Factory for callbacks. |
| 80 base::WeakPtrFactory<DisplayColorManager> weak_ptr_factory_; | 81 base::WeakPtrFactory<DisplayColorManager> weak_ptr_factory_; |
| 81 | 82 |
| 82 DISALLOW_COPY_AND_ASSIGN(DisplayColorManager); | 83 DISALLOW_COPY_AND_ASSIGN(DisplayColorManager); |
| 83 }; | 84 }; |
| 84 | 85 |
| 85 } // namespace ash | 86 } // namespace ash |
| 86 | 87 |
| 87 #endif // ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ | 88 #endif // ASH_DISPLAY_DISPLAY_COLOR_MANAGER_CHROMEOS_H_ |
| OLD | NEW |