Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "ui/gfx/linux/native_pixmap_dmabuf_stub.h" | |
| 6 | |
| 7 namespace gfx { | |
| 8 | |
| 9 NativePixmapDmaBufStub::NativePixmapDmaBufStub( | |
| 10 const gfx::Size& size, | |
| 11 gfx::BufferFormat format, | |
| 12 const gfx::NativePixmapHandle& handle) | |
| 13 : size_(size), format_(format) { | |
| 14 for (auto& fd : handle.fds) { | |
| 15 fds_.emplace_back(fd.fd); | |
| 16 } | |
| 17 | |
| 18 for (const auto& plane : handle.planes) { | |
| 19 planes_.push_back(plane); | |
| 20 } | |
| 21 } | |
| 22 | |
| 23 NativePixmapDmaBufStub::~NativePixmapDmaBufStub() {} | |
| 24 | |
| 25 void* NativePixmapDmaBufStub::GetEGLClientBuffer() const { | |
| 26 return nullptr; | |
| 27 } | |
| 28 | |
| 29 bool NativePixmapDmaBufStub::AreDmaBufFdsValid() const { | |
| 30 if (fds_.empty()) | |
| 31 return false; | |
| 32 | |
| 33 for (const auto& fd : fds_) { | |
| 34 if (fd.get() == -1) | |
| 35 return false; | |
| 36 } | |
| 37 return true; | |
| 38 } | |
| 39 | |
| 40 size_t NativePixmapDmaBufStub::GetDmaBufFdCount() const { | |
| 41 return fds_.size(); | |
| 42 } | |
| 43 | |
| 44 int NativePixmapDmaBufStub::GetDmaBufFd(size_t index) const { | |
| 45 DCHECK_LT(index, fds_.size()); | |
| 46 return fds_[index].get(); | |
| 47 } | |
| 48 | |
| 49 int NativePixmapDmaBufStub::GetDmaBufPitch(size_t index) const { | |
| 50 DCHECK_LT(index, planes_.size()); | |
| 51 return planes_[index].stride; | |
| 52 } | |
| 53 | |
| 54 int NativePixmapDmaBufStub::GetDmaBufOffset(size_t index) const { | |
| 55 DCHECK_LT(index, planes_.size()); | |
| 56 return planes_[index].offset; | |
| 57 } | |
| 58 | |
| 59 uint64_t NativePixmapDmaBufStub::GetDmaBufModifier(size_t index) const { | |
| 60 DCHECK_LT(index, planes_.size()); | |
| 61 return planes_[index].modifier; | |
| 62 } | |
| 63 | |
| 64 gfx::BufferFormat NativePixmapDmaBufStub::GetBufferFormat() const { | |
| 65 return format_; | |
| 66 } | |
| 67 | |
| 68 gfx::Size NativePixmapDmaBufStub::GetBufferSize() const { | |
| 69 return size_; | |
| 70 } | |
| 71 | |
| 72 bool NativePixmapDmaBufStub::ScheduleOverlayPlane( | |
| 73 gfx::AcceleratedWidget widget, | |
| 74 int plane_z_order, | |
| 75 gfx::OverlayTransform plane_transform, | |
| 76 const gfx::Rect& display_bounds, | |
| 77 const gfx::RectF& crop_rect) | |
| 78 | |
| 79 { | |
|
spang
2017/04/21 15:11:49
Wrong whitespace, please run clang-format / git cl
Julien Isorce
2017/04/24 12:26:00
Done.
| |
| 80 return false; | |
| 81 } | |
| 82 | |
| 83 void NativePixmapDmaBufStub::SetProcessingCallback( | |
| 84 const ProcessingCallback& processing_callback) {} | |
| 85 | |
| 86 gfx::NativePixmapHandle NativePixmapDmaBufStub::ExportHandle() { | |
| 87 return gfx::NativePixmapHandle(); | |
| 88 } | |
| 89 | |
| 90 } // namespace gfx | |
| OLD | NEW |