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/buffer_types.h" |
10 #include "ui/gfx/native_pixmap_handle_ozone.h" | 11 #include "ui/gfx/native_pixmap_handle_ozone.h" |
11 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
12 #include "ui/gfx/overlay_transform.h" | 13 #include "ui/gfx/overlay_transform.h" |
13 | 14 |
14 namespace gfx { | 15 namespace gfx { |
15 class Rect; | 16 class Rect; |
16 class RectF; | 17 class RectF; |
17 } | 18 } |
18 | 19 |
19 namespace ui { | 20 namespace ui { |
20 | 21 |
21 // This represents a buffer that can be directly imported via GL for | 22 // This represents a buffer that can be directly imported via GL for |
22 // rendering, or exported via dma-buf fds. | 23 // rendering, or exported via dma-buf fds. |
23 class NativePixmap : public base::RefCountedThreadSafe<NativePixmap> { | 24 class NativePixmap : public base::RefCountedThreadSafe<NativePixmap> { |
24 public: | 25 public: |
25 NativePixmap() {} | 26 NativePixmap() {} |
26 | 27 |
27 virtual void* /* EGLClientBuffer */ GetEGLClientBuffer() const = 0; | 28 virtual void* /* EGLClientBuffer */ GetEGLClientBuffer() const = 0; |
28 virtual int GetDmaBufFd() const = 0; | 29 virtual int GetDmaBufFd() const = 0; |
29 virtual int GetDmaBufPitch() const = 0; | 30 virtual int GetDmaBufPitch() const = 0; |
30 virtual gfx::BufferFormat GetBufferFormat() const = 0; | 31 virtual gfx::BufferFormat GetBufferFormat() const = 0; |
31 virtual gfx::Size GetBufferSize() const = 0; | 32 virtual gfx::Size GetBufferSize() const = 0; |
32 | 33 |
33 // Sets the overlay plane to switch to at the next page flip. | 34 // Sets the overlay plane to switch to at the next page flip. |
34 // |w| specifies the screen to display this overlay plane on. | 35 // |w| specifies the screen to display this overlay plane on. |
35 // |plane_z_order| specifies the stacking order of the plane relative to the | 36 // |plane_z_order| specifies the stacking order of the plane relative to the |
36 // main framebuffer located at index 0. | 37 // main framebuffer located at index 0. |
37 // |plane_transform| specifies how the buffer is to be transformed during. | 38 // |plane_transform| specifies how the buffer is to be transformed during. |
38 // composition. | 39 // composition. |
| 40 // |storage_format| specifies the optimal storage format which can be |
| 41 // supported by the platform during composition. |
39 // |buffer| to be presented by the overlay. | 42 // |buffer| to be presented by the overlay. |
40 // |display_bounds| specify where it is supposed to be on the screen. | 43 // |display_bounds| specify where it is supposed to be on the screen. |
41 // |crop_rect| specifies the region within the buffer to be placed | 44 // |crop_rect| specifies the region within the buffer to be placed |
42 // inside |display_bounds|. This is specified in texture coordinates, in the | 45 // inside |display_bounds|. This is specified in texture coordinates, in the |
43 // range of [0,1]. | 46 // range of [0,1]. |
44 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 47 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
45 int plane_z_order, | 48 int plane_z_order, |
46 gfx::OverlayTransform plane_transform, | 49 gfx::OverlayTransform plane_transform, |
| 50 gfx::BufferFormat storage_format, |
47 const gfx::Rect& display_bounds, | 51 const gfx::Rect& display_bounds, |
48 const gfx::RectF& crop_rect) = 0; | 52 const gfx::RectF& crop_rect, |
| 53 bool handle_scaling) = 0; |
49 | 54 |
50 // This represents a callback function pointing to processing unit like VPP to | 55 // This represents a callback function pointing to processing unit like VPP to |
51 // do post-processing operations like scaling and color space conversion on | 56 // do post-processing operations like scaling and color space conversion on |
52 // |source_pixmap| and save processed result to |target_pixmap|. | 57 // |source_pixmap| and save processed result to |target_pixmap|. |
53 typedef base::Callback<bool(const scoped_refptr<NativePixmap>& source_pixmap, | 58 typedef base::Callback<bool(const scoped_refptr<NativePixmap>& source_pixmap, |
54 scoped_refptr<NativePixmap> target_pixmap)> | 59 scoped_refptr<NativePixmap> target_pixmap)> |
55 ProcessingCallback; | 60 ProcessingCallback; |
56 | 61 |
57 // Set callback function for the pixmap used for post processing. | 62 // Set callback function for the pixmap used for post processing. |
58 virtual void SetProcessingCallback( | 63 virtual void SetProcessingCallback( |
(...skipping 11 matching lines...) Expand all Loading... |
70 | 75 |
71 private: | 76 private: |
72 friend class base::RefCountedThreadSafe<NativePixmap>; | 77 friend class base::RefCountedThreadSafe<NativePixmap>; |
73 | 78 |
74 DISALLOW_COPY_AND_ASSIGN(NativePixmap); | 79 DISALLOW_COPY_AND_ASSIGN(NativePixmap); |
75 }; | 80 }; |
76 | 81 |
77 } // namespace ui | 82 } // namespace ui |
78 | 83 |
79 #endif // UI_OZONE_PUBLIC_NATIVE_PIXMAP_H_ | 84 #endif // UI_OZONE_PUBLIC_NATIVE_PIXMAP_H_ |
OLD | NEW |