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 #include "ui/gfx/compositor/compositor_cc.h" | 5 #include "ui/gfx/compositor/compositor_cc.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "third_party/skia/include/images/SkImageEncoder.h" | 8 #include "third_party/skia/include/images/SkImageEncoder.h" |
9 #include "third_party/skia/include/core/SkBitmap.h" | 9 #include "third_party/skia/include/core/SkBitmap.h" |
10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCompositor.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 float scaleFactor) { | 255 float scaleFactor) { |
256 } | 256 } |
257 | 257 |
258 void CompositorCC::applyScrollDelta(const WebKit::WebSize&) { | 258 void CompositorCC::applyScrollDelta(const WebKit::WebSize&) { |
259 } | 259 } |
260 | 260 |
261 WebKit::WebGraphicsContext3D* CompositorCC::createContext3D() { | 261 WebKit::WebGraphicsContext3D* CompositorCC::createContext3D() { |
262 WebKit::WebGraphicsContext3D* context; | 262 WebKit::WebGraphicsContext3D* context; |
263 if (test_compositor_enabled) { | 263 if (test_compositor_enabled) { |
264 // Use context that results in no rendering to the screen. | 264 // Use context that results in no rendering to the screen. |
265 context = new TestWebGraphicsContext3D(); | 265 TestWebGraphicsContext3D* test_context = new TestWebGraphicsContext3D(); |
| 266 test_context->initialize(); |
| 267 context = test_context; |
266 } else { | 268 } else { |
267 gfx::GLShareGroup* share_group = | 269 gfx::GLShareGroup* share_group = |
268 SharedResourcesCC::GetInstance()->GetShareGroup(); | 270 SharedResourcesCC::GetInstance()->GetShareGroup(); |
269 context = new webkit::gpu::WebGraphicsContext3DInProcessImpl( | 271 WebKit::WebGraphicsContext3D::Attributes attrs; |
270 widget_, share_group); | 272 context = webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWindow( |
| 273 attrs, widget_, share_group); |
271 } | 274 } |
272 WebKit::WebGraphicsContext3D::Attributes attrs; | |
273 context->initialize(attrs, 0, true); | |
274 | 275 |
275 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 276 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
276 if (!command_line->HasSwitch(switches::kDisableUIVsync)) { | 277 if (!command_line->HasSwitch(switches::kDisableUIVsync)) { |
277 context->makeContextCurrent(); | 278 context->makeContextCurrent(); |
278 gfx::GLContext* gl_context = gfx::GLContext::GetCurrent(); | 279 gfx::GLContext* gl_context = gfx::GLContext::GetCurrent(); |
279 gl_context->SetSwapInterval(1); | 280 gl_context->SetSwapInterval(1); |
280 gl_context->ReleaseCurrent(NULL); | 281 gl_context->ReleaseCurrent(NULL); |
281 } | 282 } |
282 | 283 |
283 return context; | 284 return context; |
(...skipping 21 matching lines...) Expand all Loading... |
305 switches::kDisableTestCompositor)) { | 306 switches::kDisableTestCompositor)) { |
306 test_compositor_enabled = true; | 307 test_compositor_enabled = true; |
307 } | 308 } |
308 } | 309 } |
309 | 310 |
310 COMPOSITOR_EXPORT void DisableTestCompositor() { | 311 COMPOSITOR_EXPORT void DisableTestCompositor() { |
311 test_compositor_enabled = false; | 312 test_compositor_enabled = false; |
312 } | 313 } |
313 | 314 |
314 } // namespace ui | 315 } // namespace ui |
OLD | NEW |