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