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