| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/gfx/buffer_types.h" | 10 #include "ui/gfx/buffer_types.h" |
| 11 #include "ui/gfx/client_native_pixmap.h" |
| 11 #include "ui/gl/gl_image_native_pixmap.h" | 12 #include "ui/gl/gl_image_native_pixmap.h" |
| 12 #include "ui/gl/test/gl_image_test_template.h" | 13 #include "ui/gl/test/gl_image_test_template.h" |
| 13 #include "ui/ozone/public/client_native_pixmap.h" | 14 #include "ui/ozone/public/client_native_pixmap_factory_ozone.h" |
| 14 #include "ui/ozone/public/client_native_pixmap_factory.h" | |
| 15 #include "ui/ozone/public/ozone_platform.h" | 15 #include "ui/ozone/public/ozone_platform.h" |
| 16 #include "ui/ozone/public/surface_factory_ozone.h" | 16 #include "ui/ozone/public/surface_factory_ozone.h" |
| 17 | 17 |
| 18 namespace gl { | 18 namespace gl { |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 const uint8_t kRed[] = {0xF0, 0x0, 0x0, 0xFF}; | 21 const uint8_t kRed[] = {0xF0, 0x0, 0x0, 0xFF}; |
| 22 const uint8_t kGreen[] = {0x0, 0xFF, 0x0, 0xFF}; | 22 const uint8_t kGreen[] = {0x0, 0xFF, 0x0, 0xFF}; |
| 23 | 23 |
| 24 // These values are picked so that RGB -> YVU on the CPU converted | 24 // These values are picked so that RGB -> YVU on the CPU converted |
| 25 // back to RGB on the GPU produces the original RGB values without | 25 // back to RGB on the GPU produces the original RGB values without |
| 26 // any error. | 26 // any error. |
| 27 const uint8_t kYvuColor[] = {0x10, 0x20, 0, 0xFF}; | 27 const uint8_t kYvuColor[] = {0x10, 0x20, 0, 0xFF}; |
| 28 | 28 |
| 29 template <gfx::BufferUsage usage, gfx::BufferFormat format> | 29 template <gfx::BufferUsage usage, gfx::BufferFormat format> |
| 30 class GLImageNativePixmapTestDelegate { | 30 class GLImageNativePixmapTestDelegate { |
| 31 public: | 31 public: |
| 32 GLImageNativePixmapTestDelegate() { | 32 GLImageNativePixmapTestDelegate() { |
| 33 client_pixmap_factory_ = ui::ClientNativePixmapFactory::Create(); | 33 client_pixmap_factory_ = ui::CreateClientNativePixmapFactoryOzone(); |
| 34 } | 34 } |
| 35 scoped_refptr<GLImage> CreateSolidColorImage(const gfx::Size& size, | 35 scoped_refptr<GLImage> CreateSolidColorImage(const gfx::Size& size, |
| 36 const uint8_t color[4]) const { | 36 const uint8_t color[4]) const { |
| 37 ui::SurfaceFactoryOzone* surface_factory = | 37 ui::SurfaceFactoryOzone* surface_factory = |
| 38 ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); | 38 ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); |
| 39 scoped_refptr<ui::NativePixmap> pixmap = | 39 scoped_refptr<ui::NativePixmap> pixmap = |
| 40 surface_factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size, | 40 surface_factory->CreateNativePixmap(gfx::kNullAcceleratedWidget, size, |
| 41 format, usage); | 41 format, usage); |
| 42 DCHECK(pixmap); | 42 DCHECK(pixmap); |
| 43 if (usage == gfx::BufferUsage::GPU_READ_CPU_READ_WRITE) { | 43 if (usage == gfx::BufferUsage::GPU_READ_CPU_READ_WRITE) { |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageNativePixmapReadWrite, | 105 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageNativePixmapReadWrite, |
| 106 GLImageTest, | 106 GLImageTest, |
| 107 GLImageReadWriteType); | 107 GLImageReadWriteType); |
| 108 | 108 |
| 109 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageNativePixmap, | 109 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageNativePixmap, |
| 110 GLImageBindTest, | 110 GLImageBindTest, |
| 111 GLImageBindTestTypes); | 111 GLImageBindTestTypes); |
| 112 | 112 |
| 113 } // namespace | 113 } // namespace |
| 114 } // namespace gl | 114 } // namespace gl |
| OLD | NEW |