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

Unified Diff: ui/gl/gl_image_io_surface.mm

Issue 2945673002: Allow creating GLImage-backed textures with glTexStorage2D. (Closed)
Patch Set: rebase Created 3 years, 4 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_io_surface.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_image_io_surface.mm
diff --git a/ui/gl/gl_image_io_surface.mm b/ui/gl/gl_image_io_surface.mm
index c9fabee5a262ca1981680274e241c27770d08fbe..362bd8ecc68b25b4fbc805c01890a9306d2702b5 100644
--- a/ui/gl/gl_image_io_surface.mm
+++ b/ui/gl/gl_image_io_surface.mm
@@ -14,6 +14,7 @@
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
+#include "ui/gfx/icc_profile.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/scoped_binders.h"
@@ -417,6 +418,25 @@ GLImage::Type GLImageIOSurface::GetType() const {
return Type::IOSURFACE;
}
+void GLImageIOSurface::SetColorSpaceForScanout(
+ const gfx::ColorSpace& color_space) {
+ GLImage::SetColorSpaceForScanout(color_space);
+
+ // Retrieve the ICC profile data.
+ gfx::ICCProfile icc_profile;
+ if (!color_space.GetAsFullRangeRGB().GetICCProfile(&icc_profile)) {
+ LOG(ERROR) << "Failed to set color space for scanout: no ICC profile.";
+ return;
+ }
+
+ // Package it as a CFDataRef and send it to the IOSurface.
+ base::ScopedCFTypeRef<CFDataRef> cf_data_icc_profile(CFDataCreate(
+ nullptr, reinterpret_cast<const UInt8*>(icc_profile.GetData().data()),
+ icc_profile.GetData().size()));
+ IOSurfaceSetValue(io_surface_, CFSTR("IOSurfaceColorSpace"),
+ cf_data_icc_profile);
+}
+
// static
unsigned GLImageIOSurface::GetInternalFormatForTesting(
gfx::BufferFormat format) {
« no previous file with comments | « ui/gl/gl_image_io_surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698