Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: ui/gl/gl_image_io_surface_unittest.cc

Issue 1419733005: gpu: Add YCbCr 420v extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address reveman's comments. Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "testing/gtest/include/gtest/gtest.h"
6 #include "ui/gfx/mac/io_surface_manager.h"
7 #include "ui/gl/gl_image_io_surface.h"
8 #include "ui/gl/test/gl_image_test_template.h"
9
10 namespace gfx {
11 namespace {
12
13 class GLImageIOSurface420vTestDelegate {
14 public:
15 scoped_refptr<gl::GLImage> CreateSolidColorImage(
16 const Size& size,
17 const uint8_t color[4]) const {
18 scoped_refptr<gl::GLImageIOSurface> image(
19 new gl::GLImageIOSurface(size, GL_RGB_YCBCR_420V_CHROMIUM));
20 IOSurfaceRef surface_ref =
21 IOSurfaceManager::CreateIOSurface(size, BufferFormat::YUV_420_BIPLANAR);
22 IOReturn status = IOSurfaceLock(surface_ref, 0, nullptr);
23 EXPECT_NE(status, kIOReturnCannotLock);
24 void* y_data = IOSurfaceGetBaseAddressOfPlane(surface_ref, 0);
25 void* uv_data = IOSurfaceGetBaseAddressOfPlane(surface_ref, 1);
26
27 GLImageTestSupport::SetBufferDataToColor(
28 size.width(), size.height(),
29 IOSurfaceGetBytesPerRowOfPlane(surface_ref, 0), 0,
30 BufferFormat::YUV_420_BIPLANAR, color, static_cast<uint8_t*>(y_data));
31 GLImageTestSupport::SetBufferDataToColor(
32 size.width(), size.height(),
33 IOSurfaceGetBytesPerRowOfPlane(surface_ref, 1), 1,
34 BufferFormat::YUV_420_BIPLANAR, color, static_cast<uint8_t*>(uv_data));
35 IOSurfaceUnlock(surface_ref, 0, nullptr);
36
37 bool rv = image->Initialize(surface_ref, GenericSharedMemoryId(1),
38 BufferFormat::YUV_420_BIPLANAR);
39 EXPECT_TRUE(rv);
40
41 return image;
42 }
43 };
44
45 INSTANTIATE_TYPED_TEST_CASE_P(GLImageIOSurface,
46 GLImageTest,
47 GLImageIOSurface420vTestDelegate);
reveman 2015/11/02 01:09:44 nit: we should run this test for every format we s
Daniele Castagna 2015/11/02 19:35:51 Done.
48
49 INSTANTIATE_TYPED_TEST_CASE_P(GLImageIOSurface,
50 GLImageCopyTest,
51 GLImageIOSurface420vTestDelegate);
52
53 } // namespace
54 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698