| 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 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 549 update_ca_filter = old_layer->ca_filter != ca_filter; | 549 update_ca_filter = old_layer->ca_filter != ca_filter; |
| 550 } else { | 550 } else { |
| 551 if (use_av_layer) { | 551 if (use_av_layer) { |
| 552 av_layer.reset([[AVSampleBufferDisplayLayer alloc] init]); | 552 av_layer.reset([[AVSampleBufferDisplayLayer alloc] init]); |
| 553 ca_layer.reset([av_layer retain]); | 553 ca_layer.reset([av_layer retain]); |
| 554 [av_layer setVideoGravity:AVLayerVideoGravityResize]; | 554 [av_layer setVideoGravity:AVLayerVideoGravityResize]; |
| 555 } else { | 555 } else { |
| 556 ca_layer.reset([[CALayer alloc] init]); | 556 ca_layer.reset([[CALayer alloc] init]); |
| 557 } | 557 } |
| 558 [ca_layer setAnchorPoint:CGPointZero]; | 558 [ca_layer setAnchorPoint:CGPointZero]; |
| 559 [superlayer addSublayer:ca_layer]; | 559 if (old_layer && old_layer->ca_layer) |
| 560 [superlayer replaceSublayer:old_layer->ca_layer with:ca_layer]; |
| 561 else |
| 562 [superlayer addSublayer:ca_layer]; |
| 560 } | 563 } |
| 561 DCHECK_EQ([ca_layer superlayer], superlayer); | 564 DCHECK_EQ([ca_layer superlayer], superlayer); |
| 562 bool update_anything = update_contents || update_contents_rect || | 565 bool update_anything = update_contents || update_contents_rect || |
| 563 update_rect || update_background_color || | 566 update_rect || update_background_color || |
| 564 update_ca_edge_aa_mask || update_opacity || | 567 update_ca_edge_aa_mask || update_opacity || |
| 565 update_ca_filter; | 568 update_ca_filter; |
| 566 if (use_av_layer) { | 569 if (use_av_layer) { |
| 567 if (update_contents) { | 570 if (update_contents) { |
| 568 if (cv_pixel_buffer) { | 571 if (cv_pixel_buffer) { |
| 569 AVSampleBufferDisplayLayerEnqueueCVPixelBuffer(av_layer, | 572 AVSampleBufferDisplayLayerEnqueueCVPixelBuffer(av_layer, |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 622 } else { | 625 } else { |
| 623 // Grey represents a CALayer that has not changed. | 626 // Grey represents a CALayer that has not changed. |
| 624 color.reset(CGColorCreateGenericRGB(0.5, 0.5, 0.5, 1)); | 627 color.reset(CGColorCreateGenericRGB(0.5, 0.5, 0.5, 1)); |
| 625 } | 628 } |
| 626 [ca_layer setBorderWidth:1]; | 629 [ca_layer setBorderWidth:1]; |
| 627 [ca_layer setBorderColor:color]; | 630 [ca_layer setBorderColor:color]; |
| 628 } | 631 } |
| 629 } | 632 } |
| 630 | 633 |
| 631 } // namespace ui | 634 } // namespace ui |
| OLD | NEW |