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/mac/scoped_cftyperef.h" | 7 #include "base/mac/scoped_cftyperef.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/common/gpu/gpu_messages.h" | 9 #include "content/common/gpu/gpu_messages.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 GpuChannelManager* manager, | 123 GpuChannelManager* manager, |
124 GpuCommandBufferStub* stub, | 124 GpuCommandBufferStub* stub, |
125 gfx::PluginWindowHandle handle) | 125 gfx::PluginWindowHandle handle) |
126 : gfx::NoOpGLSurfaceCGL(gfx::Size(1, 1)), | 126 : gfx::NoOpGLSurfaceCGL(gfx::Size(1, 1)), |
127 backbuffer_suggested_allocation_(true), | 127 backbuffer_suggested_allocation_(true), |
128 frontbuffer_suggested_allocation_(true), | 128 frontbuffer_suggested_allocation_(true), |
129 fbo_id_(0), | 129 fbo_id_(0), |
130 texture_id_(0), | 130 texture_id_(0), |
131 io_surface_handle_(0), | 131 io_surface_handle_(0), |
132 context_(NULL), | 132 context_(NULL), |
133 scale_factor_(1), | 133 scale_factor_(1.f), |
134 made_current_(false), | 134 made_current_(false), |
135 is_swap_buffers_pending_(false), | 135 is_swap_buffers_pending_(false), |
136 did_unschedule_(false) { | 136 did_unschedule_(false) { |
137 helper_.reset(new ImageTransportHelper(this, manager, stub, handle)); | 137 helper_.reset(new ImageTransportHelper(this, manager, stub, handle)); |
138 } | 138 } |
139 | 139 |
140 IOSurfaceImageTransportSurface::~IOSurfaceImageTransportSurface() { | 140 IOSurfaceImageTransportSurface::~IOSurfaceImageTransportSurface() { |
141 Destroy(); | 141 Destroy(); |
142 } | 142 } |
143 | 143 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 bool IOSurfaceImageTransportSurface::SwapBuffers() { | 227 bool IOSurfaceImageTransportSurface::SwapBuffers() { |
228 DCHECK(backbuffer_suggested_allocation_); | 228 DCHECK(backbuffer_suggested_allocation_); |
229 if (!frontbuffer_suggested_allocation_) | 229 if (!frontbuffer_suggested_allocation_) |
230 return true; | 230 return true; |
231 glFlush(); | 231 glFlush(); |
232 | 232 |
233 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; | 233 GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params params; |
234 params.surface_handle = io_surface_handle_; | 234 params.surface_handle = io_surface_handle_; |
235 params.size = GetSize(); | 235 params.size = GetSize(); |
| 236 params.scale_factor = scale_factor_; |
236 params.latency_info = latency_info_; | 237 params.latency_info = latency_info_; |
237 helper_->SendAcceleratedSurfaceBuffersSwapped(params); | 238 helper_->SendAcceleratedSurfaceBuffersSwapped(params); |
238 | 239 |
239 DCHECK(!is_swap_buffers_pending_); | 240 DCHECK(!is_swap_buffers_pending_); |
240 is_swap_buffers_pending_ = true; | 241 is_swap_buffers_pending_ = true; |
241 return true; | 242 return true; |
242 } | 243 } |
243 | 244 |
244 bool IOSurfaceImageTransportSurface::PostSubBuffer( | 245 bool IOSurfaceImageTransportSurface::PostSubBuffer( |
245 int x, int y, int width, int height) { | 246 int x, int y, int width, int height) { |
246 DCHECK(backbuffer_suggested_allocation_); | 247 DCHECK(backbuffer_suggested_allocation_); |
247 if (!frontbuffer_suggested_allocation_) | 248 if (!frontbuffer_suggested_allocation_) |
248 return true; | 249 return true; |
249 glFlush(); | 250 glFlush(); |
250 | 251 |
251 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; | 252 GpuHostMsg_AcceleratedSurfacePostSubBuffer_Params params; |
252 params.surface_handle = io_surface_handle_; | 253 params.surface_handle = io_surface_handle_; |
253 params.x = x; | 254 params.x = x; |
254 params.y = y; | 255 params.y = y; |
255 params.width = width; | 256 params.width = width; |
256 params.height = height; | 257 params.height = height; |
257 params.surface_size = GetSize(); | 258 params.surface_size = GetSize(); |
| 259 params.surface_scale_factor = scale_factor_; |
258 params.latency_info = latency_info_; | 260 params.latency_info = latency_info_; |
259 helper_->SendAcceleratedSurfacePostSubBuffer(params); | 261 helper_->SendAcceleratedSurfacePostSubBuffer(params); |
260 | 262 |
261 DCHECK(!is_swap_buffers_pending_); | 263 DCHECK(!is_swap_buffers_pending_); |
262 is_swap_buffers_pending_ = true; | 264 is_swap_buffers_pending_ = true; |
263 return true; | 265 return true; |
264 } | 266 } |
265 | 267 |
266 std::string IOSurfaceImageTransportSurface::GetExtensions() { | 268 std::string IOSurfaceImageTransportSurface::GetExtensions() { |
267 std::string extensions = gfx::GLSurface::GetExtensions(); | 269 std::string extensions = gfx::GLSurface::GetExtensions(); |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 manager, stub, surface.get(), false)); | 484 manager, stub, surface.get(), false)); |
483 } | 485 } |
484 } | 486 } |
485 | 487 |
486 // static | 488 // static |
487 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { | 489 void ImageTransportSurface::SetAllowOSMesaForTesting(bool allow) { |
488 g_allow_os_mesa = allow; | 490 g_allow_os_mesa = allow; |
489 } | 491 } |
490 | 492 |
491 } // namespace content | 493 } // namespace content |
OLD | NEW |