| 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 UI_AURA_MUS_CPP_GPU_MEMORY_BUFFER_IMPL_H_ | |
| 6 #define UI_AURA_MUS_CPP_GPU_MEMORY_BUFFER_IMPL_H_ | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/callback.h" | |
| 11 #include "base/macros.h" | |
| 12 #include "ui/gfx/geometry/size.h" | |
| 13 #include "ui/gfx/gpu_memory_buffer.h" | |
| 14 | |
| 15 #if defined(USE_OZONE) | |
| 16 #include "ui/ozone/public/native_pixmap.h" | |
| 17 #endif | |
| 18 | |
| 19 namespace aura { | |
| 20 | |
| 21 // Provides common implementation of a GPU memory buffer. | |
| 22 class GpuMemoryBufferImpl : public gfx::GpuMemoryBuffer { | |
| 23 public: | |
| 24 ~GpuMemoryBufferImpl() override; | |
| 25 | |
| 26 // Type-checking upcast routine. Returns an NULL on failure. | |
| 27 static GpuMemoryBufferImpl* FromClientBuffer(ClientBuffer buffer); | |
| 28 | |
| 29 // Overridden from gfx::GpuMemoryBuffer: | |
| 30 gfx::Size GetSize() const override; | |
| 31 gfx::BufferFormat GetFormat() const override; | |
| 32 gfx::GpuMemoryBufferId GetId() const override; | |
| 33 ClientBuffer AsClientBuffer() override; | |
| 34 | |
| 35 // Returns the type of this GpuMemoryBufferImpl. | |
| 36 virtual gfx::GpuMemoryBufferType GetBufferType() const = 0; | |
| 37 | |
| 38 #if defined(USE_OZONE) | |
| 39 // Returns a ui::NativePixmap when one is available. | |
| 40 virtual scoped_refptr<ui::NativePixmap> GetNativePixmap(); | |
| 41 #endif | |
| 42 | |
| 43 protected: | |
| 44 GpuMemoryBufferImpl(gfx::GpuMemoryBufferId id, | |
| 45 const gfx::Size& size, | |
| 46 gfx::BufferFormat format); | |
| 47 | |
| 48 const gfx::GpuMemoryBufferId id_; | |
| 49 const gfx::Size size_; | |
| 50 const gfx::BufferFormat format_; | |
| 51 bool mapped_; | |
| 52 | |
| 53 private: | |
| 54 DISALLOW_COPY_AND_ASSIGN(GpuMemoryBufferImpl); | |
| 55 }; | |
| 56 | |
| 57 } // namespace aura | |
| 58 | |
| 59 #endif // UI_AURA_MUS_CPP_GPU_MEMORY_BUFFER_IMPL_H_ | |
| OLD | NEW |