| 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). |is_scanout| |
| 27 bool Initialize(const SkImageInfo& info); | 27 // is used to distinguish the buffers that are used for modesetting. |
| 28 bool Initialize(const SkImageInfo& info, bool is_scanout); |
| 28 | 29 |
| 29 SkCanvas* GetCanvas() const; | 30 SkCanvas* GetCanvas() const; |
| 30 | 31 |
| 31 // ScanoutBuffer: | 32 // ScanoutBuffer: |
| 32 uint32_t GetFramebufferId() const override; | 33 uint32_t GetFramebufferId() const override; |
| 33 uint32_t GetHandle() const override; | 34 uint32_t GetHandle() const override; |
| 34 gfx::Size GetSize() const override; | 35 gfx::Size GetSize() const override; |
| 35 | 36 |
| 36 protected: | 37 protected: |
| 37 ~DriBuffer() override; | 38 ~DriBuffer() override; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 63 scoped_refptr<ScanoutBuffer> Create(const scoped_refptr<DriWrapper>& drm, | 64 scoped_refptr<ScanoutBuffer> Create(const scoped_refptr<DriWrapper>& drm, |
| 64 const gfx::Size& size) override; | 65 const gfx::Size& size) override; |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 DISALLOW_COPY_AND_ASSIGN(DriBufferGenerator); | 68 DISALLOW_COPY_AND_ASSIGN(DriBufferGenerator); |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace ui | 71 } // namespace ui |
| 71 | 72 |
| 72 #endif // UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ | 73 #endif // UI_OZONE_PLATFORM_DRI_DRI_BUFFER_H_ |
| OLD | NEW |