| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 5 #ifndef CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
| 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 6 #define CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #include "base/mac/scoped_nsobject.h" | 10 #include "base/mac/scoped_nsobject.h" |
| 11 #include "cc/output/software_frame_data.h" | 11 #include "cc/output/software_frame_data.h" |
| 12 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" | 12 #include "content/browser/renderer_host/compositing_iosurface_layer_mac.h" |
| 13 #include "content/browser/renderer_host/software_layer_mac.h" | 13 #include "content/browser/renderer_host/software_layer_mac.h" |
| 14 #include "skia/ext/platform_canvas.h" | 14 #include "skia/ext/platform_canvas.h" |
| 15 #include "ui/compositor/compositor.h" | 15 #include "ui/compositor/compositor.h" |
| 16 #include "ui/gfx/geometry/size.h" | 16 #include "ui/gfx/geometry/size.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 class BrowserCompositorViewMacHelper; | 19 class BrowserCompositorViewMacHelper; |
| 20 } // namespace content | 20 } // namespace content |
| 21 | 21 |
| 22 // Additions to the NSView interface for compositor frames. | 22 // Additions to the NSView interface for compositor frames. |
| 23 @interface NSView (BrowserCompositorView) | 23 @interface NSView (BrowserCompositorView) |
| 24 - (void)gotAcceleratedIOSurfaceFrame:(uint64)surface_handle | 24 - (void)gotAcceleratedIOSurfaceFrame:(uint64)surface_handle |
| 25 withOutputSurfaceID:(int)surface_id |
| 25 withPixelSize:(gfx::Size)pixel_size | 26 withPixelSize:(gfx::Size)pixel_size |
| 26 withScaleFactor:(float)scale_factor; | 27 withScaleFactor:(float)scale_factor; |
| 27 | 28 |
| 28 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data | 29 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data |
| 29 withScaleFactor:(float)scale_factor | 30 withScaleFactor:(float)scale_factor |
| 30 withCanvas:(SkCanvas*)canvas; | 31 withCanvas:(SkCanvas*)canvas; |
| 31 @end // NSView (BrowserCompositorView) | 32 @end // NSView (BrowserCompositorView) |
| 32 | 33 |
| 33 // NSView drawn by a ui::Compositor. The superview of this view is responsible | 34 // NSView drawn by a ui::Compositor. The superview of this view is responsible |
| 34 // for changing the ui::Compositor SizeAndScale and calling layoutLayers when | 35 // for changing the ui::Compositor SizeAndScale and calling layoutLayers when |
| 35 // the size of the parent view may change. This interface is patterned after | 36 // the size of the parent view may change. This interface is patterned after |
| 36 // the needs of RenderWidgetHostViewCocoa, and could change. | 37 // the needs of RenderWidgetHostViewCocoa, and could change. |
| 37 @interface BrowserCompositorViewMac : NSView { | 38 @interface BrowserCompositorViewMac : NSView { |
| 38 scoped_ptr<ui::Compositor> compositor_; | 39 scoped_ptr<ui::Compositor> compositor_; |
| 39 | 40 |
| 40 base::scoped_nsobject<CALayer> background_layer_; | 41 base::scoped_nsobject<CALayer> background_layer_; |
| 41 base::scoped_nsobject<CompositingIOSurfaceLayer> accelerated_layer_; | 42 base::scoped_nsobject<CompositingIOSurfaceLayer> accelerated_layer_; |
| 43 int accelerated_layer_output_surface_id_; |
| 42 base::scoped_nsobject<SoftwareLayer> software_layer_; | 44 base::scoped_nsobject<SoftwareLayer> software_layer_; |
| 43 | 45 |
| 44 scoped_ptr<content::BrowserCompositorViewMacHelper> helper_; | 46 scoped_ptr<content::BrowserCompositorViewMacHelper> helper_; |
| 45 } | 47 } |
| 46 | 48 |
| 47 // Initialize to render the content of a specific superview. | 49 // Initialize to render the content of a specific superview. |
| 48 - (id)initWithSuperview:(NSView*)view; | 50 - (id)initWithSuperview:(NSView*)view; |
| 49 | 51 |
| 50 // Re-position the layers to the correct place when this view's superview | 52 // Re-position the layers to the correct place when this view's superview |
| 51 // changes size, or when the accelerated or software content changes. | 53 // changes size, or when the accelerated or software content changes. |
| 52 - (void)layoutLayers; | 54 - (void)layoutLayers; |
| 53 | 55 |
| 54 // Disallow further access to the client. | 56 // Disallow further access to the client. |
| 55 - (void)resetClient; | 57 - (void)resetClient; |
| 56 | 58 |
| 57 // Access the underlying ui::Compositor for this view. | 59 // Access the underlying ui::Compositor for this view. |
| 58 - (ui::Compositor*)compositor; | 60 - (ui::Compositor*)compositor; |
| 59 @end // BrowserCompositorViewMac | 61 @end // BrowserCompositorViewMac |
| 60 | 62 |
| 61 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ | 63 #endif // CONTENT_BROWSER_COMPOSITOR_BROWSER_COMPOSITOR_VIEW_MAC_H_ |
| OLD | NEW |