| 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_PLATFORM_DRI_DRI_BUFFER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ | 6 #define UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "skia/ext/refptr.h" | 9 #include "skia/ext/refptr.h" |
| 10 #include "third_party/skia/include/core/SkSurface.h" | 10 #include "third_party/skia/include/core/SkSurface.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class OZONE_EXPORT DriBuffer { | 22 class OZONE_EXPORT DriBuffer { |
| 23 public: | 23 public: |
| 24 DriBuffer(DriWrapper* dri); | 24 DriBuffer(DriWrapper* dri); |
| 25 virtual ~DriBuffer(); | 25 virtual ~DriBuffer(); |
| 26 | 26 |
| 27 uint32_t stride() const { return stride_; } | 27 uint32_t stride() const { return stride_; } |
| 28 uint32_t handle() const { return handle_; } | 28 uint32_t handle() const { return handle_; } |
| 29 uint32_t framebuffer() const { return framebuffer_; } | 29 uint32_t framebuffer() const { return framebuffer_; } |
| 30 SkCanvas* canvas() { return surface_->getCanvas(); } | 30 SkCanvas* canvas() { return surface_->getCanvas(); } |
| 31 | 31 |
| 32 // Return the color depth of a pixel in this buffer. | |
| 33 uint8_t GetColorDepth() const; | |
| 34 | |
| 35 // Allocates the backing pixels and wraps them in |surface_|. |info| is used | 32 // Allocates the backing pixels and wraps them in |surface_|. |info| is used |
| 36 // to describe the buffer characteristics (size, color format). | 33 // to describe the buffer characteristics (size, color format). |
| 37 virtual bool Initialize(const SkImageInfo& info); | 34 virtual bool Initialize(const SkImageInfo& info); |
| 38 | 35 |
| 39 protected: | 36 protected: |
| 40 friend class HardwareDisplayController; | |
| 41 | |
| 42 void set_framebuffer(uint32_t framebuffer) { framebuffer_ = framebuffer; } | |
| 43 | |
| 44 DriWrapper* dri_; // Not owned. | 37 DriWrapper* dri_; // Not owned. |
| 45 | 38 |
| 46 // Wrapper around the native pixel memory. | 39 // Wrapper around the native pixel memory. |
| 47 skia::RefPtr<SkSurface> surface_; | 40 skia::RefPtr<SkSurface> surface_; |
| 48 | 41 |
| 49 // Length of a row of pixels. | 42 // Length of a row of pixels. |
| 50 uint32_t stride_; | 43 uint32_t stride_; |
| 51 | 44 |
| 52 // Buffer handle used by the DRM allocator. | 45 // Buffer handle used by the DRM allocator. |
| 53 uint32_t handle_; | 46 uint32_t handle_; |
| 54 | 47 |
| 55 // Buffer ID used by the DRM modesettings API. This is set when the buffer is | 48 // Buffer ID used by the DRM modesettings API. This is set when the buffer is |
| 56 // registered with the CRTC. | 49 // registered with the CRTC. |
| 57 uint32_t framebuffer_; | 50 uint32_t framebuffer_; |
| 58 | 51 |
| 59 DISALLOW_COPY_AND_ASSIGN(DriBuffer); | 52 DISALLOW_COPY_AND_ASSIGN(DriBuffer); |
| 60 }; | 53 }; |
| 61 | 54 |
| 62 } // namespace ui | 55 } // namespace ui |
| 63 | 56 |
| 64 #endif // UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ | 57 #endif // UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ |
| OLD | NEW |