forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcast_display_configurator.h
86 lines (69 loc) · 2.99 KB
/
cast_display_configurator.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROMECAST_BROWSER_CAST_DISPLAY_CONFIGURATOR_H_
#define CHROMECAST_BROWSER_CAST_DISPLAY_CONFIGURATOR_H_
#include <memory>
#include <vector>
#include "base/containers/flat_map.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "ui/display/display.h"
#include "ui/display/types/display_configuration_params.h"
#include "ui/display/types/native_display_delegate.h"
#include "ui/display/types/native_display_observer.h"
namespace display {
class DisplayMode;
class DisplaySnapshot;
struct GammaRampRGBEntry;
} // namespace display
namespace gfx {
class Point;
} // namespace gfx
namespace chromecast {
class CastScreen;
namespace shell {
class CastTouchDeviceManager;
// The CastDisplayConfigurator class ensures native displays are initialized and
// configured properly on platforms that need that (e.g. GBM/DRM graphics via
// OzonePlatformGbm on odroid). But OzonePlatformCast, used by most Cast
// devices, relies on the platform code (outside of cast_shell) to initialize
// displays and exposes only a FakeDisplayDelegate. So CastDisplayConfigurator
// doesn't really do anything when using OzonePlatformCast.
class CastDisplayConfigurator : public display::NativeDisplayObserver {
public:
explicit CastDisplayConfigurator(CastScreen* screen);
~CastDisplayConfigurator() override;
// display::NativeDisplayObserver implementation
void OnConfigurationChanged() override;
void OnDisplaySnapshotsInvalidated() override {}
void EnableDisplay(display::ConfigureCallback callback);
void DisableDisplay(display::ConfigureCallback callback);
void ConfigureDisplayFromCommandLine();
void SetColorMatrix(const std::vector<float>& color_matrix);
void SetGammaCorrection(
const std::vector<display::GammaRampRGBEntry>& degamma_lut,
const std::vector<display::GammaRampRGBEntry>& gamma_lut);
private:
void ForceInitialConfigure();
void OnDisplaysAcquired(
bool force_initial_configure,
const std::vector<display::DisplaySnapshot*>& displays);
void OnDisplayConfigured(display::DisplaySnapshot* display,
const display::DisplayMode* mode,
const gfx::Point& origin,
const base::flat_map<int64_t, bool>& statuses);
void UpdateScreen(int64_t display_id,
const gfx::Rect& bounds,
float device_scale_factor,
display::Display::Rotation rotation);
std::unique_ptr<display::NativeDisplayDelegate> delegate_;
std::unique_ptr<CastTouchDeviceManager> touch_device_manager_;
display::DisplaySnapshot* display_;
CastScreen* const cast_screen_;
base::WeakPtrFactory<CastDisplayConfigurator> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CastDisplayConfigurator);
};
} // namespace shell
} // namespace chromecast
#endif // CHROMECAST_BROWSER_CAST_DISPLAY_CONFIGURATOR_H_