| 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 extern "C" { | 5 extern "C" { |
| 6 #include <X11/extensions/Xcomposite.h> | 6 #include <X11/extensions/Xcomposite.h> |
| 7 } | 7 } |
| 8 | 8 |
| 9 #include "ui/gl/gl_image_glx.h" | 9 #include "ui/gl/gl_image_glx.h" |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "ui/gfx/x/x11_types.h" | |
| 16 #include "ui/gl/gl_bindings.h" | 15 #include "ui/gl/gl_bindings.h" |
| 17 #include "ui/gl/gl_surface_glx.h" | 16 #include "ui/gl/gl_surface_glx.h" |
| 18 | 17 |
| 19 namespace gfx { | 18 namespace gfx { |
| 20 | 19 |
| 21 namespace { | 20 namespace { |
| 22 | 21 |
| 23 // scoped_ptr functor for XFree(). Use as follows: | 22 // scoped_ptr functor for XFree(). Use as follows: |
| 24 // scoped_ptr<XVisualInfo, ScopedPtrXFree> foo(...); | 23 // scoped_ptr<XVisualInfo, ScopedPtrXFree> foo(...); |
| 25 // where "XVisualInfo" is any X type that is freed with XFree. | 24 // where "XVisualInfo" is any X type that is freed with XFree. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 37 int TextureFormat(int depth) { | 36 int TextureFormat(int depth) { |
| 38 if (depth == 32) | 37 if (depth == 32) |
| 39 return GLX_TEXTURE_FORMAT_RGBA_EXT; | 38 return GLX_TEXTURE_FORMAT_RGBA_EXT; |
| 40 | 39 |
| 41 return GLX_TEXTURE_FORMAT_RGB_EXT; | 40 return GLX_TEXTURE_FORMAT_RGB_EXT; |
| 42 } | 41 } |
| 43 | 42 |
| 44 } // namespace anonymous | 43 } // namespace anonymous |
| 45 | 44 |
| 46 GLImageGLX::GLImageGLX(gfx::PluginWindowHandle window) | 45 GLImageGLX::GLImageGLX(gfx::PluginWindowHandle window) |
| 47 : display_(gfx::GetXDisplay()), | 46 : display_(base::MessagePumpForUI::GetDefaultXDisplay()), |
| 48 window_(window), | 47 window_(window), |
| 49 pixmap_(0), | 48 pixmap_(0), |
| 50 glx_pixmap_(0) {} | 49 glx_pixmap_(0) {} |
| 51 | 50 |
| 52 GLImageGLX::~GLImageGLX() { Destroy(); } | 51 GLImageGLX::~GLImageGLX() { Destroy(); } |
| 53 | 52 |
| 54 bool GLImageGLX::Initialize() { | 53 bool GLImageGLX::Initialize() { |
| 55 if (!GLSurfaceGLX::IsTextureFromPixmapSupported()) { | 54 if (!GLSurfaceGLX::IsTextureFromPixmapSupported()) { |
| 56 LOG(ERROR) << "GLX_EXT_texture_from_pixmap not supported."; | 55 LOG(ERROR) << "GLX_EXT_texture_from_pixmap not supported."; |
| 57 return false; | 56 return false; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 151 } |
| 153 | 152 |
| 154 void GLImageGLX::ReleaseTexImage(unsigned target) { | 153 void GLImageGLX::ReleaseTexImage(unsigned target) { |
| 155 DCHECK(glx_pixmap_); | 154 DCHECK(glx_pixmap_); |
| 156 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), target); | 155 DCHECK_EQ(static_cast<GLenum>(GL_TEXTURE_2D), target); |
| 157 | 156 |
| 158 glXReleaseTexImageEXT(display_, glx_pixmap_, GLX_FRONT_LEFT_EXT); | 157 glXReleaseTexImageEXT(display_, glx_pixmap_, GLX_FRONT_LEFT_EXT); |
| 159 } | 158 } |
| 160 | 159 |
| 161 } // namespace gfx | 160 } // namespace gfx |
| OLD | NEW |