| 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/Xlib.h> | 6 #include <X11/Xlib.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/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "ui/gl/gl_bindings.h" | 13 #include "ui/gl/gl_bindings.h" |
| 14 #include "ui/gl/gl_surface_glx.h" | 14 #include "ui/gl/gl_surface_glx.h" |
| 15 | 15 |
| 16 namespace gfx { | 16 namespace gfx { |
| 17 | 17 |
| 18 namespace { | 18 namespace { |
| 19 | 19 |
| 20 // scoped_ptr functor for XFree(). Use as follows: | 20 // scoped_ptr functor for XFree(). Use as follows: |
| 21 // scoped_ptr<XVisualInfo, ScopedPtrXFree> foo(...); | 21 // scoped_ptr<XVisualInfo, ScopedPtrXFree> foo(...); |
| 22 // where "XVisualInfo" is any X type that is freed with XFree. | 22 // where "XVisualInfo" is any X type that is freed with XFree. |
| 23 struct ScopedPtrXFree { | 23 struct ScopedPtrXFree { |
| 24 void operator()(void* x) const { ::XFree(x); } | 24 void operator()(void* x) const { ::XFree(x); } |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 bool ValidFormat(unsigned internalformat) { | 27 bool ValidFormat(unsigned internalformat) { |
| 28 switch (internalformat) { | 28 switch (internalformat) { |
| 29 case GL_BGRA8_EXT: | 29 case GL_RGBA: |
| 30 return true; | 30 return true; |
| 31 default: | 31 default: |
| 32 return false; | 32 return false; |
| 33 } | 33 } |
| 34 } | 34 } |
| 35 | 35 |
| 36 int TextureFormat(unsigned internalformat) { | 36 int TextureFormat(unsigned internalformat) { |
| 37 switch (internalformat) { | 37 switch (internalformat) { |
| 38 case GL_BGRA8_EXT: | 38 case GL_RGBA: |
| 39 return GLX_TEXTURE_FORMAT_RGBA_EXT; | 39 return GLX_TEXTURE_FORMAT_RGBA_EXT; |
| 40 default: | 40 default: |
| 41 NOTREACHED(); | 41 NOTREACHED(); |
| 42 return 0; | 42 return 0; |
| 43 } | 43 } |
| 44 } | 44 } |
| 45 | 45 |
| 46 int BindToTextureFormat(unsigned internalformat) { | 46 int BindToTextureFormat(unsigned internalformat) { |
| 47 switch (internalformat) { | 47 switch (internalformat) { |
| 48 case GL_BGRA8_EXT: | 48 case GL_RGBA: |
| 49 return GLX_BIND_TO_TEXTURE_RGBA_EXT; | 49 return GLX_BIND_TO_TEXTURE_RGBA_EXT; |
| 50 default: | 50 default: |
| 51 NOTREACHED(); | 51 NOTREACHED(); |
| 52 return 0; | 52 return 0; |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 unsigned PixmapDepth(unsigned internalformat) { | 56 unsigned PixmapDepth(unsigned internalformat) { |
| 57 switch (internalformat) { | 57 switch (internalformat) { |
| 58 case GL_BGRA8_EXT: | 58 case GL_RGBA: |
| 59 return 32u; | 59 return 32u; |
| 60 default: | 60 default: |
| 61 NOTREACHED(); | 61 NOTREACHED(); |
| 62 return 0u; | 62 return 0u; |
| 63 } | 63 } |
| 64 } | 64 } |
| 65 | 65 |
| 66 bool ActualPixmapGeometry(XID pixmap, gfx::Size* size, unsigned* depth) { | 66 bool ActualPixmapGeometry(XID pixmap, gfx::Size* size, unsigned* depth) { |
| 67 XID root_return; | 67 XID root_return; |
| 68 int x_return; | 68 int x_return; |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 196 |
| 197 bool GLImageGLX::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 197 bool GLImageGLX::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 198 int z_order, | 198 int z_order, |
| 199 OverlayTransform transform, | 199 OverlayTransform transform, |
| 200 const Rect& bounds_rect, | 200 const Rect& bounds_rect, |
| 201 const RectF& crop_rect) { | 201 const RectF& crop_rect) { |
| 202 return false; | 202 return false; |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace gfx | 205 } // namespace gfx |
| OLD | NEW |