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

Unified Diff: ui/gl/gl_image_io_surface.mm

Issue 1251783002: Mac Overlays: Wire up overlays on Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@part22
Patch Set: Add more dchecks Created 5 years, 5 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
Index: ui/gl/gl_image_io_surface.mm
diff --git a/ui/gl/gl_image_io_surface.cc b/ui/gl/gl_image_io_surface.mm
similarity index 88%
rename from ui/gl/gl_image_io_surface.cc
rename to ui/gl/gl_image_io_surface.mm
index adcadee363ab5499ca14bd43fbf5bff11378ba51..ea6aac2de856cf0eee6514ec1988d1c4a3cd5acf 100644
--- a/ui/gl/gl_image_io_surface.cc
+++ b/ui/gl/gl_image_io_surface.mm
@@ -4,10 +4,12 @@
#include "ui/gl/gl_image_io_surface.h"
+#include "base/mac/foundation_util.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
// Note that this must be included after gl_bindings.h to avoid conflicts.
+#include <Quartz/Quartz.h>
#include <OpenGL/CGLIOSurface.h>
namespace gfx {
@@ -192,7 +194,20 @@ bool GLImageIOSurface::ScheduleOverlayPlane(gfx::AcceleratedWidget widget,
OverlayTransform transform,
const Rect& bounds_rect,
const RectF& crop_rect) {
- return false;
+ // Only simple overlay planes are currently supported.
+ DCHECK_EQ(z_order, 0);
+ DCHECK_EQ(crop_rect.ToString(), gfx::RectF(0, 0, 1, 1).ToString());
+ DCHECK_EQ(transform, gfx::OVERLAY_TRANSFORM_NONE);
+
+ // Note that gfx::AcceleratedWidget does not actually map to CALayer in this
+ // context. It may be that the types should coincide.
+ CALayer* layer = base::mac::ObjCCastStrict<CALayer>(widget);
alexst (slow to review) 2015/07/22 14:38:02 In the type definitions #elif defined(OS_MACOSX)
ccameron 2015/07/23 05:33:02 I'm not sure if we actually use NSView as a type a
+
+ // Also note that transactions are not disabled. The caller must ensure that
+ // all changes to the CALayer tree happen atomically.
+ [layer setContents:(id)io_surface_.get()];
+ [layer setFrame:bounds_rect.ToCGRect()];
+ return true;
}
} // namespace gfx
« content/common/gpu/image_transport_surface_overlay_mac.mm ('K') | « ui/gl/gl_image_io_surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698