| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "ui/gfx/compositor/test/test_compositor_host.h" | 5 #include "ui/gfx/compositor/test/test_compositor_host.h" |
| 6 | 6 |
| 7 #import <AppKit/NSApplication.h> | 7 #import <AppKit/NSApplication.h> |
| 8 #import <AppKit/NSOpenGL.h> | 8 #import <AppKit/NSOpenGL.h> |
| 9 #import <AppKit/NSView.h> | 9 #import <AppKit/NSView.h> |
| 10 #import <AppKit/NSWindow.h> | 10 #import <AppKit/NSWindow.h> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 DCHECK(!window_); | 119 DCHECK(!window_); |
| 120 window_ = [[NSWindow alloc] | 120 window_ = [[NSWindow alloc] |
| 121 initWithContentRect:NSMakeRect(bounds_.x(), | 121 initWithContentRect:NSMakeRect(bounds_.x(), |
| 122 bounds_.y(), | 122 bounds_.y(), |
| 123 bounds_.width(), | 123 bounds_.width(), |
| 124 bounds_.height()) | 124 bounds_.height()) |
| 125 styleMask:NSBorderlessWindowMask | 125 styleMask:NSBorderlessWindowMask |
| 126 backing:NSBackingStoreBuffered | 126 backing:NSBackingStoreBuffered |
| 127 defer:NO]; | 127 defer:NO]; |
| 128 scoped_nsobject<AcceleratedTestView> view([[AcceleratedTestView alloc] init]); | 128 scoped_nsobject<AcceleratedTestView> view([[AcceleratedTestView alloc] init]); |
| 129 compositor_ = ui::Compositor::Create(this, view, bounds_.size()); | 129 compositor_ = new ui::Compositor(this, view, bounds_.size()); |
| 130 [view setCompositor:compositor_]; | 130 [view setCompositor:compositor_]; |
| 131 [window_ setContentView:view]; | 131 [window_ setContentView:view]; |
| 132 [window_ orderFront:nil]; | 132 [window_ orderFront:nil]; |
| 133 } | 133 } |
| 134 | 134 |
| 135 ui::Compositor* TestCompositorHostMac::GetCompositor() { | 135 ui::Compositor* TestCompositorHostMac::GetCompositor() { |
| 136 return compositor_; | 136 return compositor_; |
| 137 } | 137 } |
| 138 | 138 |
| 139 void TestCompositorHostMac::ScheduleDraw() { | 139 void TestCompositorHostMac::ScheduleDraw() { |
| 140 if (!compositor_) | 140 if (!compositor_) |
| 141 return; | 141 return; |
| 142 | 142 |
| 143 // Force display now. | 143 // Force display now. |
| 144 [window_ display]; | 144 [window_ display]; |
| 145 } | 145 } |
| 146 | 146 |
| 147 // static | 147 // static |
| 148 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { | 148 TestCompositorHost* TestCompositorHost::Create(const gfx::Rect& bounds) { |
| 149 return new TestCompositorHostMac(bounds); | 149 return new TestCompositorHostMac(bounds); |
| 150 } | 150 } |
| 151 | 151 |
| 152 } // namespace ui | 152 } // namespace ui |
| OLD | NEW |