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

Unified Diff: ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc

Issue 2262353002: gl: Add YV12 to bind image unittests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@yuv-test-image
Patch Set: Rebase on Master. Use a different color for YVU tests. Created 4 years, 3 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/ozone/gl/gl_image_ozone_native_pixmap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc
diff --git a/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc b/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc
index 78514efaf6d53440fdd5c284f47dad084cc0da0e..fea23aa039d3b8b8019eb1fba37bda0685c0983f 100644
--- a/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc
+++ b/ui/ozone/gl/gl_image_ozone_native_pixmap_unittest.cc
@@ -21,6 +21,11 @@ namespace {
const uint8_t kRed[] = {0xF0, 0x0, 0x0, 0xFF};
const uint8_t kGreen[] = {0x0, 0xFF, 0x0, 0xFF};
+// These values are picked so that RGB -> YVU on the CPU converted
+// back to RGB on the GPU produces the original RGB values without
+// any error.
+const uint8_t kYvuColor[] = {0x10, 0x20, 0, 0xFF};
+
template <gfx::BufferUsage usage, gfx::BufferFormat format>
class GLImageOzoneNativePixmapTestDelegate {
public:
@@ -62,7 +67,12 @@ class GLImageOzoneNativePixmapTestDelegate {
unsigned GetTextureTarget() const { return GL_TEXTURE_EXTERNAL_OES; }
const uint8_t* GetImageColor() {
- return format == gfx::BufferFormat::R_8 ? kRed : kGreen;
+ if (format == gfx::BufferFormat::R_8) {
+ return kRed;
+ } else if (format == gfx::BufferFormat::YVU_420) {
+ return kYvuColor;
+ }
+ return kGreen;
}
private:
@@ -88,7 +98,10 @@ using GLImageBindTestTypes =
gfx::BufferFormat::BGRA_8888>,
GLImageOzoneNativePixmapTestDelegate<
gfx::BufferUsage::GPU_READ_CPU_READ_WRITE,
- gfx::BufferFormat::R_8>>;
+ gfx::BufferFormat::R_8>,
+ GLImageOzoneNativePixmapTestDelegate<
+ gfx::BufferUsage::GPU_READ_CPU_READ_WRITE,
+ gfx::BufferFormat::YVU_420>>;
// These tests are disabled since the trybots are running with Ozone X11
// implementation that doesn't support creating ClientNativePixmap.
« no previous file with comments | « ui/ozone/gl/gl_image_ozone_native_pixmap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698