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