| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
| 6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 6 #define CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
| 7 | 7 |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 #import <QuartzCore/CVDisplayLink.h> | 9 #import <QuartzCore/CVDisplayLink.h> |
| 10 #include <QuartzCore/QuartzCore.h> | 10 #include <QuartzCore/QuartzCore.h> |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 class Rect; | 25 class Rect; |
| 26 } | 26 } |
| 27 | 27 |
| 28 namespace content { | 28 namespace content { |
| 29 | 29 |
| 30 // This class manages an OpenGL context and IOSurface for the accelerated | 30 // This class manages an OpenGL context and IOSurface for the accelerated |
| 31 // compositing code path. The GL context is attached to | 31 // compositing code path. The GL context is attached to |
| 32 // RenderWidgetHostViewCocoa for blitting the IOSurface. | 32 // RenderWidgetHostViewCocoa for blitting the IOSurface. |
| 33 class CompositingIOSurfaceMac { | 33 class CompositingIOSurfaceMac { |
| 34 public: | 34 public: |
| 35 // Returns NULL if IOSurface support is missing or GL APIs fail. | 35 // Passed to Create() to specify the ordering of the surface relative to the |
| 36 static CompositingIOSurfaceMac* Create(); | 36 // containing window. |
| 37 enum SurfaceOrder { |
| 38 SURFACE_ORDER_ABOVE_WINDOW, |
| 39 SURFACE_ORDER_BELOW_WINDOW |
| 40 }; |
| 41 |
| 42 // Returns NULL if IOSurface support is missing or GL APIs fail. Specify in |
| 43 // |order| the desired ordering relationship of the surface to the containing |
| 44 // window. |
| 45 static CompositingIOSurfaceMac* Create(SurfaceOrder order); |
| 37 ~CompositingIOSurfaceMac(); | 46 ~CompositingIOSurfaceMac(); |
| 38 | 47 |
| 39 // Set IOSurface that will be drawn on the next NSView drawRect. | 48 // Set IOSurface that will be drawn on the next NSView drawRect. |
| 40 void SetIOSurface(uint64 io_surface_handle, | 49 void SetIOSurface(uint64 io_surface_handle, |
| 41 const gfx::Size& size); | 50 const gfx::Size& size); |
| 42 | 51 |
| 43 // Blit the IOSurface at the upper-left corner of the |view|. If |view| window | 52 // Blit the IOSurface at the upper-left corner of the |view|. If |view| window |
| 44 // size is larger than the IOSurface, the remaining right and bottom edges | 53 // size is larger than the IOSurface, the remaining right and bottom edges |
| 45 // will be white. |scaleFactor| is 1 in normal views, 2 in HiDPI views. | 54 // will be white. |scaleFactor| is 1 in normal views, 2 in HiDPI views. |
| 46 void DrawIOSurface(NSView* view, float scale_factor); | 55 void DrawIOSurface(NSView* view, float scale_factor); |
| (...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 282 |
| 274 // Vsync timing data. | 283 // Vsync timing data. |
| 275 base::TimeTicks vsync_timebase_; | 284 base::TimeTicks vsync_timebase_; |
| 276 uint32 vsync_interval_numerator_; | 285 uint32 vsync_interval_numerator_; |
| 277 uint32 vsync_interval_denominator_; | 286 uint32 vsync_interval_denominator_; |
| 278 }; | 287 }; |
| 279 | 288 |
| 280 } // namespace content | 289 } // namespace content |
| 281 | 290 |
| 282 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H | 291 #endif // CONTENT_BROWSER_RENDERER_HOST_ACCELERATED_COMPOSITING_VIEW_MAC_H |
| OLD | NEW |