| 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 #include "content/common/gpu/texture_image_transport_surface.h" | 5 #include "content/common/gpu/texture_image_transport_surface.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 using gpu::gles2::TextureManager; | 24 using gpu::gles2::TextureManager; |
| 25 | 25 |
| 26 namespace content { | 26 namespace content { |
| 27 | 27 |
| 28 TextureImageTransportSurface::TextureImageTransportSurface( | 28 TextureImageTransportSurface::TextureImageTransportSurface( |
| 29 GpuChannelManager* manager, | 29 GpuChannelManager* manager, |
| 30 GpuCommandBufferStub* stub, | 30 GpuCommandBufferStub* stub, |
| 31 const gfx::GLSurfaceHandle& handle) | 31 const gfx::GLSurfaceHandle& handle) |
| 32 : fbo_id_(0), | 32 : fbo_id_(0), |
| 33 backbuffer_(CreateTextureDefinition(gfx::Size(), 0)), | 33 backbuffer_(CreateTextureDefinition(gfx::Size(), 0)), |
| 34 scale_factor_(1.f), |
| 34 stub_destroyed_(false), | 35 stub_destroyed_(false), |
| 35 backbuffer_suggested_allocation_(true), | 36 backbuffer_suggested_allocation_(true), |
| 36 frontbuffer_suggested_allocation_(true), | 37 frontbuffer_suggested_allocation_(true), |
| 37 handle_(handle), | 38 handle_(handle), |
| 38 is_swap_buffers_pending_(false), | 39 is_swap_buffers_pending_(false), |
| 39 did_unschedule_(false) { | 40 did_unschedule_(false) { |
| 40 helper_.reset(new ImageTransportHelper(this, | 41 helper_.reset(new ImageTransportHelper(this, |
| 41 manager, | 42 manager, |
| 42 stub, | 43 stub, |
| 43 gfx::kNullPluginWindow)); | 44 gfx::kNullPluginWindow)); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 } | 162 } |
| 162 | 163 |
| 163 void* TextureImageTransportSurface::GetDisplay() { | 164 void* TextureImageTransportSurface::GetDisplay() { |
| 164 return surface_.get() ? surface_->GetDisplay() : NULL; | 165 return surface_.get() ? surface_->GetDisplay() : NULL; |
| 165 } | 166 } |
| 166 | 167 |
| 167 void* TextureImageTransportSurface::GetConfig() { | 168 void* TextureImageTransportSurface::GetConfig() { |
| 168 return surface_.get() ? surface_->GetConfig() : NULL; | 169 return surface_.get() ? surface_->GetConfig() : NULL; |
| 169 } | 170 } |
| 170 | 171 |
| 171 void TextureImageTransportSurface::OnResize(gfx::Size size) { | 172 void TextureImageTransportSurface::OnResize(gfx::Size size, |
| 173 float scale_factor) { |
| 172 current_size_ = size; | 174 current_size_ = size; |
| 175 scale_factor_ = scale_factor; |
| 173 CreateBackTexture(); | 176 CreateBackTexture(); |
| 174 } | 177 } |
| 175 | 178 |
| 176 void TextureImageTransportSurface::OnWillDestroyStub() { | 179 void TextureImageTransportSurface::OnWillDestroyStub() { |
| 177 helper_->stub()->RemoveDestructionObserver(this); | 180 helper_->stub()->RemoveDestructionObserver(this); |
| 178 | 181 |
| 179 GpuHostMsg_AcceleratedSurfaceRelease_Params params; | 182 GpuHostMsg_AcceleratedSurfaceRelease_Params params; |
| 180 helper_->SendAcceleratedSurfaceRelease(params); | 183 helper_->SendAcceleratedSurfaceRelease(params); |
| 181 | 184 |
| 182 ReleaseBackTexture(); | 185 ReleaseBackTexture(); |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 GL_TEXTURE_2D, | 497 GL_TEXTURE_2D, |
| 495 mailbox_name_, | 498 mailbox_name_, |
| 496 backbuffer_.release(), | 499 backbuffer_.release(), |
| 497 NULL); | 500 NULL); |
| 498 DCHECK(success); | 501 DCHECK(success); |
| 499 mailbox_name_ = MailboxName(); | 502 mailbox_name_ = MailboxName(); |
| 500 backbuffer_.reset(CreateTextureDefinition(gfx::Size(), 0)); | 503 backbuffer_.reset(CreateTextureDefinition(gfx::Size(), 0)); |
| 501 } | 504 } |
| 502 | 505 |
| 503 } // namespace content | 506 } // namespace content |
| OLD | NEW |