OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file implements the ViewGLContext and PbufferGLContext classes. | 5 // This file implements the ViewGLContext and PbufferGLContext classes. |
6 | 6 |
7 #include "app/gfx/gl/gl_context.h" | 7 #include "app/gfx/gl/gl_context.h" |
8 | 8 |
9 extern "C" { | 9 extern "C" { |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
11 } | 11 } |
12 | 12 |
13 #include <GL/osmesa.h> | 13 #include <GL/osmesa.h> |
14 | 14 |
15 #include "app/gfx/gl/gl_bindings.h" | 15 #include "app/gfx/gl/gl_bindings.h" |
16 #include "app/gfx/gl/gl_context_egl.h" | 16 #include "app/gfx/gl/gl_context_egl.h" |
17 #include "app/gfx/gl/gl_context_osmesa.h" | 17 #include "app/gfx/gl/gl_context_osmesa.h" |
18 #include "app/gfx/gl/gl_context_stub.h" | 18 #include "app/gfx/gl/gl_context_stub.h" |
19 #include "app/gfx/gl/gl_implementation.h" | 19 #include "app/gfx/gl/gl_implementation.h" |
20 #include "app/x11_util.h" | |
21 #include "base/basictypes.h" | 20 #include "base/basictypes.h" |
22 #include "base/logging.h" | 21 #include "base/logging.h" |
23 #include "base/scoped_ptr.h" | 22 #include "base/scoped_ptr.h" |
| 23 #include "ui/base/x/x11_util.h" |
24 | 24 |
25 namespace { | 25 namespace { |
26 | 26 |
27 Display* GetXDisplayHelper() { | 27 Display* GetXDisplayHelper() { |
28 static Display* display = NULL; | 28 static Display* display = NULL; |
29 | 29 |
30 if (!display) { | 30 if (!display) { |
31 display = XOpenDisplay(NULL); | 31 display = XOpenDisplay(NULL); |
32 CHECK(display); | 32 CHECK(display); |
33 } | 33 } |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 return false; | 413 return false; |
414 } | 414 } |
415 | 415 |
416 gfx::Size size = osmesa_context_.GetSize(); | 416 gfx::Size size = osmesa_context_.GetSize(); |
417 | 417 |
418 Display* display = GetXDisplayHelper(); | 418 Display* display = GetXDisplayHelper(); |
419 | 419 |
420 // Copy the frame into the pixmap. | 420 // Copy the frame into the pixmap. |
421 XWindowAttributes attributes; | 421 XWindowAttributes attributes; |
422 XGetWindowAttributes(display, window_, &attributes); | 422 XGetWindowAttributes(display, window_, &attributes); |
423 x11_util::PutARGBImage(display, | 423 ui::PutARGBImage(display, |
424 attributes.visual, | 424 attributes.visual, |
425 attributes.depth, | 425 attributes.depth, |
426 pixmap_, | 426 pixmap_, |
427 pixmap_graphics_context_, | 427 pixmap_graphics_context_, |
428 static_cast<const uint8*>(osmesa_context_.buffer()), | 428 static_cast<const uint8*>(osmesa_context_.buffer()), |
429 size.width(), | 429 size.width(), |
430 size.height()); | 430 size.height()); |
431 | 431 |
432 // Copy the pixmap to the window. | 432 // Copy the pixmap to the window. |
433 XCopyArea(display, | 433 XCopyArea(display, |
434 pixmap_, | 434 pixmap_, |
435 window_, | 435 window_, |
436 window_graphics_context_, | 436 window_graphics_context_, |
437 0, 0, | 437 0, 0, |
438 size.width(), size.height(), | 438 size.width(), size.height(), |
439 0, 0); | 439 0, 0); |
440 | 440 |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 } | 820 } |
821 case kGLImplementationMockGL: | 821 case kGLImplementationMockGL: |
822 return new StubGLContext; | 822 return new StubGLContext; |
823 default: | 823 default: |
824 NOTREACHED(); | 824 NOTREACHED(); |
825 return NULL; | 825 return NULL; |
826 } | 826 } |
827 } | 827 } |
828 | 828 |
829 } // namespace gfx | 829 } // namespace gfx |
OLD | NEW |