| OLD | NEW |
| (Empty) |
| 1 // Copyright 2014 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 #ifndef UI_OZONE_PUBLIC_NATIVE_PIXMAP_H_ | |
| 6 #define UI_OZONE_PUBLIC_NATIVE_PIXMAP_H_ | |
| 7 | |
| 8 #include "base/bind.h" | |
| 9 #include "base/macros.h" | |
| 10 #include "base/memory/ref_counted.h" | |
| 11 #include "ui/gfx/buffer_types.h" | |
| 12 #include "ui/gfx/native_pixmap_handle.h" | |
| 13 #include "ui/gfx/native_widget_types.h" | |
| 14 #include "ui/gfx/overlay_transform.h" | |
| 15 | |
| 16 namespace gfx { | |
| 17 class Rect; | |
| 18 class RectF; | |
| 19 } | |
| 20 | |
| 21 namespace ui { | |
| 22 | |
| 23 // This represents a buffer that can be directly imported via GL for | |
| 24 // rendering, or exported via dma-buf fds. | |
| 25 class NativePixmap : public base::RefCountedThreadSafe<NativePixmap> { | |
| 26 public: | |
| 27 NativePixmap() {} | |
| 28 | |
| 29 virtual void* /* EGLClientBuffer */ GetEGLClientBuffer() const = 0; | |
| 30 virtual bool AreDmaBufFdsValid() const = 0; | |
| 31 virtual size_t GetDmaBufFdCount() const = 0; | |
| 32 virtual int GetDmaBufFd(size_t plane) const = 0; | |
| 33 virtual int GetDmaBufPitch(size_t plane) const = 0; | |
| 34 virtual int GetDmaBufOffset(size_t plane) const = 0; | |
| 35 virtual uint64_t GetDmaBufModifier(size_t plane) const = 0; | |
| 36 virtual gfx::BufferFormat GetBufferFormat() const = 0; | |
| 37 virtual gfx::Size GetBufferSize() const = 0; | |
| 38 | |
| 39 // Sets the overlay plane to switch to at the next page flip. | |
| 40 // |widget| specifies the screen to display this overlay plane on. | |
| 41 // |plane_z_order| specifies the stacking order of the plane relative to the | |
| 42 // main framebuffer located at index 0. | |
| 43 // |plane_transform| specifies how the buffer is to be transformed during | |
| 44 // composition. | |
| 45 // |display_bounds| specify where it is supposed to be on the screen. | |
| 46 // |crop_rect| specifies the region within the buffer to be placed | |
| 47 // inside |display_bounds|. This is specified in texture coordinates, in the | |
| 48 // range of [0,1]. | |
| 49 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | |
| 50 int plane_z_order, | |
| 51 gfx::OverlayTransform plane_transform, | |
| 52 const gfx::Rect& display_bounds, | |
| 53 const gfx::RectF& crop_rect) = 0; | |
| 54 | |
| 55 // This represents a callback function pointing to processing unit like VPP to | |
| 56 // do post-processing operations like scaling and color space conversion on | |
| 57 // |source_pixmap| and save processed result to |target_pixmap|. | |
| 58 typedef base::Callback<bool(const scoped_refptr<NativePixmap>& source_pixmap, | |
| 59 scoped_refptr<NativePixmap> target_pixmap)> | |
| 60 ProcessingCallback; | |
| 61 | |
| 62 // Set callback function for the pixmap used for post processing. | |
| 63 virtual void SetProcessingCallback( | |
| 64 const ProcessingCallback& processing_callback) = 0; | |
| 65 | |
| 66 // Export the buffer for sharing across processes. | |
| 67 // Any file descriptors in the exported handle are owned by the caller. | |
| 68 virtual gfx::NativePixmapHandle ExportHandle() = 0; | |
| 69 | |
| 70 protected: | |
| 71 virtual ~NativePixmap() {} | |
| 72 | |
| 73 private: | |
| 74 friend class base::RefCountedThreadSafe<NativePixmap>; | |
| 75 | |
| 76 DISALLOW_COPY_AND_ASSIGN(NativePixmap); | |
| 77 }; | |
| 78 | |
| 79 } // namespace ui | |
| 80 | |
| 81 #endif // UI_OZONE_PUBLIC_NATIVE_PIXMAP_H_ | |
| OLD | NEW |