OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "gpu/ipc/service/image_transport_surface_overlay_mac.h" | 5 #include "gpu/ipc/service/image_transport_surface_overlay_mac.h" |
6 | 6 |
7 #include <CoreGraphics/CoreGraphics.h> | 7 #include <CoreGraphics/CoreGraphics.h> |
8 #include <IOSurface/IOSurface.h> | 8 #include <IOSurface/IOSurface.h> |
9 #include <OpenGL/CGLRenderers.h> | 9 #include <OpenGL/CGLRenderers.h> |
10 #include <OpenGL/CGLTypes.h> | 10 #include <OpenGL/CGLTypes.h> |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 float opacity, | 294 float opacity, |
295 unsigned background_color, | 295 unsigned background_color, |
296 unsigned edge_aa_mask, | 296 unsigned edge_aa_mask, |
297 const gfx::RectF& rect, | 297 const gfx::RectF& rect, |
298 bool is_clipped, | 298 bool is_clipped, |
299 const gfx::RectF& clip_rect, | 299 const gfx::RectF& clip_rect, |
300 const gfx::Transform& transform, | 300 const gfx::Transform& transform, |
301 int sorting_context_id, | 301 int sorting_context_id, |
302 unsigned filter) { | 302 unsigned filter) { |
303 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; | 303 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; |
| 304 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer; |
304 if (contents_image) { | 305 if (contents_image) { |
305 io_surface = | 306 gl::GLImageIOSurface* io_surface_image = |
306 static_cast<gl::GLImageIOSurface*>(contents_image)->io_surface(); | 307 static_cast<gl::GLImageIOSurface*>(contents_image); |
| 308 io_surface = io_surface_image->io_surface(); |
| 309 cv_pixel_buffer = io_surface_image->cv_pixel_buffer(); |
307 } | 310 } |
308 if (!pending_ca_layer_tree_) | 311 if (!pending_ca_layer_tree_) |
309 pending_ca_layer_tree_.reset(new ui::CALayerTree); | 312 pending_ca_layer_tree_.reset(new ui::CALayerTree); |
310 return pending_ca_layer_tree_->ScheduleCALayer( | 313 return pending_ca_layer_tree_->ScheduleCALayer( |
311 is_clipped, gfx::ToEnclosingRect(clip_rect), sorting_context_id, | 314 is_clipped, gfx::ToEnclosingRect(clip_rect), sorting_context_id, |
312 transform, io_surface, contents_rect, gfx::ToEnclosingRect(rect), | 315 transform, io_surface, cv_pixel_buffer, contents_rect, |
313 background_color, edge_aa_mask, opacity); | 316 gfx::ToEnclosingRect(rect), background_color, edge_aa_mask, opacity); |
314 } | 317 } |
315 | 318 |
316 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { | 319 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { |
317 return true; | 320 return true; |
318 } | 321 } |
319 | 322 |
320 bool ImageTransportSurfaceOverlayMac::Resize(const gfx::Size& pixel_size, | 323 bool ImageTransportSurfaceOverlayMac::Resize(const gfx::Size& pixel_size, |
321 float scale_factor, | 324 float scale_factor, |
322 bool has_alpha) { | 325 bool has_alpha) { |
323 // Flush through any pending frames. | 326 // Flush through any pending frames. |
(...skipping 18 matching lines...) Expand all Loading... |
342 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; | 345 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; |
343 | 346 |
344 // Post a task holding a reference to the new GL context. The reason for | 347 // Post a task holding a reference to the new GL context. The reason for |
345 // this is to avoid creating-then-destroying the context for every image | 348 // this is to avoid creating-then-destroying the context for every image |
346 // transport surface that is observing the GPU switch. | 349 // transport surface that is observing the GPU switch. |
347 base::MessageLoop::current()->PostTask( | 350 base::MessageLoop::current()->PostTask( |
348 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); | 351 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); |
349 } | 352 } |
350 | 353 |
351 } // namespace gpu | 354 } // namespace gpu |
OLD | NEW |