| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/accelerated_widget_mac/ca_renderer_layer_tree.h" | 5 #include "ui/accelerated_widget_mac/ca_renderer_layer_tree.h" |
| 6 | 6 |
| 7 #include <AVFoundation/AVFoundation.h> | 7 #include <AVFoundation/AVFoundation.h> |
| 8 #include <CoreMedia/CoreMedia.h> | 8 #include <CoreMedia/CoreMedia.h> |
| 9 #include <CoreVideo/CoreVideo.h> | 9 #include <CoreVideo/CoreVideo.h> |
| 10 #include <GLES2/gl2extchromium.h> | 10 #include <GLES2/gl2extchromium.h> |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 ca_edge_aa_mask |= kCALayerTopEdge; | 320 ca_edge_aa_mask |= kCALayerTopEdge; |
| 321 if (edge_aa_mask & GL_CA_LAYER_EDGE_BOTTOM_CHROMIUM) | 321 if (edge_aa_mask & GL_CA_LAYER_EDGE_BOTTOM_CHROMIUM) |
| 322 ca_edge_aa_mask |= kCALayerBottomEdge; | 322 ca_edge_aa_mask |= kCALayerBottomEdge; |
| 323 } | 323 } |
| 324 | 324 |
| 325 // Only allow 4:2:0 frames which fill the layer's contents to be promoted to | 325 // Only allow 4:2:0 frames which fill the layer's contents to be promoted to |
| 326 // AV layers. | 326 // AV layers. |
| 327 if (IOSurfaceGetPixelFormat(io_surface) == | 327 if (IOSurfaceGetPixelFormat(io_surface) == |
| 328 kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange && | 328 kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange && |
| 329 contents_rect == gfx::RectF(0, 0, 1, 1)) { | 329 contents_rect == gfx::RectF(0, 0, 1, 1)) { |
| 330 // Enable only for hardware decoded frames, to see if flashing bugs are | 330 use_av_layer = true; |
| 331 // particular to software IOSurfaces. | |
| 332 // https://crbug.com/598269 | |
| 333 if (cv_pixel_buffer) | |
| 334 use_av_layer = true; | |
| 335 } | 331 } |
| 336 } | 332 } |
| 337 | 333 |
| 338 CARendererLayerTree::ContentLayer::ContentLayer(ContentLayer&& layer) | 334 CARendererLayerTree::ContentLayer::ContentLayer(ContentLayer&& layer) |
| 339 : io_surface(layer.io_surface), | 335 : io_surface(layer.io_surface), |
| 340 cv_pixel_buffer(layer.cv_pixel_buffer), | 336 cv_pixel_buffer(layer.cv_pixel_buffer), |
| 341 contents_rect(layer.contents_rect), | 337 contents_rect(layer.contents_rect), |
| 342 rect(layer.rect), | 338 rect(layer.rect), |
| 343 background_color(layer.background_color), | 339 background_color(layer.background_color), |
| 344 ca_edge_aa_mask(layer.ca_edge_aa_mask), | 340 ca_edge_aa_mask(layer.ca_edge_aa_mask), |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 642 [ca_layer setMagnificationFilter:ca_filter]; | 638 [ca_layer setMagnificationFilter:ca_filter]; |
| 643 [ca_layer setMinificationFilter:ca_filter]; | 639 [ca_layer setMinificationFilter:ca_filter]; |
| 644 } | 640 } |
| 645 | 641 |
| 646 static bool show_borders = base::CommandLine::ForCurrentProcess()->HasSwitch( | 642 static bool show_borders = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 647 switches::kShowMacOverlayBorders); | 643 switches::kShowMacOverlayBorders); |
| 648 if (show_borders) { | 644 if (show_borders) { |
| 649 base::ScopedCFTypeRef<CGColorRef> color; | 645 base::ScopedCFTypeRef<CGColorRef> color; |
| 650 if (update_anything) { | 646 if (update_anything) { |
| 651 if (use_av_layer) { | 647 if (use_av_layer) { |
| 652 // Green represents an AV layer that changed this frame. | 648 // Yellow represents an AV layer that changed this frame. |
| 653 color.reset(CGColorCreateGenericRGB(0, 1, 0, 1)); | 649 color.reset(CGColorCreateGenericRGB(1, 1, 0, 1)); |
| 654 } else { | 650 } else { |
| 655 // Pink represents a CALayer that changed this frame. | 651 // Pink represents a CALayer that changed this frame. |
| 656 color.reset(CGColorCreateGenericRGB(1, 0, 1, 1)); | 652 color.reset(CGColorCreateGenericRGB(1, 0, 1, 1)); |
| 657 } | 653 } |
| 658 } else { | 654 } else { |
| 659 // Grey represents a CALayer that has not changed. | 655 // Grey represents a CALayer that has not changed. |
| 660 color.reset(CGColorCreateGenericRGB(0, 0, 0, 0.1)); | 656 color.reset(CGColorCreateGenericRGB(0.5, 0.5, 0.5, 1)); |
| 661 } | 657 } |
| 662 [ca_layer setBorderWidth:1]; | 658 [ca_layer setBorderWidth:1]; |
| 663 [ca_layer setBorderColor:color]; | 659 [ca_layer setBorderColor:color]; |
| 664 } | 660 } |
| 665 } | 661 } |
| 666 | 662 |
| 667 } // namespace ui | 663 } // namespace ui |
| OLD | NEW |