| 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/ozone_export.h" |
| 12 #include "ui/ozone/platform/dri/scanout_buffer.h" | 12 #include "ui/ozone/platform/dri/scanout_buffer.h" |
| 13 | 13 |
| 14 namespace ui { | 14 namespace ui { |
| 15 | 15 |
| 16 class DriWrapper; | 16 class DriWrapper; |
| 17 | 17 |
| 18 // 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 |
| 19 // 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 |
| 20 // draw into using Skia. | 20 // draw into using Skia. |
| 21 class OZONE_EXPORT DriBuffer : public ScanoutBuffer { | 21 class OZONE_EXPORT DriBuffer : public ScanoutBuffer { |
| 22 public: | 22 public: |
| 23 DriBuffer(const scoped_refptr<DriWrapper>& dri); | 23 DriBuffer(const scoped_refptr<DriWrapper>& dri); |
| 24 | 24 |
| 25 // 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 |
| 26 // to describe the buffer characteristics (size, color format). | 26 // to describe the buffer characteristics (size, color format). |
| 27 bool Initialize(const SkImageInfo& info); | 27 // |should_register_framebuffer| is used to distinguish the buffers that are |
| 28 // used for modesetting. |
| 29 bool Initialize(const SkImageInfo& info, bool should_register_framebuffer); |
| 28 | 30 |
| 29 SkCanvas* GetCanvas() const; | 31 SkCanvas* GetCanvas() const; |
| 30 | 32 |
| 31 // ScanoutBuffer: | 33 // ScanoutBuffer: |
| 32 uint32_t GetFramebufferId() const override; | 34 uint32_t GetFramebufferId() const override; |
| 33 uint32_t GetHandle() const override; | 35 uint32_t GetHandle() const override; |
| 34 gfx::Size GetSize() const override; | 36 gfx::Size GetSize() const override; |
| 35 | 37 |
| 36 protected: | 38 protected: |
| 37 ~DriBuffer() override; | 39 ~DriBuffer() override; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 63 scoped_refptr<ScanoutBuffer> Create(const scoped_refptr<DriWrapper>& drm, | 65 scoped_refptr<ScanoutBuffer> Create(const scoped_refptr<DriWrapper>& drm, |
| 64 const gfx::Size& size) override; | 66 const gfx::Size& size) override; |
| 65 | 67 |
| 66 private: | 68 private: |
| 67 DISALLOW_COPY_AND_ASSIGN(DriBufferGenerator); | 69 DISALLOW_COPY_AND_ASSIGN(DriBufferGenerator); |
| 68 }; | 70 }; |
| 69 | 71 |
| 70 } // namespace ui | 72 } // namespace ui |
| 71 | 73 |
| 72 #endif // UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ | 74 #endif // UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ |
| OLD | NEW |