OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| 6 #define CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_OVERLAY_MAC_H_ |
| 7 |
| 8 #include "base/mac/scoped_nsobject.h" |
| 9 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 10 #include "content/common/gpu/image_transport_surface.h" |
| 11 #include "ui/base/cocoa/remote_layer_api.h" |
| 12 #include "ui/gl/gl_surface.h" |
| 13 |
| 14 namespace content { |
| 15 |
| 16 class ImageTransportSurfaceOverlayMac : public gfx::GLSurface, |
| 17 public ImageTransportSurface { |
| 18 public: |
| 19 ImageTransportSurfaceOverlayMac(GpuChannelManager* manager, |
| 20 GpuCommandBufferStub* stub, |
| 21 gfx::PluginWindowHandle handle); |
| 22 |
| 23 // GLSurface implementation |
| 24 bool Initialize() override; |
| 25 void Destroy() override; |
| 26 bool IsOffscreen() override; |
| 27 gfx::SwapResult SwapBuffers() override; |
| 28 gfx::SwapResult PostSubBuffer(int x, int y, int width, int height) override; |
| 29 bool SupportsPostSubBuffer() override; |
| 30 gfx::Size GetSize() override; |
| 31 void* GetHandle() override; |
| 32 |
| 33 bool ScheduleOverlayPlane(int z_order, |
| 34 gfx::OverlayTransform transform, |
| 35 gfx::GLImage* image, |
| 36 const gfx::Rect& bounds_rect, |
| 37 const gfx::RectF& crop_rect) override; |
| 38 bool IsSurfaceless() const override; |
| 39 |
| 40 // ImageTransportSurface implementation |
| 41 void OnBufferPresented( |
| 42 const AcceleratedSurfaceMsg_BufferPresented_Params& params) override; |
| 43 void OnResize(gfx::Size pixel_size, float scale_factor) override; |
| 44 void SetLatencyInfo(const std::vector<ui::LatencyInfo>&) override; |
| 45 void WakeUpGpu() override; |
| 46 |
| 47 private: |
| 48 ~ImageTransportSurfaceOverlayMac() override; |
| 49 scoped_ptr<ImageTransportHelper> helper_; |
| 50 base::scoped_nsobject<CAContext> ca_context_; |
| 51 base::scoped_nsobject<CALayer> layer_; |
| 52 |
| 53 gfx::Size pixel_size_; |
| 54 float scale_factor_; |
| 55 std::vector<ui::LatencyInfo> latency_info_; |
| 56 |
| 57 // This is set when ScheduleOverlayPlane is called, and is consumed when |
| 58 // SwapBuffers is called. For now, only one overlay plane is supported. |
| 59 gfx::GLImage* pending_overlay_image_; |
| 60 }; |
| 61 |
| 62 } // namespace content |
| 63 |
| 64 #endif // CONTENT_COMMON_GPU_IMAGE_TRANSPORT_SURFACE_FBO_MAC_H_ |
OLD | NEW |