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

Unified Diff: content/common/gpu/image_transport_surface_overlay_mac.h

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: content/common/gpu/image_transport_surface_overlay_mac.h
diff --git a/content/common/gpu/image_transport_surface_overlay_mac.h b/content/common/gpu/image_transport_surface_overlay_mac.h
new file mode 100644
index 0000000000000000000000000000000000000000..8d4897dc870b26efebe441bc46bce0a833531874
--- /dev/null
+++ b/content/common/gpu/image_transport_surface_overlay_mac.h
@@ -0,0 +1,64 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_
+#define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_
+
+#include "base/mac/scoped_nsobject.h"
+#include "content/common/gpu/gpu_command_buffer_stub.h"
+#include "content/common/gpu/image_transport_surface.h"
+#include "ui/base/cocoa/remote_layer_api.h"
+#include "ui/gl/gl_surface.h"
+
+namespace content {
+
+class ImageTransportSurfaceOverlayMac : public gfx::GLSurface,
+ public ImageTransportSurface {
+ public:
+ ImageTransportSurfaceOverlayMac(GpuChannelManager* manager,
+ GpuCommandBufferStub* stub,
+ gfx::PluginWindowHandle handle);
+
+ // GLSurface implementation
+ bool Initialize() override;
+ void Destroy() override;
+ bool IsOffscreen() override;
+ gfx::SwapResult SwapBuffers() override;
+ gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override;
+ bool SupportsPostSubBuffer() override;
+ gfx::Size GetSize() override;
+ void* GetHandle() override;
+
+ bool ScheduleOverlayPlane(int z_order,
+ gfx::OverlayTransform transform,
+ gfx::GLImage* image,
+ const gfx::Rect& bounds_rect,
+ const gfx::RectF& crop_rect) override;
+ bool IsSurfaceless() const override;
+
+ // ImageTransportSurface implementation
+ void OnBufferPresented(
+ const AcceleratedSurfaceMsg_BufferPresented_Params& params) override;
+ void OnResize(gfx::Size pixel_size, float scale_factor) override;
+ void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) override;
+ void WakeUpGpu() override;
+
+ private:
+ ~ImageTransportSurfaceOverlayMac() override;
+ scoped_ptr<ImageTransportHelper> helper_;
+ base::scoped_nsobject<CAContext> ca_context_;
+ base::scoped_nsobject<CALayer> layer_;
+
+ gfx::Size pixel_size_;
+ float scale_factor_;
+ std::vector<ui::LatencyInfo> latency_info_;
+
+ // This is set when ScheduleOverlayPlane is called, and is consumed when
+ // SwapBuffers is called. For now, only one overlay plane is supported.
+ gfx::GLImage* pending_overlay_image_;
+};
+
+} // namespace content
+
+#endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_

Powered by Google App Engine
This is Rietveld 408576698