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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
6 | 6 |
7 #include "content/common/gpu/image_transport_surface.h" | 7 #include "content/common/gpu/image_transport_surface.h" |
8 | 8 |
9 // This conflicts with the defines in Xlib.h and must come first. | 9 // This conflicts with the defines in Xlib.h and must come first. |
10 #include "content/common/gpu/gpu_messages.h" | 10 #include "content/common/gpu/gpu_messages.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
105 int32 render_view_id, | 105 int32 render_view_id, |
106 int32 renderer_id, | 106 int32 renderer_id, |
107 int32 command_buffer_id); | 107 int32 command_buffer_id); |
108 | 108 |
109 // gfx::GLSurface implementation: | 109 // gfx::GLSurface implementation: |
110 virtual bool Initialize() OVERRIDE; | 110 virtual bool Initialize() OVERRIDE; |
111 virtual void Destroy() OVERRIDE; | 111 virtual void Destroy() OVERRIDE; |
112 virtual bool SwapBuffers() OVERRIDE; | 112 virtual bool SwapBuffers() OVERRIDE; |
113 virtual gfx::Size GetSize() OVERRIDE; | 113 virtual gfx::Size GetSize() OVERRIDE; |
114 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; | 114 virtual bool OnMakeCurrent(gfx::GLContext* context) OVERRIDE; |
115 virtual void SetVisible(bool visible) OVERRIDE; | |
115 | 116 |
116 protected: | 117 protected: |
117 // ImageTransportSurface implementation: | 118 // ImageTransportSurface implementation: |
118 virtual void OnNewSurfaceACK( | 119 virtual void OnNewSurfaceACK( |
119 uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE; | 120 uint64 surface_id, TransportDIB::Handle surface_handle) OVERRIDE; |
120 virtual void OnBuffersSwappedACK() OVERRIDE; | 121 virtual void OnBuffersSwappedACK() OVERRIDE; |
121 virtual void OnResize(gfx::Size size) OVERRIDE; | 122 virtual void OnResize(gfx::Size size) OVERRIDE; |
122 | 123 |
123 private: | 124 private: |
124 virtual ~GLXImageTransportSurface(); | 125 virtual ~GLXImageTransportSurface(); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
454 } | 455 } |
455 | 456 |
456 void GLXImageTransportSurface::ReleaseSurface() { | 457 void GLXImageTransportSurface::ReleaseSurface() { |
457 DCHECK(bound_); | 458 DCHECK(bound_); |
458 GpuHostMsg_AcceleratedSurfaceRelease_Params params; | 459 GpuHostMsg_AcceleratedSurfaceRelease_Params params; |
459 params.identifier = window_; | 460 params.identifier = window_; |
460 helper_->SendAcceleratedSurfaceRelease(params); | 461 helper_->SendAcceleratedSurfaceRelease(params); |
461 bound_ = false; | 462 bound_ = false; |
462 } | 463 } |
463 | 464 |
465 void GLXImageTransportSurface::SetVisible(bool visible) { | |
466 Display* dpy = static_cast<Display*>(GetDisplay()); | |
467 if (!visible) { | |
468 XResizeWindow(dpy, window_, 1, 1); | |
469 needs_resize_ = true; | |
piman
2011/11/17 15:49:34
Wouldn't you want to set needs_resize_ in the othe
jonathan.backer
2011/11/17 15:56:09
Done.
| |
470 } else { | |
471 XResizeWindow(dpy, window_, size_.width(), size_.height()); | |
472 } | |
473 glXWaitX(); | |
474 } | |
475 | |
464 void GLXImageTransportSurface::OnResize(gfx::Size size) { | 476 void GLXImageTransportSurface::OnResize(gfx::Size size) { |
465 TRACE_EVENT0("gpu", "GLXImageTransportSurface::OnResize"); | 477 TRACE_EVENT0("gpu", "GLXImageTransportSurface::OnResize"); |
466 size_ = size; | 478 size_ = size; |
467 | 479 |
468 Display* dpy = static_cast<Display*>(GetDisplay()); | 480 Display* dpy = static_cast<Display*>(GetDisplay()); |
469 XResizeWindow(dpy, window_, size_.width(), size_.height()); | 481 XResizeWindow(dpy, window_, size_.width(), size_.height()); |
470 glXWaitX(); | 482 glXWaitX(); |
471 needs_resize_ = true; | 483 needs_resize_ = true; |
472 } | 484 } |
473 | 485 |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 NOTREACHED(); | 673 NOTREACHED(); |
662 return NULL; | 674 return NULL; |
663 } | 675 } |
664 if (surface->Initialize()) | 676 if (surface->Initialize()) |
665 return surface; | 677 return surface; |
666 else | 678 else |
667 return NULL; | 679 return NULL; |
668 } | 680 } |
669 | 681 |
670 #endif // defined(USE_GPU) | 682 #endif // defined(USE_GPU) |
OLD | NEW |