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

Unified Diff: ui/gl/test/gl_image_test_support.cc

Issue 2786103003: Add half-float IOSurface GpuMemoryBuffer support (Closed)
Patch Set: Review feedback Created 3 years, 8 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_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/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 9034918f5574a8bcdb143c4476ff374cb41119b7..b77b2fd9d3863fd9553c0a50210d3647139f864a 100644
--- a/ui/gl/test/gl_image_test_support.cc
+++ b/ui/gl/test/gl_image_test_support.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "ui/gfx/half_float.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/init/gl_factory.h"
#include "ui/gl/test/gl_surface_test_support.h"
@@ -113,6 +114,25 @@ void GLImageTestSupport::SetBufferDataToColor(int width,
}
}
return;
+ case gfx::BufferFormat::RGBA_F16: {
+ DCHECK_EQ(0, plane);
+ float float_color[4] = {
+ color[0] / 255.f, color[1] / 255.f, color[2] / 255.f,
+ color[3] / 255.f,
+ };
+ uint16_t half_float_color[4];
+ gfx::FloatToHalfFloat(float_color, half_float_color, 4);
+ for (int y = 0; y < height; ++y) {
+ uint16_t* row = reinterpret_cast<uint16_t*>(data + y * stride);
+ for (int x = 0; x < width; ++x) {
+ row[x * 4 + 0] = half_float_color[0];
+ row[x * 4 + 1] = half_float_color[1];
+ row[x * 4 + 2] = half_float_color[2];
+ row[x * 4 + 3] = half_float_color[3];
+ }
+ }
+ return;
+ }
case gfx::BufferFormat::YVU_420: {
DCHECK_LT(plane, 3);
DCHECK_EQ(0, height % 2);
« no previous file with comments | « ui/gl/gl_image_native_pixmap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698