Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Unified Diff: ui/gfx/linux/native_pixmap_dmabuf_stub.cc

Issue 2705213005: Add NativePixmapDmabufStub to finalize glCreateImageCHROMIUM on Linux. (Closed)
Patch Set: Rebase and addressed remarks Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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
« ui/gfx/linux/native_pixmap_dmabuf_stub.h ('K') | « ui/gfx/linux/native_pixmap_dmabuf_stub.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698