Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / ozone / wayland / egl / surface_ozone_wayland.cc
1 // Copyright 2014 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "ozone/wayland/egl/surface_ozone_wayland.h"
6
7 #include "ozone/ui/gfx/vsync_provider_wayland.h"
8 #include "ozone/wayland/display.h"
9 #include "ozone/wayland/window.h"
10
11 namespace ozonewayland {
12
13 SurfaceOzoneWayland::SurfaceOzoneWayland(unsigned handle)
14     : handle_(handle) {
15 }
16
17 SurfaceOzoneWayland::~SurfaceOzoneWayland() {
18   WaylandDisplay::GetInstance()->DestroyWindow(handle_);
19   WaylandDisplay::GetInstance()->FlushDisplay();
20 }
21
22 intptr_t SurfaceOzoneWayland::GetNativeWindow() {
23   return WaylandDisplay::GetInstance()->GetNativeWindow(handle_);
24 }
25
26 bool SurfaceOzoneWayland::ResizeNativeWindow(
27     const gfx::Size& viewport_size) {
28   WaylandWindow* window = WaylandDisplay::GetInstance()->GetWindow(handle_);
29   DCHECK(window);
30   window->Resize(viewport_size.width(), viewport_size.height());
31   return true;
32 }
33
34 bool SurfaceOzoneWayland::OnSwapBuffers() {
35   return true;
36 }
37
38 scoped_ptr<gfx::VSyncProvider> SurfaceOzoneWayland::CreateVSyncProvider() {
39   return scoped_ptr<gfx::VSyncProvider>(new gfx::WaylandSyncProvider());
40 }
41
42 }  // namespace ozonewayland