| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #include "content/browser/renderer_host/image_transport_client.h" | 5 #include "content/browser/renderer_host/image_transport_client.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 #include <X11/extensions/Xcomposite.h> | 8 #include <X11/extensions/Xcomposite.h> |
| 9 | 9 |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 virtual bool Flipped() { return true; } | 74 virtual bool Flipped() { return true; } |
| 75 virtual TransportDIB::Handle Handle() const { | 75 virtual TransportDIB::Handle Handle() const { |
| 76 return TransportDIB::DefaultHandleValue(); | 76 return TransportDIB::DefaultHandleValue(); |
| 77 } | 77 } |
| 78 | 78 |
| 79 private: | 79 private: |
| 80 ui::SharedResources* resources_; | 80 ui::SharedResources* resources_; |
| 81 EGLImageKHR image_; | 81 EGLImageKHR image_; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 #if !defined(USE_WAYLAND) |
| 85 |
| 84 class ImageTransportClientGLX : public ImageTransportClient { | 86 class ImageTransportClientGLX : public ImageTransportClient { |
| 85 public: | 87 public: |
| 86 explicit ImageTransportClientGLX(ui::SharedResources* resources) | 88 explicit ImageTransportClientGLX(ui::SharedResources* resources) |
| 87 : resources_(resources), | 89 : resources_(resources), |
| 88 pixmap_(0), | 90 pixmap_(0), |
| 89 glx_pixmap_(0), | 91 glx_pixmap_(0), |
| 90 texture_(0) { | 92 texture_(0) { |
| 91 } | 93 } |
| 92 | 94 |
| 93 virtual ~ImageTransportClientGLX() { | 95 virtual ~ImageTransportClientGLX() { |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 | 267 |
| 266 private: | 268 private: |
| 267 ui::SharedResources* resources_; | 269 ui::SharedResources* resources_; |
| 268 gfx::Size size_; | 270 gfx::Size size_; |
| 269 scoped_ptr<TransportDIB> shared_mem_; | 271 scoped_ptr<TransportDIB> shared_mem_; |
| 270 GLuint texture_; | 272 GLuint texture_; |
| 271 static uint32 next_id_; | 273 static uint32 next_id_; |
| 272 }; | 274 }; |
| 273 uint32 ImageTransportClientOSMesa::next_id_ = 0; | 275 uint32 ImageTransportClientOSMesa::next_id_ = 0; |
| 274 | 276 |
| 277 #endif // !USE_WAYLAND |
| 278 |
| 275 } // anonymous namespace | 279 } // anonymous namespace |
| 276 | 280 |
| 277 ImageTransportClient* ImageTransportClient::Create( | 281 ImageTransportClient* ImageTransportClient::Create( |
| 278 ui::SharedResources* resources, | 282 ui::SharedResources* resources, |
| 279 const gfx::Size& size) { | 283 const gfx::Size& size) { |
| 280 switch (gfx::GetGLImplementation()) { | 284 switch (gfx::GetGLImplementation()) { |
| 285 #if !defined(USE_WAYLAND) |
| 286 case gfx::kGLImplementationOSMesaGL: |
| 287 return new ImageTransportClientOSMesa(resources, size); |
| 281 case gfx::kGLImplementationDesktopGL: | 288 case gfx::kGLImplementationDesktopGL: |
| 282 return new ImageTransportClientGLX(resources); | 289 return new ImageTransportClientGLX(resources); |
| 290 #endif |
| 283 case gfx::kGLImplementationEGLGLES2: | 291 case gfx::kGLImplementationEGLGLES2: |
| 284 return new ImageTransportClientEGL(resources); | 292 return new ImageTransportClientEGL(resources); |
| 285 case gfx::kGLImplementationOSMesaGL: | |
| 286 return new ImageTransportClientOSMesa(resources, size); | |
| 287 default: | 293 default: |
| 288 NOTREACHED(); | 294 NOTREACHED(); |
| 289 return NULL; | 295 return NULL; |
| 290 } | 296 } |
| 291 } | 297 } |
| OLD | NEW |