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

Side by Side Diff: ui/gl/test/gl_image_test_support.cc

Issue 2052543004: gl: Test YV12 buffer drm import. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@yv12-pixmap-support
Patch Set: Change patch dependency Created 4 years, 6 months 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
« no previous file with comments | « ui/gl/gl_image_ozone_native_pixmap_drm_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/gl/test/gl_image_test_support.h" 5 #include "ui/gl/test/gl_image_test_support.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ui/gl/gl_implementation.h" 9 #include "ui/gl/gl_implementation.h"
10 #include "ui/gl/test/gl_surface_test_support.h" 10 #include "ui/gl/test/gl_surface_test_support.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 DCHECK_EQ(0, plane); 97 DCHECK_EQ(0, plane);
98 for (int y = 0; y < height; ++y) { 98 for (int y = 0; y < height; ++y) {
99 for (int x = 0; x < width; ++x) { 99 for (int x = 0; x < width; ++x) {
100 data[y * stride + x * 4 + 0] = color[2]; 100 data[y * stride + x * 4 + 0] = color[2];
101 data[y * stride + x * 4 + 1] = color[1]; 101 data[y * stride + x * 4 + 1] = color[1];
102 data[y * stride + x * 4 + 2] = color[0]; 102 data[y * stride + x * 4 + 2] = color[0];
103 data[y * stride + x * 4 + 3] = color[3]; 103 data[y * stride + x * 4 + 3] = color[3];
104 } 104 }
105 } 105 }
106 return; 106 return;
107 case gfx::BufferFormat::YVU_420: {
108 DCHECK_LT(plane, 3);
109 DCHECK_EQ(0, height % 2);
110 DCHECK_EQ(0, width % 2);
111 // These values are used in the transformation from YUV to RGB color
112 // values. They are taken from the following webpage:
113 // http://www.fourcc.org/fccyvrgb.php
114 uint8_t yvu[] = {
115 (0.257 * color[0]) + (0.504 * color[1]) + (0.098 * color[2]) + 16,
116 (0.439 * color[0]) - (0.368 * color[1]) - (0.071 * color[2]) + 128,
117 -(0.148 * color[0]) - (0.291 * color[1]) + (0.439 * color[2]) + 128};
118 if (plane == 0) {
119 for (int y = 0; y < height; ++y) {
120 for (int x = 0; x < width; ++x) {
121 data[stride * y + x] = yvu[0];
122 }
123 }
124 } else {
125 for (int y = 0; y < height / 2; ++y) {
126 for (int x = 0; x < width / 2; ++x) {
127 data[stride * y + x] = yvu[plane];
128 }
129 }
130 }
131 return;
132 }
107 case gfx::BufferFormat::YUV_420_BIPLANAR: { 133 case gfx::BufferFormat::YUV_420_BIPLANAR: {
108 DCHECK_LT(plane, 2); 134 DCHECK_LT(plane, 2);
109 DCHECK_EQ(0, height % 2); 135 DCHECK_EQ(0, height % 2);
110 DCHECK_EQ(0, width % 2); 136 DCHECK_EQ(0, width % 2);
111 // These values are used in the transformation from YUV to RGB color 137 // These values are used in the transformation from YUV to RGB color
112 // values. They are taken from the following webpage: 138 // values. They are taken from the following webpage:
113 // http://www.fourcc.org/fccyvrgb.php 139 // http://www.fourcc.org/fccyvrgb.php
114 uint8_t yuv[] = { 140 uint8_t yuv[] = {
115 (0.257 * color[0]) + (0.504 * color[1]) + (0.098 * color[2]) + 16, 141 (0.257 * color[0]) + (0.504 * color[1]) + (0.098 * color[2]) + 16,
116 -(0.148 * color[0]) - (0.291 * color[1]) + (0.439 * color[2]) + 128, 142 -(0.148 * color[0]) - (0.291 * color[1]) + (0.439 * color[2]) + 128,
(...skipping 14 matching lines...) Expand all
131 } 157 }
132 return; 158 return;
133 } 159 }
134 case gfx::BufferFormat::ATC: 160 case gfx::BufferFormat::ATC:
135 case gfx::BufferFormat::ATCIA: 161 case gfx::BufferFormat::ATCIA:
136 case gfx::BufferFormat::DXT1: 162 case gfx::BufferFormat::DXT1:
137 case gfx::BufferFormat::DXT5: 163 case gfx::BufferFormat::DXT5:
138 case gfx::BufferFormat::ETC1: 164 case gfx::BufferFormat::ETC1:
139 case gfx::BufferFormat::RGBA_4444: 165 case gfx::BufferFormat::RGBA_4444:
140 case gfx::BufferFormat::UYVY_422: 166 case gfx::BufferFormat::UYVY_422:
141 case gfx::BufferFormat::YVU_420:
142 NOTREACHED(); 167 NOTREACHED();
143 return; 168 return;
144 } 169 }
145 NOTREACHED(); 170 NOTREACHED();
146 } 171 }
147 172
148 } // namespace gl 173 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_image_ozone_native_pixmap_drm_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698