| 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 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 update_ca_filter = old_layer->ca_filter != ca_filter; | 581 update_ca_filter = old_layer->ca_filter != ca_filter; |
| 582 } else { | 582 } else { |
| 583 if (use_av_layer) { | 583 if (use_av_layer) { |
| 584 av_layer.reset([[AVSampleBufferDisplayLayer alloc] init]); | 584 av_layer.reset([[AVSampleBufferDisplayLayer alloc] init]); |
| 585 ca_layer.reset([av_layer retain]); | 585 ca_layer.reset([av_layer retain]); |
| 586 [av_layer setVideoGravity:AVLayerVideoGravityResize]; | 586 [av_layer setVideoGravity:AVLayerVideoGravityResize]; |
| 587 } else { | 587 } else { |
| 588 ca_layer.reset([[CALayer alloc] init]); | 588 ca_layer.reset([[CALayer alloc] init]); |
| 589 } | 589 } |
| 590 [ca_layer setAnchorPoint:CGPointZero]; | 590 [ca_layer setAnchorPoint:CGPointZero]; |
| 591 [superlayer addSublayer:ca_layer]; | 591 if (old_layer && old_layer->ca_layer) |
| 592 [superlayer replaceSublayer:old_layer->ca_layer with:ca_layer]; |
| 593 else |
| 594 [superlayer addSublayer:ca_layer]; |
| 592 } | 595 } |
| 593 DCHECK_EQ([ca_layer superlayer], superlayer); | 596 DCHECK_EQ([ca_layer superlayer], superlayer); |
| 594 bool update_anything = update_contents || update_contents_rect || | 597 bool update_anything = update_contents || update_contents_rect || |
| 595 update_rect || update_background_color || | 598 update_rect || update_background_color || |
| 596 update_ca_edge_aa_mask || update_opacity || | 599 update_ca_edge_aa_mask || update_opacity || |
| 597 update_ca_filter; | 600 update_ca_filter; |
| 598 if (use_av_layer) { | 601 if (use_av_layer) { |
| 599 if (update_contents) { | 602 if (update_contents) { |
| 600 if (cv_pixel_buffer) { | 603 if (cv_pixel_buffer) { |
| 601 AVSampleBufferDisplayLayerEnqueueCVPixelBuffer(av_layer, | 604 AVSampleBufferDisplayLayerEnqueueCVPixelBuffer(av_layer, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 654 } else { | 657 } else { |
| 655 // Grey represents a CALayer that has not changed. | 658 // Grey represents a CALayer that has not changed. |
| 656 color.reset(CGColorCreateGenericRGB(0.5, 0.5, 0.5, 1)); | 659 color.reset(CGColorCreateGenericRGB(0.5, 0.5, 0.5, 1)); |
| 657 } | 660 } |
| 658 [ca_layer setBorderWidth:1]; | 661 [ca_layer setBorderWidth:1]; |
| 659 [ca_layer setBorderColor:color]; | 662 [ca_layer setBorderColor:color]; |
| 660 } | 663 } |
| 661 } | 664 } |
| 662 | 665 |
| 663 } // namespace ui | 666 } // namespace ui |
| OLD | NEW |