| 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_DRM_GPU_DRM_CONSOLE_BUFFER_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_GPU_DRM_CONSOLE_BUFFER_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_CONSOLE_BUFFER_H_ | 6 #define UI_OZONE_PLATFORM_DRM_GPU_DRM_CONSOLE_BUFFER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
| 13 #include "skia/ext/refptr.h" | 13 #include "third_party/skia/include/core/SkImage.h" |
| 14 #include "third_party/skia/include/core/SkSurface.h" | 14 #include "third_party/skia/include/core/SkSurface.h" |
| 15 | 15 |
| 16 class SkCanvas; | 16 class SkCanvas; |
| 17 | 17 |
| 18 namespace ui { | 18 namespace ui { |
| 19 | 19 |
| 20 class DrmDevice; | 20 class DrmDevice; |
| 21 | 21 |
| 22 // Wrapper for the console buffer. This is the buffer that is allocated by | 22 // Wrapper for the console buffer. This is the buffer that is allocated by |
| 23 // default by the system and is used when no application is controlling the | 23 // default by the system and is used when no application is controlling the |
| 24 // CRTC. Keeps track of the native properties of the buffer and wraps the pixel | 24 // CRTC. Keeps track of the native properties of the buffer and wraps the pixel |
| 25 // memory into a SkSurface which can be used to draw into using Skia. | 25 // memory into a SkSurface which can be used to draw into using Skia. |
| 26 class DrmConsoleBuffer { | 26 class DrmConsoleBuffer { |
| 27 public: | 27 public: |
| 28 DrmConsoleBuffer(const scoped_refptr<DrmDevice>& drm, uint32_t framebuffer); | 28 DrmConsoleBuffer(const scoped_refptr<DrmDevice>& drm, uint32_t framebuffer); |
| 29 ~DrmConsoleBuffer(); | 29 ~DrmConsoleBuffer(); |
| 30 | 30 |
| 31 SkCanvas* canvas() { return surface_->getCanvas(); } | 31 SkCanvas* canvas() { return surface_->getCanvas(); } |
| 32 skia::RefPtr<SkImage> image() { | 32 sk_sp<SkImage> image() { return surface_->makeImageSnapshot(); } |
| 33 return skia::AdoptRef(surface_->newImageSnapshot()); | |
| 34 } | |
| 35 | 33 |
| 36 // Memory map the backing pixels and wrap them in |surface_|. | 34 // Memory map the backing pixels and wrap them in |surface_|. |
| 37 bool Initialize(); | 35 bool Initialize(); |
| 38 | 36 |
| 39 protected: | 37 protected: |
| 40 scoped_refptr<DrmDevice> drm_; | 38 scoped_refptr<DrmDevice> drm_; |
| 41 | 39 |
| 42 // Wrapper around the native pixel memory. | 40 // Wrapper around the native pixel memory. |
| 43 sk_sp<SkSurface> surface_; | 41 sk_sp<SkSurface> surface_; |
| 44 | 42 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 56 | 54 |
| 57 // Memory map size. | 55 // Memory map size. |
| 58 size_t mmap_size_ = 0; | 56 size_t mmap_size_ = 0; |
| 59 | 57 |
| 60 DISALLOW_COPY_AND_ASSIGN(DrmConsoleBuffer); | 58 DISALLOW_COPY_AND_ASSIGN(DrmConsoleBuffer); |
| 61 }; | 59 }; |
| 62 | 60 |
| 63 } // namespace ui | 61 } // namespace ui |
| 64 | 62 |
| 65 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_CONSOLE_BUFFER_H_ | 63 #endif // UI_OZONE_PLATFORM_DRM_GPU_DRM_CONSOLE_BUFFER_H_ |
| OLD | NEW |