| 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_RGB: |
| 29 case GL_RGBA: | 30 case GL_RGBA: |
| 30 return true; | 31 return true; |
| 31 default: | 32 default: |
| 32 return false; | 33 return false; |
| 33 } | 34 } |
| 34 } | 35 } |
| 35 | 36 |
| 36 int TextureFormat(unsigned internalformat) { | 37 int TextureFormat(unsigned internalformat) { |
| 37 switch (internalformat) { | 38 switch (internalformat) { |
| 39 case GL_RGB: |
| 40 return GLX_TEXTURE_FORMAT_RGB_EXT; |
| 38 case GL_RGBA: | 41 case GL_RGBA: |
| 39 return GLX_TEXTURE_FORMAT_RGBA_EXT; | 42 return GLX_TEXTURE_FORMAT_RGBA_EXT; |
| 40 default: | 43 default: |
| 41 NOTREACHED(); | 44 NOTREACHED(); |
| 42 return 0; | 45 return 0; |
| 43 } | 46 } |
| 44 } | 47 } |
| 45 | 48 |
| 46 int BindToTextureFormat(unsigned internalformat) { | 49 int BindToTextureFormat(unsigned internalformat) { |
| 47 switch (internalformat) { | 50 switch (internalformat) { |
| 51 case GL_RGB: |
| 52 return GLX_BIND_TO_TEXTURE_RGB_EXT; |
| 48 case GL_RGBA: | 53 case GL_RGBA: |
| 49 return GLX_BIND_TO_TEXTURE_RGBA_EXT; | 54 return GLX_BIND_TO_TEXTURE_RGBA_EXT; |
| 50 default: | 55 default: |
| 51 NOTREACHED(); | 56 NOTREACHED(); |
| 52 return 0; | 57 return 0; |
| 53 } | 58 } |
| 54 } | 59 } |
| 55 | 60 |
| 56 unsigned PixmapDepth(unsigned internalformat) { | 61 unsigned PixmapDepth(unsigned internalformat) { |
| 57 switch (internalformat) { | 62 switch (internalformat) { |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 201 |
| 197 bool GLImageGLX::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, | 202 bool GLImageGLX::ScheduleOverlayPlane(gfx::AcceleratedWidget widget, |
| 198 int z_order, | 203 int z_order, |
| 199 OverlayTransform transform, | 204 OverlayTransform transform, |
| 200 const Rect& bounds_rect, | 205 const Rect& bounds_rect, |
| 201 const RectF& crop_rect) { | 206 const RectF& crop_rect) { |
| 202 return false; | 207 return false; |
| 203 } | 208 } |
| 204 | 209 |
| 205 } // namespace gfx | 210 } // namespace gfx |
| OLD | NEW |