OLD | NEW |
| (Empty) |
1 // Copyright 2013 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_GFX_OZONE_IMPL_DRI_SKBITMAP_H_ | |
6 #define UI_GFX_OZONE_IMPL_DRI_SKBITMAP_H_ | |
7 | |
8 #include "base/basictypes.h" | |
9 #include "third_party/skia/include/core/SkBitmap.h" | |
10 | |
11 namespace gfx { | |
12 | |
13 // Extend the SkBitmap interface to keep track of additional parameters used by | |
14 // the DRM stack when allocating buffers. | |
15 class DriSkBitmap : public SkBitmap { | |
16 public: | |
17 DriSkBitmap(int fd); | |
18 virtual ~DriSkBitmap(); | |
19 | |
20 // Allocates the backing pixels using DRI. | |
21 // Return true on success, false otherwise. | |
22 virtual bool Initialize(); | |
23 | |
24 uint32_t get_handle() const { return handle_; }; | |
25 | |
26 uint32_t get_framebuffer() const { return framebuffer_; }; | |
27 | |
28 int get_fd() const { return fd_; }; | |
29 | |
30 // Return the color depth of a pixel in this buffer. | |
31 uint8_t GetColorDepth() const; | |
32 | |
33 private: | |
34 friend class DriAllocator; | |
35 friend class HardwareDisplayController; | |
36 | |
37 void set_handle(uint32_t handle) { handle_ = handle; }; | |
38 void set_framebuffer(uint32_t framebuffer) { framebuffer_ = framebuffer; }; | |
39 | |
40 // File descriptor used by the DRI allocator to request buffers from the DRI | |
41 // stack. | |
42 int fd_; | |
43 | |
44 // Buffer handle used by the DRI allocator. | |
45 uint32_t handle_; | |
46 | |
47 // Buffer ID used by the DRI modesettings API. This is set when the buffer is | |
48 // registered with the CRTC. | |
49 uint32_t framebuffer_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(DriSkBitmap); | |
52 }; | |
53 | |
54 } // namespace gfx | |
55 | |
56 #endif // UI_GFX_OZONE_IMPL_DRI_SKBITMAP_H_ | |
OLD | NEW |