| 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" |
| 11 #include "ui/ozone/ozone_export.h" |
| 11 #include "ui/ozone/platform/dri/scanout_buffer.h" | 12 #include "ui/ozone/platform/dri/scanout_buffer.h" |
| 12 | 13 |
| 13 namespace ui { | 14 namespace ui { |
| 14 | 15 |
| 15 class DriWrapper; | 16 class DriWrapper; |
| 16 | 17 |
| 17 // Wrapper for a DRM allocated buffer. Keeps track of the native properties of | 18 // Wrapper for a DRM allocated buffer. Keeps track of the native properties of |
| 18 // the buffer and wraps the pixel memory into a SkSurface which can be used to | 19 // the buffer and wraps the pixel memory into a SkSurface which can be used to |
| 19 // draw into using Skia. | 20 // draw into using Skia. |
| 20 class DriBuffer : public ScanoutBuffer { | 21 class OZONE_EXPORT DriBuffer : public ScanoutBuffer { |
| 21 public: | 22 public: |
| 22 DriBuffer(DriWrapper* dri); | 23 DriBuffer(DriWrapper* dri); |
| 23 | 24 |
| 24 // Allocates the backing pixels and wraps them in |surface_|. |info| is used | 25 // Allocates the backing pixels and wraps them in |surface_|. |info| is used |
| 25 // to describe the buffer characteristics (size, color format). | 26 // to describe the buffer characteristics (size, color format). |
| 26 bool Initialize(const SkImageInfo& info); | 27 bool Initialize(const SkImageInfo& info); |
| 27 | 28 |
| 28 SkCanvas* GetCanvas() const; | 29 SkCanvas* GetCanvas() const; |
| 29 | 30 |
| 30 // ScanoutBuffer: | 31 // ScanoutBuffer: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 46 // Buffer handle used by the DRM allocator. | 47 // Buffer handle used by the DRM allocator. |
| 47 uint32_t handle_; | 48 uint32_t handle_; |
| 48 | 49 |
| 49 // Buffer ID used by the DRM modesettings API. This is set when the buffer is | 50 // Buffer ID used by the DRM modesettings API. This is set when the buffer is |
| 50 // registered with the CRTC. | 51 // registered with the CRTC. |
| 51 uint32_t framebuffer_; | 52 uint32_t framebuffer_; |
| 52 | 53 |
| 53 DISALLOW_COPY_AND_ASSIGN(DriBuffer); | 54 DISALLOW_COPY_AND_ASSIGN(DriBuffer); |
| 54 }; | 55 }; |
| 55 | 56 |
| 56 class DriBufferGenerator : public ScanoutBufferGenerator { | 57 class OZONE_EXPORT DriBufferGenerator : public ScanoutBufferGenerator { |
| 57 public: | 58 public: |
| 58 DriBufferGenerator(); | 59 DriBufferGenerator(); |
| 59 ~DriBufferGenerator() override; | 60 ~DriBufferGenerator() override; |
| 60 | 61 |
| 61 // ScanoutBufferGenerator: | 62 // ScanoutBufferGenerator: |
| 62 scoped_refptr<ScanoutBuffer> Create(DriWrapper* drm, | 63 scoped_refptr<ScanoutBuffer> Create(DriWrapper* drm, |
| 63 const gfx::Size& size) override; | 64 const gfx::Size& size) override; |
| 64 | 65 |
| 65 private: | 66 private: |
| 66 DISALLOW_COPY_AND_ASSIGN(DriBufferGenerator); | 67 DISALLOW_COPY_AND_ASSIGN(DriBufferGenerator); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace ui | 70 } // namespace ui |
| 70 | 71 |
| 71 #endif // UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ | 72 #endif // UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ |
| OLD | NEW |