| 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/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; | 40 virtual bool PostSubBuffer(int x, int y, int width, int height) OVERRIDE; |
| 41 virtual std::string GetExtensions() OVERRIDE; | 41 virtual std::string GetExtensions() OVERRIDE; |
| 42 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; | 42 virtual bool SetBackbufferAllocation(bool allocated) OVERRIDE; |
| 43 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; | 43 virtual void SetFrontbufferAllocation(bool allocated) OVERRIDE; |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 // ImageTransportSurface implementation | 46 // ImageTransportSurface implementation |
| 47 virtual void OnBufferPresented( | 47 virtual void OnBufferPresented( |
| 48 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; | 48 const AcceleratedSurfaceMsg_BufferPresented_Params& params) OVERRIDE; |
| 49 virtual void OnResizeViewACK() OVERRIDE; | 49 virtual void OnResizeViewACK() OVERRIDE; |
| 50 virtual void OnResize(gfx::Size size) OVERRIDE; | 50 virtual void OnResize(gfx::Size size, float scale_factor) OVERRIDE; |
| 51 virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; | 51 virtual void SetLatencyInfo(const cc::LatencyInfo&) OVERRIDE; |
| 52 virtual gfx::Size GetSize() OVERRIDE; | 52 virtual gfx::Size GetSize() OVERRIDE; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 virtual ~PbufferImageTransportSurface(); | 55 virtual ~PbufferImageTransportSurface(); |
| 56 void SendBuffersSwapped(); | 56 void SendBuffersSwapped(); |
| 57 void DestroySurface(); | 57 void DestroySurface(); |
| 58 | 58 |
| 59 // Tracks the current buffer allocation state. | 59 // Tracks the current buffer allocation state. |
| 60 bool backbuffer_suggested_allocation_; | 60 bool backbuffer_suggested_allocation_; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 if (did_unschedule_) { | 212 if (did_unschedule_) { |
| 213 did_unschedule_ = false; | 213 did_unschedule_ = false; |
| 214 helper_->SetScheduled(true); | 214 helper_->SetScheduled(true); |
| 215 } | 215 } |
| 216 } | 216 } |
| 217 | 217 |
| 218 void PbufferImageTransportSurface::OnResizeViewACK() { | 218 void PbufferImageTransportSurface::OnResizeViewACK() { |
| 219 NOTREACHED(); | 219 NOTREACHED(); |
| 220 } | 220 } |
| 221 | 221 |
| 222 void PbufferImageTransportSurface::OnResize(gfx::Size size) { | 222 void PbufferImageTransportSurface::OnResize(gfx::Size size, |
| 223 float scale_factor) { |
| 223 DCHECK(backbuffer_suggested_allocation_); | 224 DCHECK(backbuffer_suggested_allocation_); |
| 224 DCHECK(frontbuffer_suggested_allocation_); | 225 DCHECK(frontbuffer_suggested_allocation_); |
| 225 Resize(size); | 226 Resize(size); |
| 226 | 227 |
| 227 DestroySurface(); | 228 DestroySurface(); |
| 228 | 229 |
| 229 visible_size_ = size; | 230 visible_size_ = size; |
| 230 } | 231 } |
| 231 | 232 |
| 232 void PbufferImageTransportSurface::SetLatencyInfo( | 233 void PbufferImageTransportSurface::SetLatencyInfo( |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 271 |
| 271 scoped_refptr<gfx::GLSurface> surface = | 272 scoped_refptr<gfx::GLSurface> surface = |
| 272 gfx::GLSurface::CreateViewGLSurface(false, handle.handle); | 273 gfx::GLSurface::CreateViewGLSurface(false, handle.handle); |
| 273 if (!surface) | 274 if (!surface) |
| 274 return surface; | 275 return surface; |
| 275 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 276 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( |
| 276 manager, stub, surface.get(), handle.is_transport())); | 277 manager, stub, surface.get(), handle.is_transport())); |
| 277 } | 278 } |
| 278 | 279 |
| 279 } // namespace content | 280 } // namespace content |
| OLD | NEW |