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.
5 #ifndef UI_OZONE_PUBLIC_NATIVE_PIXMAP_H_
6 #define UI_OZONE_PUBLIC_NATIVE_PIXMAP_H_
9 #include "base/memory/ref_counted.h"
10 #include "ui/gfx/native_widget_types.h"
11 #include "ui/gfx/overlay_transform.h"
20 // This represents a buffer that can be directly imported via GL for
21 // rendering, or exported via dma-buf fds.
22 class NativePixmap
: public base::RefCountedThreadSafe
<NativePixmap
> {
26 virtual void* /* EGLClientBuffer */ GetEGLClientBuffer() = 0;
27 virtual int GetDmaBufFd() = 0;
28 virtual int GetDmaBufPitch() = 0;
30 // Sets the overlay plane to switch to at the next page flip.
31 // |w| specifies the screen to display this overlay plane on.
32 // |plane_z_order| specifies the stacking order of the plane relative to the
33 // main framebuffer located at index 0.
34 // |plane_transform| specifies how the buffer is to be transformed during.
36 // |buffer| to be presented by the overlay.
37 // |display_bounds| specify where it is supposed to be on the screen.
38 // |crop_rect| specifies the region within the buffer to be placed
39 // inside |display_bounds|. This is specified in texture coordinates, in the
41 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget
,
43 gfx::OverlayTransform plane_transform
,
44 const gfx::Rect
& display_bounds
,
45 const gfx::RectF
& crop_rect
) = 0;
47 // This represents a callback function pointing to scaling unit like VPP
48 // to do scaling operations on native pixmap with required size.
49 typedef base::Callback
<scoped_refptr
<NativePixmap
>(gfx::Size
)>
52 // Set callback function for the pixmap used for scaling.
53 virtual void SetScalingCallback(const ScalingCallback
& scaling_callback
) = 0;
54 virtual scoped_refptr
<NativePixmap
> GetScaledPixmap(gfx::Size new_size
) = 0;
57 virtual ~NativePixmap() {}
60 friend class base::RefCountedThreadSafe
<NativePixmap
>;
62 DISALLOW_COPY_AND_ASSIGN(NativePixmap
);
67 #endif // UI_OZONE_PUBLIC_NATIVE_PIXMAP_H_