| 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 #include <wayland-client.h> | 9 #include <wayland-client.h> |
| 10 | 10 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 sk_sp<SkSurface> WaylandCanvasSurface::GetSurface() { | 61 sk_sp<SkSurface> WaylandCanvasSurface::GetSurface() { |
| 62 if (sk_surface_) | 62 if (sk_surface_) |
| 63 return sk_surface_; | 63 return sk_surface_; |
| 64 | 64 |
| 65 size_t length = size_.width() * size_.height() * 4; | 65 size_t length = size_.width() * size_.height() * 4; |
| 66 auto shared_memory = base::WrapUnique(new base::SharedMemory); | 66 auto shared_memory = base::WrapUnique(new base::SharedMemory); |
| 67 if (!shared_memory->CreateAndMapAnonymous(length)) | 67 if (!shared_memory->CreateAndMapAnonymous(length)) |
| 68 return nullptr; | 68 return nullptr; |
| 69 | 69 |
| 70 wl::Object<wl_shm_pool> pool(wl_shm_create_pool( | 70 wl::Object<wl_shm_pool> pool(wl_shm_create_pool( |
| 71 connection_->shm(), shared_memory->handle().fd, length)); | 71 connection_->shm(), shared_memory->handle().GetHandle(), length)); |
| 72 if (!pool) | 72 if (!pool) |
| 73 return nullptr; | 73 return nullptr; |
| 74 wl::Object<wl_buffer> buffer( | 74 wl::Object<wl_buffer> buffer( |
| 75 wl_shm_pool_create_buffer(pool.get(), 0, size_.width(), size_.height(), | 75 wl_shm_pool_create_buffer(pool.get(), 0, size_.width(), size_.height(), |
| 76 size_.width() * 4, WL_SHM_FORMAT_ARGB8888)); | 76 size_.width() * 4, WL_SHM_FORMAT_ARGB8888)); |
| 77 if (!buffer) | 77 if (!buffer) |
| 78 return nullptr; | 78 return nullptr; |
| 79 | 79 |
| 80 sk_surface_ = SkSurface::MakeRasterDirectReleaseProc( | 80 sk_surface_ = SkSurface::MakeRasterDirectReleaseProc( |
| 81 SkImageInfo::MakeN32Premul(size_.width(), size_.height()), | 81 SkImageInfo::MakeN32Premul(size_.width(), size_.height()), |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 WaylandSurfaceFactory::CreateNativePixmapFromHandle( | 235 WaylandSurfaceFactory::CreateNativePixmapFromHandle( |
| 236 gfx::AcceleratedWidget widget, | 236 gfx::AcceleratedWidget widget, |
| 237 gfx::Size size, | 237 gfx::Size size, |
| 238 gfx::BufferFormat format, | 238 gfx::BufferFormat format, |
| 239 const gfx::NativePixmapHandle& handle) { | 239 const gfx::NativePixmapHandle& handle) { |
| 240 NOTIMPLEMENTED(); | 240 NOTIMPLEMENTED(); |
| 241 return nullptr; | 241 return nullptr; |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace ui | 244 } // namespace ui |
| OLD | NEW |