Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / ui / ozone / public / native_pixmap.h
blob5bb007ad8d07a551ea17f8e6db5a31eb151b3192
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_
8 #include "base/bind.h"
9 #include "base/memory/ref_counted.h"
10 #include "ui/gfx/native_pixmap_handle_ozone.h"
11 #include "ui/gfx/native_widget_types.h"
12 #include "ui/gfx/overlay_transform.h"
14 namespace gfx {
15 class Rect;
16 class RectF;
19 namespace ui {
21 // This represents a buffer that can be directly imported via GL for
22 // rendering, or exported via dma-buf fds.
23 class NativePixmap : public base::RefCountedThreadSafe<NativePixmap> {
24 public:
25 NativePixmap() {}
27 virtual void* /* EGLClientBuffer */ GetEGLClientBuffer() = 0;
28 virtual int GetDmaBufFd() = 0;
29 virtual int GetDmaBufPitch() = 0;
31 // Sets the overlay plane to switch to at the next page flip.
32 // |w| specifies the screen to display this overlay plane on.
33 // |plane_z_order| specifies the stacking order of the plane relative to the
34 // main framebuffer located at index 0.
35 // |plane_transform| specifies how the buffer is to be transformed during.
36 // composition.
37 // |buffer| to be presented by the overlay.
38 // |display_bounds| specify where it is supposed to be on the screen.
39 // |crop_rect| specifies the region within the buffer to be placed
40 // inside |display_bounds|. This is specified in texture coordinates, in the
41 // range of [0,1].
42 virtual bool ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
43 int plane_z_order,
44 gfx::OverlayTransform plane_transform,
45 const gfx::Rect& display_bounds,
46 const gfx::RectF& crop_rect) = 0;
48 // This represents a callback function pointing to scaling unit like VPP
49 // to do scaling operations on native pixmap with required size.
50 typedef base::Callback<scoped_refptr<NativePixmap>(gfx::Size)>
51 ScalingCallback;
53 // Set callback function for the pixmap used for scaling.
54 virtual void SetScalingCallback(const ScalingCallback& scaling_callback) = 0;
55 virtual scoped_refptr<NativePixmap> GetScaledPixmap(gfx::Size new_size) = 0;
57 // Export the buffer for sharing across processes.
58 // Any file descriptors in the exported handle are owned by the caller.
59 virtual gfx::NativePixmapHandle ExportHandle() = 0;
61 protected:
62 virtual ~NativePixmap() {}
64 private:
65 friend class base::RefCountedThreadSafe<NativePixmap>;
67 DISALLOW_COPY_AND_ASSIGN(NativePixmap);
70 } // namespace ui
72 #endif // UI_OZONE_PUBLIC_NATIVE_PIXMAP_H_