Index: ui/gfx/linux/native_pixmap_dmabuf_stub.cc |
diff --git a/ui/gfx/linux/native_pixmap_dmabuf_stub.cc b/ui/gfx/linux/native_pixmap_dmabuf_stub.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..73a3615bb0408dbf54494c0495aa1c306da61590 |
--- /dev/null |
+++ b/ui/gfx/linux/native_pixmap_dmabuf_stub.cc |
@@ -0,0 +1,90 @@ |
+// Copyright 2016 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/gfx/linux/native_pixmap_dmabuf_stub.h" |
+ |
+namespace gfx { |
+ |
+NativePixmapDmaBufStub::NativePixmapDmaBufStub( |
+ const gfx::Size& size, |
+ gfx::BufferFormat format, |
+ const gfx::NativePixmapHandle& handle) |
+ : size_(size), format_(format) { |
+ for (auto& fd : handle.fds) { |
+ fds_.emplace_back(fd.fd); |
+ } |
+ |
+ for (const auto& plane : handle.planes) { |
+ planes_.push_back(plane); |
+ } |
+} |
+ |
+NativePixmapDmaBufStub::~NativePixmapDmaBufStub() {} |
+ |
+void* NativePixmapDmaBufStub::GetEGLClientBuffer() const { |
+ return nullptr; |
+} |
+ |
+bool NativePixmapDmaBufStub::AreDmaBufFdsValid() const { |
+ if (fds_.empty()) |
+ return false; |
+ |
+ for (const auto& fd : fds_) { |
+ if (fd.get() == -1) |
+ return false; |
+ } |
+ return true; |
+} |
+ |
+size_t NativePixmapDmaBufStub::GetDmaBufFdCount() const { |
+ return fds_.size(); |
+} |
+ |
+int NativePixmapDmaBufStub::GetDmaBufFd(size_t index) const { |
+ DCHECK_LT(index, fds_.size()); |
+ return fds_[index].get(); |
+} |
+ |
+int NativePixmapDmaBufStub::GetDmaBufPitch(size_t index) const { |
+ DCHECK_LT(index, planes_.size()); |
+ return planes_[index].stride; |
+} |
+ |
+int NativePixmapDmaBufStub::GetDmaBufOffset(size_t index) const { |
+ DCHECK_LT(index, planes_.size()); |
+ return planes_[index].offset; |
+} |
+ |
+uint64_t NativePixmapDmaBufStub::GetDmaBufModifier(size_t index) const { |
+ DCHECK_LT(index, planes_.size()); |
+ return planes_[index].modifier; |
+} |
+ |
+gfx::BufferFormat NativePixmapDmaBufStub::GetBufferFormat() const { |
+ return format_; |
+} |
+ |
+gfx::Size NativePixmapDmaBufStub::GetBufferSize() const { |
+ return size_; |
+} |
+ |
+bool NativePixmapDmaBufStub::ScheduleOverlayPlane( |
+ gfx::AcceleratedWidget widget, |
+ int plane_z_order, |
+ gfx::OverlayTransform plane_transform, |
+ const gfx::Rect& display_bounds, |
+ const gfx::RectF& crop_rect) |
+ |
+{ |
spang
2017/04/21 15:11:49
Wrong whitespace, please run clang-format / git cl
Julien Isorce
2017/04/24 12:26:00
Done.
|
+ return false; |
+} |
+ |
+void NativePixmapDmaBufStub::SetProcessingCallback( |
+ const ProcessingCallback& processing_callback) {} |
+ |
+gfx::NativePixmapHandle NativePixmapDmaBufStub::ExportHandle() { |
+ return gfx::NativePixmapHandle(); |
+} |
+ |
+} // namespace gfx |