| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "ui/ozone/platform/cast/client_native_pixmap_factory_cast.h" | 5 #include "ui/ozone/platform/cast/client_native_pixmap_factory_cast.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "ui/gfx/buffer_types.h" | 9 #include "ui/gfx/buffer_types.h" |
| 10 #include "ui/gfx/client_native_pixmap.h" | 10 #include "ui/gfx/client_native_pixmap.h" |
| 11 #include "ui/gfx/client_native_pixmap_factory.h" | 11 #include "ui/gfx/client_native_pixmap_factory.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 namespace { | 14 namespace { |
| 15 | 15 |
| 16 // Dummy ClientNativePixmap implementation for Cast ozone. | 16 // Dummy ClientNativePixmap implementation for Cast ozone. |
| 17 // Our NativePixmaps are just used to plumb an overlay frame through, | 17 // Our NativePixmaps are just used to plumb an overlay frame through, |
| 18 // so they get instantiated, but not used. | 18 // so they get instantiated, but not used. |
| 19 class ClientNativePixmapCast : public ClientNativePixmap { | 19 class ClientNativePixmapCast : public gfx::ClientNativePixmap { |
| 20 public: | 20 public: |
| 21 // ClientNativePixmap implementation: | 21 // ClientNativePixmap implementation: |
| 22 bool Map() override { | 22 bool Map() override { |
| 23 NOTREACHED(); | 23 NOTREACHED(); |
| 24 return false; | 24 return false; |
| 25 } | 25 } |
| 26 void* GetMemoryAddress(size_t plane) const override { | 26 void* GetMemoryAddress(size_t plane) const override { |
| 27 NOTREACHED(); | 27 NOTREACHED(); |
| 28 return nullptr; | 28 return nullptr; |
| 29 }; | 29 }; |
| 30 void Unmap() override { NOTREACHED(); } | 30 void Unmap() override { NOTREACHED(); } |
| 31 int GetStride(size_t plane) const override { | 31 int GetStride(size_t plane) const override { |
| 32 NOTREACHED(); | 32 NOTREACHED(); |
| 33 return 0; | 33 return 0; |
| 34 } | 34 } |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class ClientNativePixmapFactoryCast : public ClientNativePixmapFactory { | 37 class ClientNativePixmapFactoryCast : public gfx::ClientNativePixmapFactory { |
| 38 public: | 38 public: |
| 39 // ClientNativePixmapFactoryCast implementation: | 39 // ClientNativePixmapFactoryCast implementation: |
| 40 bool IsConfigurationSupported(gfx::BufferFormat format, | 40 bool IsConfigurationSupported(gfx::BufferFormat format, |
| 41 gfx::BufferUsage usage) const override { | 41 gfx::BufferUsage usage) const override { |
| 42 return format == gfx::BufferFormat::RGBA_8888 && | 42 return format == gfx::BufferFormat::RGBA_8888 && |
| 43 usage == gfx::BufferUsage::SCANOUT; | 43 usage == gfx::BufferUsage::SCANOUT; |
| 44 } | 44 } |
| 45 | 45 |
| 46 std::unique_ptr<ClientNativePixmap> ImportFromHandle( | 46 std::unique_ptr<gfx::ClientNativePixmap> ImportFromHandle( |
| 47 const gfx::NativePixmapHandle& handle, | 47 const gfx::NativePixmapHandle& handle, |
| 48 const gfx::Size& size, | 48 const gfx::Size& size, |
| 49 gfx::BufferUsage usage) override { | 49 gfx::BufferUsage usage) override { |
| 50 return base::MakeUnique<ClientNativePixmapCast>(); | 50 return base::MakeUnique<ClientNativePixmapCast>(); |
| 51 } | 51 } |
| 52 }; | 52 }; |
| 53 | 53 |
| 54 } // namespace | 54 } // namespace |
| 55 | 55 |
| 56 ClientNativePixmapFactory* CreateClientNativePixmapFactoryCast() { | 56 gfx::ClientNativePixmapFactory* CreateClientNativePixmapFactoryCast() { |
| 57 return new ClientNativePixmapFactoryCast(); | 57 return new ClientNativePixmapFactoryCast(); |
| 58 } | 58 } |
| 59 | 59 |
| 60 } // namespace ui | 60 } // namespace ui |
| OLD | NEW |