| 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 unsigned filter) { | 273 unsigned filter) { |
| 274 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; | 274 base::ScopedCFTypeRef<IOSurfaceRef> io_surface; |
| 275 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer; | 275 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer; |
| 276 if (contents_image) { | 276 if (contents_image) { |
| 277 gl::GLImageIOSurface* io_surface_image = | 277 gl::GLImageIOSurface* io_surface_image = |
| 278 static_cast<gl::GLImageIOSurface*>(contents_image); | 278 static_cast<gl::GLImageIOSurface*>(contents_image); |
| 279 io_surface = io_surface_image->io_surface(); | 279 io_surface = io_surface_image->io_surface(); |
| 280 cv_pixel_buffer = io_surface_image->cv_pixel_buffer(); | 280 cv_pixel_buffer = io_surface_image->cv_pixel_buffer(); |
| 281 } | 281 } |
| 282 return ca_layer_tree_coordinator_->GetPendingCARendererLayerTree() | 282 return ca_layer_tree_coordinator_->GetPendingCARendererLayerTree() |
| 283 ->ScheduleCALayer( | 283 ->ScheduleCALayer(is_clipped, gfx::ToEnclosingRect(clip_rect), |
| 284 is_clipped, gfx::ToEnclosingRect(clip_rect), sorting_context_id, | 284 sorting_context_id, transform, io_surface, |
| 285 transform, io_surface, cv_pixel_buffer, contents_rect, | 285 cv_pixel_buffer, contents_rect, |
| 286 gfx::ToEnclosingRect(rect), background_color, edge_aa_mask, opacity); | 286 gfx::ToEnclosingRect(rect), background_color, |
| 287 edge_aa_mask, opacity, filter); |
| 287 } | 288 } |
| 288 | 289 |
| 289 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { | 290 bool ImageTransportSurfaceOverlayMac::IsSurfaceless() const { |
| 290 return true; | 291 return true; |
| 291 } | 292 } |
| 292 | 293 |
| 293 bool ImageTransportSurfaceOverlayMac::Resize(const gfx::Size& pixel_size, | 294 bool ImageTransportSurfaceOverlayMac::Resize(const gfx::Size& pixel_size, |
| 294 float scale_factor, | 295 float scale_factor, |
| 295 bool has_alpha) { | 296 bool has_alpha) { |
| 296 pixel_size_ = pixel_size; | 297 pixel_size_ = pixel_size; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 315 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; | 316 gl_renderer_id_ = context_renderer_id & kCGLRendererIDMatchingMask; |
| 316 | 317 |
| 317 // Post a task holding a reference to the new GL context. The reason for | 318 // Post a task holding a reference to the new GL context. The reason for |
| 318 // this is to avoid creating-then-destroying the context for every image | 319 // this is to avoid creating-then-destroying the context for every image |
| 319 // transport surface that is observing the GPU switch. | 320 // transport surface that is observing the GPU switch. |
| 320 base::MessageLoop::current()->PostTask( | 321 base::MessageLoop::current()->PostTask( |
| 321 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); | 322 FROM_HERE, base::Bind(&IOSurfaceContextNoOp, context_on_new_gpu)); |
| 322 } | 323 } |
| 323 | 324 |
| 324 } // namespace gpu | 325 } // namespace gpu |
| OLD | NEW |