| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include "ui/ozone/platform/wayland/wayland_surface_factory.h" | 5 #include "ui/ozone/platform/wayland/wayland_surface_factory.h" |
| 6 | 6 |
| 7 #include <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <sys/mman.h> | 8 #include <sys/mman.h> |
| 9 | 9 |
| 10 #include "base/memory/shared_memory.h" | 10 #include "base/memory/shared_memory.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 gfx::Size size_; | 40 gfx::Size size_; |
| 41 skia::RefPtr<SkSurface> sk_surface_; | 41 skia::RefPtr<SkSurface> sk_surface_; |
| 42 wl::Object<wl_shm_pool> pool_; | 42 wl::Object<wl_shm_pool> pool_; |
| 43 wl::Object<wl_buffer> buffer_; | 43 wl::Object<wl_buffer> buffer_; |
| 44 | 44 |
| 45 DISALLOW_COPY_AND_ASSIGN(WaylandCanvasSurface); | 45 DISALLOW_COPY_AND_ASSIGN(WaylandCanvasSurface); |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 WaylandCanvasSurface::WaylandCanvasSurface(WaylandDisplay* display, | 48 WaylandCanvasSurface::WaylandCanvasSurface(WaylandDisplay* display, |
| 49 WaylandWindow* window) | 49 WaylandWindow* window) |
| 50 : display_(display), window_(window) {} | 50 : display_(display), window_(window), size_(window->GetBounds().size()) {} |
| 51 | 51 |
| 52 WaylandCanvasSurface::~WaylandCanvasSurface() {} | 52 WaylandCanvasSurface::~WaylandCanvasSurface() {} |
| 53 | 53 |
| 54 skia::RefPtr<SkSurface> WaylandCanvasSurface::GetSurface() { | 54 skia::RefPtr<SkSurface> WaylandCanvasSurface::GetSurface() { |
| 55 if (sk_surface_) | 55 if (sk_surface_) |
| 56 return sk_surface_; | 56 return sk_surface_; |
| 57 | 57 |
| 58 size_t length = size_.width() * size_.height() * 4; | 58 size_t length = size_.width() * size_.height() * 4; |
| 59 auto shared_memory = make_scoped_ptr(new base::SharedMemory); | 59 auto shared_memory = make_scoped_ptr(new base::SharedMemory); |
| 60 if (!shared_memory->CreateAndMapAnonymous(length)) | 60 if (!shared_memory->CreateAndMapAnonymous(length)) |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 return nullptr; | 164 return nullptr; |
| 165 } | 165 } |
| 166 | 166 |
| 167 scoped_refptr<NativePixmap> WaylandSurfaceFactory::CreateNativePixmapFromHandle( | 167 scoped_refptr<NativePixmap> WaylandSurfaceFactory::CreateNativePixmapFromHandle( |
| 168 const gfx::NativePixmapHandle& handle) { | 168 const gfx::NativePixmapHandle& handle) { |
| 169 NOTIMPLEMENTED(); | 169 NOTIMPLEMENTED(); |
| 170 return nullptr; | 170 return nullptr; |
| 171 } | 171 } |
| 172 | 172 |
| 173 } // namespace ui | 173 } // namespace ui |
| OLD | NEW |