forked from zoltan-ongithub/ozone-egl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ozone_platform_egl.cc
82 lines (71 loc) · 2.63 KB
/
ozone_platform_egl.cc
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
// Copyright 2014 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.
#include "ui/ozone/platform/egl/ozone_platform_egl.h"
#include "ui/ozone/platform/egl/egl_surface_factory.h"
#include "ui/ozone/public/cursor_factory_ozone.h"
#include "ui/ozone/public/gpu_platform_support.h"
#include "ui/ozone/public/gpu_platform_support_host.h"
#include "ui/events/ozone/device/device_manager.h"
#include "ui/events/ozone/evdev/event_factory_evdev.h"
#include "ui/ozone/ozone_platform.h"
#include "egl_wrapper.h"
namespace ui {
namespace {
class OzonePlatformEgl : public OzonePlatform {
public:
OzonePlatformEgl()
{
}
virtual ~OzonePlatformEgl() {
}
// OzonePlatform:
virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE {
return surface_factory_ozone_.get();
}
virtual EventFactoryOzone* GetEventFactoryOzone() OVERRIDE {
return event_factory_ozone_.get();
}
virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE {
return cursor_factory_ozone_.get();
}
virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE {
return gpu_platform_support_.get();
}
virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE {
return gpu_platform_support_host_.get();
}
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
OVERRIDE {
return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateOzone());
}
#endif
virtual void InitializeUI() OVERRIDE {
device_manager_ = CreateDeviceManager();
event_factory_ozone_.reset(
new EventFactoryEvdev(NULL, device_manager_.get()));
surface_factory_ozone_.reset(new SurfaceFactoryEgl());
cursor_factory_ozone_.reset(new CursorFactoryOzone());
gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
}
virtual void InitializeGPU() OVERRIDE {
surface_factory_ozone_.reset(new SurfaceFactoryEgl());
cursor_factory_ozone_.reset(new CursorFactoryOzone());
gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
}
private:
scoped_ptr<DeviceManager> device_manager_;
scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
scoped_ptr<SurfaceFactoryEgl> surface_factory_ozone_;
scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
DISALLOW_COPY_AND_ASSIGN(OzonePlatformEgl);
};
} // namespace
OzonePlatform* CreateOzonePlatformEgl() {
OzonePlatformEgl* platform = new OzonePlatformEgl;
return platform;
}
} // namespace ui