| 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 "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/gfx/buffer_types.h" | 8 #include "ui/gfx/buffer_types.h" |
| 9 #include "ui/gl/gl_image_ozone_native_pixmap.h" | |
| 10 #include "ui/gl/test/gl_image_test_template.h" | 9 #include "ui/gl/test/gl_image_test_template.h" |
| 10 #include "ui/ozone/gl/gl_image_ozone_native_pixmap.h" |
| 11 #include "ui/ozone/public/client_native_pixmap.h" | 11 #include "ui/ozone/public/client_native_pixmap.h" |
| 12 #include "ui/ozone/public/client_native_pixmap_factory.h" | 12 #include "ui/ozone/public/client_native_pixmap_factory.h" |
| 13 #include "ui/ozone/public/ozone_platform.h" | 13 #include "ui/ozone/public/ozone_platform.h" |
| 14 #include "ui/ozone/public/surface_factory_ozone.h" | 14 #include "ui/ozone/public/surface_factory_ozone.h" |
| 15 | 15 |
| 16 namespace gl { | 16 namespace gl { |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 const uint8_t kRed[] = {0xF0, 0x0, 0x0, 0xFF}; | 19 const uint8_t kRed[] = {0xF0, 0x0, 0x0, 0xFF}; |
| 20 const uint8_t kGreen[] = {0x0, 0xFF, 0x0, 0xFF}; | 20 const uint8_t kGreen[] = {0x0, 0xFF, 0x0, 0xFF}; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 37 auto client_pixmap = client_pixmap_factory_->ImportFromHandle( | 37 auto client_pixmap = client_pixmap_factory_->ImportFromHandle( |
| 38 pixmap->ExportHandle(), size, usage); | 38 pixmap->ExportHandle(), size, usage); |
| 39 void* data = client_pixmap->Map(); | 39 void* data = client_pixmap->Map(); |
| 40 EXPECT_TRUE(data); | 40 EXPECT_TRUE(data); |
| 41 GLImageTestSupport::SetBufferDataToColor( | 41 GLImageTestSupport::SetBufferDataToColor( |
| 42 size.width(), size.height(), pixmap->GetDmaBufPitch(0), 0, | 42 size.width(), size.height(), pixmap->GetDmaBufPitch(0), 0, |
| 43 pixmap->GetBufferFormat(), color, static_cast<uint8_t*>(data)); | 43 pixmap->GetBufferFormat(), color, static_cast<uint8_t*>(data)); |
| 44 client_pixmap->Unmap(); | 44 client_pixmap->Unmap(); |
| 45 } | 45 } |
| 46 | 46 |
| 47 scoped_refptr<GLImageOzoneNativePixmap> image(new GLImageOzoneNativePixmap( | 47 scoped_refptr<ui::GLImageOzoneNativePixmap> image( |
| 48 size, GLImageOzoneNativePixmap::GetInternalFormatForTesting(format))); | 48 new ui::GLImageOzoneNativePixmap( |
| 49 size, |
| 50 ui::GLImageOzoneNativePixmap::GetInternalFormatForTesting(format))); |
| 49 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat())); | 51 EXPECT_TRUE(image->Initialize(pixmap.get(), pixmap->GetBufferFormat())); |
| 50 return image; | 52 return image; |
| 51 } | 53 } |
| 52 | 54 |
| 53 unsigned GetTextureTarget() const { return GL_TEXTURE_EXTERNAL_OES; } | 55 unsigned GetTextureTarget() const { return GL_TEXTURE_EXTERNAL_OES; } |
| 54 | 56 |
| 55 const uint8_t* GetImageColor() { | 57 const uint8_t* GetImageColor() { |
| 56 return format == gfx::BufferFormat::R_8 ? kRed : kGreen; | 58 return format == gfx::BufferFormat::R_8 ? kRed : kGreen; |
| 57 } | 59 } |
| 58 | 60 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 87 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapReadWrite, | 89 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmapReadWrite, |
| 88 GLImageTest, | 90 GLImageTest, |
| 89 GLImageReadWriteType); | 91 GLImageReadWriteType); |
| 90 | 92 |
| 91 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmap, | 93 INSTANTIATE_TYPED_TEST_CASE_P(DISABLED_GLImageOzoneNativePixmap, |
| 92 GLImageBindTest, | 94 GLImageBindTest, |
| 93 GLImageBindTestTypes); | 95 GLImageBindTestTypes); |
| 94 | 96 |
| 95 } // namespace | 97 } // namespace |
| 96 } // namespace gl | 98 } // namespace gl |
| OLD | NEW |