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.h" | 5 #include "ui/gfx/compositor/compositor.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 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
245 } | 245 } |
246 | 246 |
247 void Compositor::applyScrollAndScale(const WebKit::WebSize& scrollDelta, | 247 void Compositor::applyScrollAndScale(const WebKit::WebSize& scrollDelta, |
248 float scaleFactor) { | 248 float scaleFactor) { |
249 } | 249 } |
250 | 250 |
251 WebKit::WebGraphicsContext3D* Compositor::createContext3D() { | 251 WebKit::WebGraphicsContext3D* Compositor::createContext3D() { |
252 WebKit::WebGraphicsContext3D* context; | 252 WebKit::WebGraphicsContext3D* context; |
253 if (test_compositor_enabled) { | 253 if (test_compositor_enabled) { |
254 // Use context that results in no rendering to the screen. | 254 // Use context that results in no rendering to the screen. |
255 context = new TestWebGraphicsContext3D(); | 255 TestWebGraphicsContext3D* test_context = new TestWebGraphicsContext3D(); |
| 256 test_context->Initialize(); |
| 257 context = test_context; |
256 } else { | 258 } else { |
257 gfx::GLShareGroup* share_group = | 259 gfx::GLShareGroup* share_group = |
258 SharedResources::GetInstance()->GetShareGroup(); | 260 SharedResources::GetInstance()->GetShareGroup(); |
259 context = new webkit::gpu::WebGraphicsContext3DInProcessImpl( | 261 WebKit::WebGraphicsContext3D::Attributes attrs; |
260 widget_, share_group); | 262 context = webkit::gpu::WebGraphicsContext3DInProcessImpl::CreateForWindow( |
| 263 attrs, widget_, share_group); |
261 } | 264 } |
262 WebKit::WebGraphicsContext3D::Attributes attrs; | |
263 context->initialize(attrs, 0, true); | |
264 | 265 |
265 CommandLine* command_line = CommandLine::ForCurrentProcess(); | 266 CommandLine* command_line = CommandLine::ForCurrentProcess(); |
266 if (!command_line->HasSwitch(switches::kDisableUIVsync)) { | 267 if (!command_line->HasSwitch(switches::kDisableUIVsync)) { |
267 context->makeContextCurrent(); | 268 context->makeContextCurrent(); |
268 gfx::GLContext* gl_context = gfx::GLContext::GetCurrent(); | 269 gfx::GLContext* gl_context = gfx::GLContext::GetCurrent(); |
269 gl_context->SetSwapInterval(1); | 270 gl_context->SetSwapInterval(1); |
270 gl_context->ReleaseCurrent(NULL); | 271 gl_context->ReleaseCurrent(NULL); |
271 } | 272 } |
272 | 273 |
273 return context; | 274 return context; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 switches::kDisableTestCompositor)) { | 319 switches::kDisableTestCompositor)) { |
319 test_compositor_enabled = true; | 320 test_compositor_enabled = true; |
320 } | 321 } |
321 } | 322 } |
322 | 323 |
323 COMPOSITOR_EXPORT void DisableTestCompositor() { | 324 COMPOSITOR_EXPORT void DisableTestCompositor() { |
324 test_compositor_enabled = false; | 325 test_compositor_enabled = false; |
325 } | 326 } |
326 | 327 |
327 } // namespace ui | 328 } // namespace ui |
OLD | NEW |