Chromium Code Reviews| 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 134 bool is_clipped, | 134 bool is_clipped, |
| 135 const gfx::Rect& clip_rect, | 135 const gfx::Rect& clip_rect, |
| 136 unsigned sorting_context_id, | 136 unsigned sorting_context_id, |
| 137 const gfx::Transform& transform, | 137 const gfx::Transform& transform, |
| 138 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 138 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 139 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, | 139 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, |
| 140 const gfx::RectF& contents_rect, | 140 const gfx::RectF& contents_rect, |
| 141 const gfx::Rect& rect, | 141 const gfx::Rect& rect, |
| 142 unsigned background_color, | 142 unsigned background_color, |
| 143 unsigned edge_aa_mask, | 143 unsigned edge_aa_mask, |
| 144 float opacity) { | 144 float opacity, |
| 145 unsigned filter) { | |
| 145 // Excessive logging to debug white screens (crbug.com/583805). | 146 // Excessive logging to debug white screens (crbug.com/583805). |
| 146 // TODO(ccameron): change this back to a DLOG. | 147 // TODO(ccameron): change this back to a DLOG. |
| 147 if (has_committed_) { | 148 if (has_committed_) { |
| 148 LOG(ERROR) << "ScheduleCALayer called after CommitScheduledCALayers."; | 149 LOG(ERROR) << "ScheduleCALayer called after CommitScheduledCALayers."; |
| 149 return false; | 150 return false; |
| 150 } | 151 } |
| 151 return root_layer_.AddContentLayer(is_clipped, clip_rect, sorting_context_id, | 152 return root_layer_.AddContentLayer(is_clipped, clip_rect, sorting_context_id, |
| 152 transform, io_surface, cv_pixel_buffer, | 153 transform, io_surface, cv_pixel_buffer, |
| 153 contents_rect, rect, background_color, | 154 contents_rect, rect, background_color, |
| 154 edge_aa_mask, opacity); | 155 edge_aa_mask, opacity, filter); |
| 155 } | 156 } |
| 156 | 157 |
| 157 void CARendererLayerTree::CommitScheduledCALayers( | 158 void CARendererLayerTree::CommitScheduledCALayers( |
| 158 CALayer* superlayer, | 159 CALayer* superlayer, |
| 159 std::unique_ptr<CARendererLayerTree> old_tree, | 160 std::unique_ptr<CARendererLayerTree> old_tree, |
| 160 float scale_factor) { | 161 float scale_factor) { |
| 161 TRACE_EVENT0("gpu", "CARendererLayerTree::CommitScheduledCALayers"); | 162 TRACE_EVENT0("gpu", "CARendererLayerTree::CommitScheduledCALayers"); |
| 162 RootLayer* old_root_layer = nullptr; | 163 RootLayer* old_root_layer = nullptr; |
| 163 if (old_tree) { | 164 if (old_tree) { |
| 164 DCHECK(old_tree->has_committed_); | 165 DCHECK(old_tree->has_committed_); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 278 [ca_layer removeFromSuperlayer]; | 279 [ca_layer removeFromSuperlayer]; |
| 279 } | 280 } |
| 280 | 281 |
| 281 CARendererLayerTree::ContentLayer::ContentLayer( | 282 CARendererLayerTree::ContentLayer::ContentLayer( |
| 282 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 283 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 283 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, | 284 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, |
| 284 const gfx::RectF& contents_rect, | 285 const gfx::RectF& contents_rect, |
| 285 const gfx::Rect& rect, | 286 const gfx::Rect& rect, |
| 286 unsigned background_color, | 287 unsigned background_color, |
| 287 unsigned edge_aa_mask, | 288 unsigned edge_aa_mask, |
| 288 float opacity) | 289 float opacity, |
| 290 unsigned filter) | |
| 289 : io_surface(io_surface), | 291 : io_surface(io_surface), |
| 290 cv_pixel_buffer(cv_pixel_buffer), | 292 cv_pixel_buffer(cv_pixel_buffer), |
| 291 contents_rect(contents_rect), | 293 contents_rect(contents_rect), |
| 292 rect(rect), | 294 rect(rect), |
| 293 background_color(background_color), | 295 background_color(background_color), |
| 294 ca_edge_aa_mask(0), | 296 ca_edge_aa_mask(0), |
| 295 opacity(opacity) { | 297 opacity(opacity) { |
| 298 DCHECK(filter == GL_LINEAR || filter == GL_NEAREST); | |
| 299 if (filter == GL_LINEAR) { | |
| 300 ca_filter.reset([kCAFilterLinear retain]); | |
| 301 } else { | |
| 302 ca_filter.reset([kCAFilterNearest retain]); | |
| 303 } | |
| 304 | |
| 296 // Because the root layer has setGeometryFlipped:YES, there is some ambiguity | 305 // Because the root layer has setGeometryFlipped:YES, there is some ambiguity |
| 297 // about what exactly top and bottom mean. This ambiguity is resolved in | 306 // about what exactly top and bottom mean. This ambiguity is resolved in |
| 298 // different ways for solid color CALayers and for CALayers that have content | 307 // different ways for solid color CALayers and for CALayers that have content |
| 299 // (surprise!). For CALayers with IOSurface content, the top edge in the AA | 308 // (surprise!). For CALayers with IOSurface content, the top edge in the AA |
| 300 // mask refers to what appears as the bottom edge on-screen. For CALayers | 309 // mask refers to what appears as the bottom edge on-screen. For CALayers |
| 301 // without content (solid color layers), the top edge in the AA mask is the | 310 // without content (solid color layers), the top edge in the AA mask is the |
| 302 // top edge on-screen. | 311 // top edge on-screen. |
| 303 // https://crbug.com/567946 | 312 // https://crbug.com/567946 |
| 304 if (edge_aa_mask & GL_CA_LAYER_EDGE_LEFT_CHROMIUM) | 313 if (edge_aa_mask & GL_CA_LAYER_EDGE_LEFT_CHROMIUM) |
| 305 ca_edge_aa_mask |= kCALayerLeftEdge; | 314 ca_edge_aa_mask |= kCALayerLeftEdge; |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 331 } | 340 } |
| 332 | 341 |
| 333 CARendererLayerTree::ContentLayer::ContentLayer(ContentLayer&& layer) | 342 CARendererLayerTree::ContentLayer::ContentLayer(ContentLayer&& layer) |
| 334 : io_surface(layer.io_surface), | 343 : io_surface(layer.io_surface), |
| 335 cv_pixel_buffer(layer.cv_pixel_buffer), | 344 cv_pixel_buffer(layer.cv_pixel_buffer), |
| 336 contents_rect(layer.contents_rect), | 345 contents_rect(layer.contents_rect), |
| 337 rect(layer.rect), | 346 rect(layer.rect), |
| 338 background_color(layer.background_color), | 347 background_color(layer.background_color), |
| 339 ca_edge_aa_mask(layer.ca_edge_aa_mask), | 348 ca_edge_aa_mask(layer.ca_edge_aa_mask), |
| 340 opacity(layer.opacity), | 349 opacity(layer.opacity), |
| 350 ca_filter(std::move(layer.ca_filter)), | |
|
ccameron
2016/04/27 22:45:48
Cause then we don't have to do the move here.
erikchen
2016/04/28 01:18:21
Done.
| |
| 341 ca_layer(std::move(layer.ca_layer)), | 351 ca_layer(std::move(layer.ca_layer)), |
| 342 av_layer(std::move(layer.av_layer)), | 352 av_layer(std::move(layer.av_layer)), |
| 343 use_av_layer(layer.use_av_layer) { | 353 use_av_layer(layer.use_av_layer) { |
| 344 DCHECK(!layer.ca_layer); | 354 DCHECK(!layer.ca_layer); |
| 345 DCHECK(!layer.av_layer); | 355 DCHECK(!layer.av_layer); |
| 346 } | 356 } |
| 347 | 357 |
| 348 CARendererLayerTree::ContentLayer::~ContentLayer() { | 358 CARendererLayerTree::ContentLayer::~ContentLayer() { |
| 349 [ca_layer removeFromSuperlayer]; | 359 [ca_layer removeFromSuperlayer]; |
| 350 } | 360 } |
| 351 | 361 |
| 352 bool CARendererLayerTree::RootLayer::AddContentLayer( | 362 bool CARendererLayerTree::RootLayer::AddContentLayer( |
| 353 bool is_clipped, | 363 bool is_clipped, |
| 354 const gfx::Rect& clip_rect, | 364 const gfx::Rect& clip_rect, |
| 355 unsigned sorting_context_id, | 365 unsigned sorting_context_id, |
| 356 const gfx::Transform& transform, | 366 const gfx::Transform& transform, |
| 357 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 367 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 358 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, | 368 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, |
| 359 const gfx::RectF& contents_rect, | 369 const gfx::RectF& contents_rect, |
| 360 const gfx::Rect& rect, | 370 const gfx::Rect& rect, |
| 361 unsigned background_color, | 371 unsigned background_color, |
| 362 unsigned edge_aa_mask, | 372 unsigned edge_aa_mask, |
| 363 float opacity) { | 373 float opacity, |
| 374 unsigned filter) { | |
| 364 bool needs_new_clip_and_sorting_layer = true; | 375 bool needs_new_clip_and_sorting_layer = true; |
| 365 | 376 |
| 366 // In sorting_context_id 0, all quads are listed in back-to-front order. | 377 // In sorting_context_id 0, all quads are listed in back-to-front order. |
| 367 // This is accomplished by having the CALayers be siblings of each other. | 378 // This is accomplished by having the CALayers be siblings of each other. |
| 368 // If a quad has a 3D transform, it is necessary to put it in its own sorting | 379 // If a quad has a 3D transform, it is necessary to put it in its own sorting |
| 369 // context, so that it will not intersect with quads before and after it. | 380 // context, so that it will not intersect with quads before and after it. |
| 370 bool is_singleton_sorting_context = | 381 bool is_singleton_sorting_context = |
| 371 !sorting_context_id && !transform.IsFlat(); | 382 !sorting_context_id && !transform.IsFlat(); |
| 372 | 383 |
| 373 if (!clip_and_sorting_layers.empty()) { | 384 if (!clip_and_sorting_layers.empty()) { |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 391 needs_new_clip_and_sorting_layer = false; | 402 needs_new_clip_and_sorting_layer = false; |
| 392 } | 403 } |
| 393 } | 404 } |
| 394 if (needs_new_clip_and_sorting_layer) { | 405 if (needs_new_clip_and_sorting_layer) { |
| 395 clip_and_sorting_layers.push_back( | 406 clip_and_sorting_layers.push_back( |
| 396 ClipAndSortingLayer(is_clipped, clip_rect, sorting_context_id, | 407 ClipAndSortingLayer(is_clipped, clip_rect, sorting_context_id, |
| 397 is_singleton_sorting_context)); | 408 is_singleton_sorting_context)); |
| 398 } | 409 } |
| 399 clip_and_sorting_layers.back().AddContentLayer( | 410 clip_and_sorting_layers.back().AddContentLayer( |
| 400 transform, io_surface, cv_pixel_buffer, contents_rect, rect, | 411 transform, io_surface, cv_pixel_buffer, contents_rect, rect, |
| 401 background_color, edge_aa_mask, opacity); | 412 background_color, edge_aa_mask, opacity, filter); |
| 402 return true; | 413 return true; |
| 403 } | 414 } |
| 404 | 415 |
| 405 void CARendererLayerTree::ClipAndSortingLayer::AddContentLayer( | 416 void CARendererLayerTree::ClipAndSortingLayer::AddContentLayer( |
| 406 const gfx::Transform& transform, | 417 const gfx::Transform& transform, |
| 407 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 418 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 408 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, | 419 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, |
| 409 const gfx::RectF& contents_rect, | 420 const gfx::RectF& contents_rect, |
| 410 const gfx::Rect& rect, | 421 const gfx::Rect& rect, |
| 411 unsigned background_color, | 422 unsigned background_color, |
| 412 unsigned edge_aa_mask, | 423 unsigned edge_aa_mask, |
| 413 float opacity) { | 424 float opacity, |
| 425 unsigned filter) { | |
| 414 bool needs_new_transform_layer = true; | 426 bool needs_new_transform_layer = true; |
| 415 if (!transform_layers.empty()) { | 427 if (!transform_layers.empty()) { |
| 416 const TransformLayer& current_layer = transform_layers.back(); | 428 const TransformLayer& current_layer = transform_layers.back(); |
| 417 if (current_layer.transform == transform) | 429 if (current_layer.transform == transform) |
| 418 needs_new_transform_layer = false; | 430 needs_new_transform_layer = false; |
| 419 } | 431 } |
| 420 if (needs_new_transform_layer) | 432 if (needs_new_transform_layer) |
| 421 transform_layers.push_back(TransformLayer(transform)); | 433 transform_layers.push_back(TransformLayer(transform)); |
| 422 transform_layers.back().AddContentLayer(io_surface, cv_pixel_buffer, | 434 transform_layers.back().AddContentLayer(io_surface, cv_pixel_buffer, |
| 423 contents_rect, rect, background_color, | 435 contents_rect, rect, background_color, |
| 424 edge_aa_mask, opacity); | 436 edge_aa_mask, opacity, filter); |
| 425 } | 437 } |
| 426 | 438 |
| 427 void CARendererLayerTree::TransformLayer::AddContentLayer( | 439 void CARendererLayerTree::TransformLayer::AddContentLayer( |
| 428 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, | 440 base::ScopedCFTypeRef<IOSurfaceRef> io_surface, |
| 429 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, | 441 base::ScopedCFTypeRef<CVPixelBufferRef> cv_pixel_buffer, |
| 430 const gfx::RectF& contents_rect, | 442 const gfx::RectF& contents_rect, |
| 431 const gfx::Rect& rect, | 443 const gfx::Rect& rect, |
| 432 unsigned background_color, | 444 unsigned background_color, |
| 433 unsigned edge_aa_mask, | 445 unsigned edge_aa_mask, |
| 434 float opacity) { | 446 float opacity, |
| 447 unsigned filter) { | |
| 435 content_layers.push_back(ContentLayer(io_surface, cv_pixel_buffer, | 448 content_layers.push_back(ContentLayer(io_surface, cv_pixel_buffer, |
| 436 contents_rect, rect, background_color, | 449 contents_rect, rect, background_color, |
| 437 edge_aa_mask, opacity)); | 450 edge_aa_mask, opacity, filter)); |
| 438 } | 451 } |
| 439 | 452 |
| 440 void CARendererLayerTree::RootLayer::CommitToCA(CALayer* superlayer, | 453 void CARendererLayerTree::RootLayer::CommitToCA(CALayer* superlayer, |
| 441 RootLayer* old_layer, | 454 RootLayer* old_layer, |
| 442 float scale_factor) { | 455 float scale_factor) { |
| 443 if (old_layer) { | 456 if (old_layer) { |
| 444 DCHECK(old_layer->ca_layer); | 457 DCHECK(old_layer->ca_layer); |
| 445 std::swap(ca_layer, old_layer->ca_layer); | 458 std::swap(ca_layer, old_layer->ca_layer); |
| 446 } else { | 459 } else { |
| 447 ca_layer.reset([[CALayer alloc] init]); | 460 ca_layer.reset([[CALayer alloc] init]); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 554 | 567 |
| 555 void CARendererLayerTree::ContentLayer::CommitToCA(CALayer* superlayer, | 568 void CARendererLayerTree::ContentLayer::CommitToCA(CALayer* superlayer, |
| 556 ContentLayer* old_layer, | 569 ContentLayer* old_layer, |
| 557 float scale_factor) { | 570 float scale_factor) { |
| 558 bool update_contents = true; | 571 bool update_contents = true; |
| 559 bool update_contents_rect = true; | 572 bool update_contents_rect = true; |
| 560 bool update_rect = true; | 573 bool update_rect = true; |
| 561 bool update_background_color = true; | 574 bool update_background_color = true; |
| 562 bool update_ca_edge_aa_mask = true; | 575 bool update_ca_edge_aa_mask = true; |
| 563 bool update_opacity = true; | 576 bool update_opacity = true; |
| 577 bool update_ca_filter = true; | |
| 564 if (old_layer && old_layer->use_av_layer == use_av_layer) { | 578 if (old_layer && old_layer->use_av_layer == use_av_layer) { |
| 565 DCHECK(old_layer->ca_layer); | 579 DCHECK(old_layer->ca_layer); |
| 566 std::swap(ca_layer, old_layer->ca_layer); | 580 std::swap(ca_layer, old_layer->ca_layer); |
| 567 std::swap(av_layer, old_layer->av_layer); | 581 std::swap(av_layer, old_layer->av_layer); |
| 568 update_contents = old_layer->io_surface != io_surface || | 582 update_contents = old_layer->io_surface != io_surface || |
| 569 old_layer->cv_pixel_buffer != cv_pixel_buffer; | 583 old_layer->cv_pixel_buffer != cv_pixel_buffer; |
| 570 update_contents_rect = old_layer->contents_rect != contents_rect; | 584 update_contents_rect = old_layer->contents_rect != contents_rect; |
| 571 update_rect = old_layer->rect != rect; | 585 update_rect = old_layer->rect != rect; |
| 572 update_background_color = old_layer->background_color != background_color; | 586 update_background_color = old_layer->background_color != background_color; |
| 573 update_ca_edge_aa_mask = old_layer->ca_edge_aa_mask != ca_edge_aa_mask; | 587 update_ca_edge_aa_mask = old_layer->ca_edge_aa_mask != ca_edge_aa_mask; |
| 574 update_opacity = old_layer->opacity != opacity; | 588 update_opacity = old_layer->opacity != opacity; |
| 589 update_ca_filter = ![old_layer->ca_filter isEqualToString:ca_filter]; | |
|
ccameron
2016/04/27 22:45:48
And we can just do a ptr compare.
erikchen
2016/04/28 01:18:21
Done.
| |
| 575 } else { | 590 } else { |
| 576 if (use_av_layer) { | 591 if (use_av_layer) { |
| 577 av_layer.reset([[AVSampleBufferDisplayLayer alloc] init]); | 592 av_layer.reset([[AVSampleBufferDisplayLayer alloc] init]); |
| 578 ca_layer.reset([av_layer retain]); | 593 ca_layer.reset([av_layer retain]); |
| 579 [av_layer setVideoGravity:AVLayerVideoGravityResize]; | 594 [av_layer setVideoGravity:AVLayerVideoGravityResize]; |
| 580 } else { | 595 } else { |
| 581 ca_layer.reset([[CALayer alloc] init]); | 596 ca_layer.reset([[CALayer alloc] init]); |
| 582 } | 597 } |
| 583 [ca_layer setAnchorPoint:CGPointZero]; | 598 [ca_layer setAnchorPoint:CGPointZero]; |
| 584 [superlayer addSublayer:ca_layer]; | 599 [superlayer addSublayer:ca_layer]; |
| 585 } | 600 } |
| 586 DCHECK_EQ([ca_layer superlayer], superlayer); | 601 DCHECK_EQ([ca_layer superlayer], superlayer); |
| 587 bool update_anything = update_contents || update_contents_rect || | 602 bool update_anything = update_contents || update_contents_rect || |
| 588 update_rect || update_background_color || | 603 update_rect || update_background_color || |
| 589 update_ca_edge_aa_mask || update_opacity; | 604 update_ca_edge_aa_mask || update_opacity || |
| 605 update_ca_filter; | |
| 590 if (use_av_layer) { | 606 if (use_av_layer) { |
| 591 if (update_contents) { | 607 if (update_contents) { |
| 592 if (cv_pixel_buffer) { | 608 if (cv_pixel_buffer) { |
| 593 AVSampleBufferDisplayLayerEnqueueCVPixelBuffer(av_layer, | 609 AVSampleBufferDisplayLayerEnqueueCVPixelBuffer(av_layer, |
| 594 cv_pixel_buffer); | 610 cv_pixel_buffer); |
| 595 } else { | 611 } else { |
| 596 AVSampleBufferDisplayLayerEnqueueIOSurface(av_layer, io_surface); | 612 AVSampleBufferDisplayLayerEnqueueIOSurface(av_layer, io_surface); |
| 597 } | 613 } |
| 598 } | 614 } |
| 599 } else { | 615 } else { |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 619 SkColorGetA(background_color) / 255., | 635 SkColorGetA(background_color) / 255., |
| 620 }; | 636 }; |
| 621 base::ScopedCFTypeRef<CGColorRef> srgb_background_color(CGColorCreate( | 637 base::ScopedCFTypeRef<CGColorRef> srgb_background_color(CGColorCreate( |
| 622 CGColorSpaceCreateWithName(kCGColorSpaceSRGB), rgba_color_components)); | 638 CGColorSpaceCreateWithName(kCGColorSpaceSRGB), rgba_color_components)); |
| 623 [ca_layer setBackgroundColor:srgb_background_color]; | 639 [ca_layer setBackgroundColor:srgb_background_color]; |
| 624 } | 640 } |
| 625 if (update_ca_edge_aa_mask) | 641 if (update_ca_edge_aa_mask) |
| 626 [ca_layer setEdgeAntialiasingMask:ca_edge_aa_mask]; | 642 [ca_layer setEdgeAntialiasingMask:ca_edge_aa_mask]; |
| 627 if (update_opacity) | 643 if (update_opacity) |
| 628 [ca_layer setOpacity:opacity]; | 644 [ca_layer setOpacity:opacity]; |
| 645 if (update_ca_filter) { | |
| 646 [ca_layer setMagnificationFilter:ca_filter]; | |
| 647 [ca_layer setMinificationFilter:ca_filter]; | |
| 648 } | |
| 629 | 649 |
| 630 static bool show_borders = base::CommandLine::ForCurrentProcess()->HasSwitch( | 650 static bool show_borders = base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 631 switches::kShowMacOverlayBorders); | 651 switches::kShowMacOverlayBorders); |
| 632 if (show_borders) { | 652 if (show_borders) { |
| 633 base::ScopedCFTypeRef<CGColorRef> color; | 653 base::ScopedCFTypeRef<CGColorRef> color; |
| 634 if (update_anything) { | 654 if (update_anything) { |
| 635 if (use_av_layer) { | 655 if (use_av_layer) { |
| 636 // Green represents an AV layer that changed this frame. | 656 // Green represents an AV layer that changed this frame. |
| 637 color.reset(CGColorCreateGenericRGB(0, 1, 0, 1)); | 657 color.reset(CGColorCreateGenericRGB(0, 1, 0, 1)); |
| 638 } else { | 658 } else { |
| 639 // Pink represents a CALayer that changed this frame. | 659 // Pink represents a CALayer that changed this frame. |
| 640 color.reset(CGColorCreateGenericRGB(1, 0, 1, 1)); | 660 color.reset(CGColorCreateGenericRGB(1, 0, 1, 1)); |
| 641 } | 661 } |
| 642 } else { | 662 } else { |
| 643 // Grey represents a CALayer that has not changed. | 663 // Grey represents a CALayer that has not changed. |
| 644 color.reset(CGColorCreateGenericRGB(0, 0, 0, 0.1)); | 664 color.reset(CGColorCreateGenericRGB(0, 0, 0, 0.1)); |
| 645 } | 665 } |
| 646 [ca_layer setBorderWidth:1]; | 666 [ca_layer setBorderWidth:1]; |
| 647 [ca_layer setBorderColor:color]; | 667 [ca_layer setBorderColor:color]; |
| 648 } | 668 } |
| 649 } | 669 } |
| 650 | 670 |
| 651 } // namespace ui | 671 } // namespace ui |
| OLD | NEW |