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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/test/gl_image_test_support.cc
diff --git a/ui/gl/test/gl_image_test_support.cc b/ui/gl/test/gl_image_test_support.cc
index cb996b47e263afd9ed8e68f432954a526b908ca7..460f48a5673bcaf0f456c78bc0ba3962d4ade228 100644
--- a/ui/gl/test/gl_image_test_support.cc
+++ b/ui/gl/test/gl_image_test_support.cc
@@ -104,6 +104,32 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
}
}
return;
+ case gfx::BufferFormat::YVU_420: {
+ DCHECK_LT(plane, 3);
+ DCHECK_EQ(0, height % 2);
+ DCHECK_EQ(0, width % 2);
+ // These values are used in the transformation from YUV to RGB color
+ // values. They are taken from the following webpage:
+ // http://www.fourcc.org/fccyvrgb.php
+ uint8_t yvu[] = {
+ (0.257 * color[0]) + (0.504 * color[1]) + (0.098 * color[2]) + 16,
+ (0.439 * color[0]) - (0.368 * color[1]) - (0.071 * color[2]) + 128,
+ -(0.148 * color[0]) - (0.291 * color[1]) + (0.439 * color[2]) + 128};
+ if (plane == 0) {
+ for (int y = 0; y < height; ++y) {
+ for (int x = 0; x < width; ++x) {
+ data[stride * y + x] = yvu[0];
+ }
+ }
+ } else {
+ for (int y = 0; y < height / 2; ++y) {
+ for (int x = 0; x < width / 2; ++x) {
+ data[stride * y + x] = yvu[plane];
+ }
+ }
+ }
+ return;
+ }
case gfx::BufferFormat::YUV_420_BIPLANAR: {
DCHECK_LT(plane, 2);
DCHECK_EQ(0, height % 2);
@@ -138,7 +164,6 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
case gfx::BufferFormat::ETC1:
case gfx::BufferFormat::RGBA_4444:
case gfx::BufferFormat::UYVY_422:
- case gfx::BufferFormat::YVU_420:
NOTREACHED();
return;
}
« 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