| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // This file implements the ViewGLContext and PbufferGLContext classes. | 5 // This file implements the ViewGLContext and PbufferGLContext classes. |
| 6 | 6 |
| 7 #include "app/gfx/gl/gl_context.h" | 7 #include "app/gfx/gl/gl_context.h" |
| 8 | 8 |
| 9 #include <GL/osmesa.h> | 9 #include <GL/osmesa.h> |
| 10 | 10 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 | 311 |
| 312 Display* display = x11_util::GetXDisplay(); | 312 Display* display = x11_util::GetXDisplay(); |
| 313 | 313 |
| 314 if (pixmap_graphics_context_) { | 314 if (pixmap_graphics_context_) { |
| 315 XFreeGC(display, pixmap_graphics_context_); | 315 XFreeGC(display, pixmap_graphics_context_); |
| 316 pixmap_graphics_context_ = NULL; | 316 pixmap_graphics_context_ = NULL; |
| 317 } | 317 } |
| 318 | 318 |
| 319 if (pixmap_) { | 319 if (pixmap_) { |
| 320 XFreePixmap(display, pixmap_); | 320 XFreePixmap(display, pixmap_); |
| 321 pixmap_ = NULL; | 321 pixmap_ = 0; |
| 322 } | 322 } |
| 323 | 323 |
| 324 if (window_graphics_context_) { | 324 if (window_graphics_context_) { |
| 325 XFreeGC(display, window_graphics_context_); | 325 XFreeGC(display, window_graphics_context_); |
| 326 window_graphics_context_ = NULL; | 326 window_graphics_context_ = NULL; |
| 327 } | 327 } |
| 328 } | 328 } |
| 329 | 329 |
| 330 bool OSMesaViewGLContext::MakeCurrent() { | 330 bool OSMesaViewGLContext::MakeCurrent() { |
| 331 // TODO(apatrick): This is a bit of a hack. The window might have had zero | 331 // TODO(apatrick): This is a bit of a hack. The window might have had zero |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 // Change osmesa surface size to that of window. | 399 // Change osmesa surface size to that of window. |
| 400 osmesa_context_.Resize(window_size); | 400 osmesa_context_.Resize(window_size); |
| 401 | 401 |
| 402 // Destroy the previous pixmap and graphics context. | 402 // Destroy the previous pixmap and graphics context. |
| 403 if (pixmap_graphics_context_) { | 403 if (pixmap_graphics_context_) { |
| 404 XFreeGC(display, pixmap_graphics_context_); | 404 XFreeGC(display, pixmap_graphics_context_); |
| 405 pixmap_graphics_context_ = NULL; | 405 pixmap_graphics_context_ = NULL; |
| 406 } | 406 } |
| 407 if (pixmap_) { | 407 if (pixmap_) { |
| 408 XFreePixmap(display, pixmap_); | 408 XFreePixmap(display, pixmap_); |
| 409 pixmap_ = NULL; | 409 pixmap_ = 0; |
| 410 } | 410 } |
| 411 | 411 |
| 412 // Recreate a pixmap to hold the frame. | 412 // Recreate a pixmap to hold the frame. |
| 413 pixmap_ = XCreatePixmap(display, | 413 pixmap_ = XCreatePixmap(display, |
| 414 window_, | 414 window_, |
| 415 window_size.width(), | 415 window_size.width(), |
| 416 window_size.height(), | 416 window_size.height(), |
| 417 attributes.depth); | 417 attributes.depth); |
| 418 if (!pixmap_) { | 418 if (!pixmap_) { |
| 419 LOG(ERROR) << "XCreatePixmap failed."; | 419 LOG(ERROR) << "XCreatePixmap failed."; |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 734 } | 734 } |
| 735 case kGLImplementationMockGL: | 735 case kGLImplementationMockGL: |
| 736 return new StubGLContext; | 736 return new StubGLContext; |
| 737 default: | 737 default: |
| 738 NOTREACHED(); | 738 NOTREACHED(); |
| 739 return NULL; | 739 return NULL; |
| 740 } | 740 } |
| 741 } | 741 } |
| 742 | 742 |
| 743 } // namespace gfx | 743 } // namespace gfx |
| OLD | NEW |