| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_MUS_GLES2_GPU_MEMORY_BUFFER_IMPL_H_ |
| 6 #define COMPONENTS_MUS_GLES2_GPU_MEMORY_BUFFER_IMPL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "gpu/command_buffer/common/sync_token.h" |
| 12 #include "ui/gfx/geometry/size.h" |
| 13 #include "ui/gfx/gpu_memory_buffer.h" |
| 14 #include "ui/ozone/public/native_pixmap.h" |
| 15 |
| 16 namespace mus { |
| 17 |
| 18 // Provides common implementation of a GPU memory buffer. |
| 19 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { |
| 20 public: |
| 21 ~GpuMemoryBufferImpl() override; |
| 22 |
| 23 // Type-checking upcast routine. Returns an NULL on failure. |
| 24 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); |
| 25 |
| 26 // Overridden from gfx::GpuMemoryBuffer: |
| 27 gfx::Size GetSize() const override; |
| 28 gfx::BufferFormat GetFormat() const override; |
| 29 gfx::GpuMemoryBufferId GetId() const override; |
| 30 ClientBuffer AsClientBuffer() override; |
| 31 |
| 32 // Returns the type of this GpuMemoryBufferImpl. |
| 33 virtual gfx::GpuMemoryBufferType GetBufferType() const = 0; |
| 34 |
| 35 // Returns a ui::NativePixmap when one is available. |
| 36 virtual scoped_refptr<ui::NativePixmap> GetNativePixmap(); |
| 37 |
| 38 protected: |
| 39 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, |
| 40 const gfx::Size& size, |
| 41 gfx::BufferFormat format); |
| 42 |
| 43 const gfx::GpuMemoryBufferId id_; |
| 44 const gfx::Size size_; |
| 45 const gfx::BufferFormat format_; |
| 46 bool mapped_; |
| 47 |
| 48 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); |
| 50 }; |
| 51 |
| 52 } // namespace mus |
| 53 |
| 54 #endif // COMPONENTS_MUS_GLES2_GPU_MEMORY_BUFFER_IMPL_H_ |
| OLD | NEW |