| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 CHROME_BROWSER_CHROMEOS_DISPLAY_OVERSCAN_CALIBRATOR_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DISPLAY_OVERSCAN_CALIBRATOR_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_OVERSCAN_CALIBRATOR_H_ | 6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_OVERSCAN_CALIBRATOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "ui/compositor/layer_delegate.h" | 11 #include "ui/compositor/layer_delegate.h" |
| 12 #include "ui/gfx/display.h" | 12 #include "ui/display/display.h" |
| 13 #include "ui/gfx/geometry/insets.h" | 13 #include "ui/gfx/geometry/insets.h" |
| 14 #include "ui/gfx/geometry/rect.h" | 14 #include "ui/gfx/geometry/rect.h" |
| 15 | 15 |
| 16 namespace ui { | 16 namespace ui { |
| 17 class Layer; | 17 class Layer; |
| 18 } | 18 } |
| 19 | 19 |
| 20 namespace chromeos { | 20 namespace chromeos { |
| 21 | 21 |
| 22 // This is used to show the visible feedback to the user's operations for | 22 // This is used to show the visible feedback to the user's operations for |
| 23 // calibrating display overscan settings. | 23 // calibrating display overscan settings. |
| 24 class OverscanCalibrator : public ui::LayerDelegate { | 24 class OverscanCalibrator : public ui::LayerDelegate { |
| 25 public: | 25 public: |
| 26 OverscanCalibrator(const gfx::Display& target_display, | 26 OverscanCalibrator(const display::Display& target_display, |
| 27 const gfx::Insets& initial_insets); | 27 const gfx::Insets& initial_insets); |
| 28 ~OverscanCalibrator() override; | 28 ~OverscanCalibrator() override; |
| 29 | 29 |
| 30 // Commits the current insets data to the system. | 30 // Commits the current insets data to the system. |
| 31 void Commit(); | 31 void Commit(); |
| 32 | 32 |
| 33 // Reset the overscan insets to default value. If the display has | 33 // Reset the overscan insets to default value. If the display has |
| 34 // overscan, the default value is the display's default overscan | 34 // overscan, the default value is the display's default overscan |
| 35 // value. Otherwise, the default value is the old |initial_insets_|. | 35 // value. Otherwise, the default value is the old |initial_insets_|. |
| 36 void Reset(); | 36 void Reset(); |
| 37 | 37 |
| 38 // Updates the insets and redraw the visual feedback. | 38 // Updates the insets and redraw the visual feedback. |
| 39 void UpdateInsets(const gfx::Insets& insets); | 39 void UpdateInsets(const gfx::Insets& insets); |
| 40 | 40 |
| 41 const gfx::Insets& insets() const { return insets_; } | 41 const gfx::Insets& insets() const { return insets_; } |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 // ui::LayerDelegate overrides: | 44 // ui::LayerDelegate overrides: |
| 45 void OnPaintLayer(const ui::PaintContext& context) override; | 45 void OnPaintLayer(const ui::PaintContext& context) override; |
| 46 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; | 46 void OnDelegatedFrameDamage(const gfx::Rect& damage_rect_in_dip) override; |
| 47 void OnDeviceScaleFactorChanged(float device_scale_factor) override; | 47 void OnDeviceScaleFactorChanged(float device_scale_factor) override; |
| 48 base::Closure PrepareForLayerBoundsChange() override; | 48 base::Closure PrepareForLayerBoundsChange() override; |
| 49 | 49 |
| 50 // The target display. | 50 // The target display. |
| 51 const gfx::Display display_; | 51 const display::Display display_; |
| 52 | 52 |
| 53 // The current insets. | 53 // The current insets. |
| 54 gfx::Insets insets_; | 54 gfx::Insets insets_; |
| 55 | 55 |
| 56 // The insets initially given. Stored so we can undo the insets later. | 56 // The insets initially given. Stored so we can undo the insets later. |
| 57 gfx::Insets initial_insets_; | 57 gfx::Insets initial_insets_; |
| 58 | 58 |
| 59 // Whether the current insets are committed to the system or not. | 59 // Whether the current insets are committed to the system or not. |
| 60 bool committed_; | 60 bool committed_; |
| 61 | 61 |
| 62 // The visualization layer for the current calibration region. | 62 // The visualization layer for the current calibration region. |
| 63 std::unique_ptr<ui::Layer> calibration_layer_; | 63 std::unique_ptr<ui::Layer> calibration_layer_; |
| 64 | 64 |
| 65 DISALLOW_COPY_AND_ASSIGN(OverscanCalibrator); | 65 DISALLOW_COPY_AND_ASSIGN(OverscanCalibrator); |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 } // namespace chromeos | 68 } // namespace chromeos |
| 69 | 69 |
| 70 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_OVERSCAN_CALIBRATOR_H_ | 70 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_OVERSCAN_CALIBRATOR_H_ |
| OLD | NEW |