| 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 "content/common/gpu/image_transport_surface_overlay_mac.h" | 5 #include "content/common/gpu/image_transport_surface_overlay_mac.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 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 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 if (!layer_needs_update) { | 153 if (!layer_needs_update) { |
| 154 // Green represents contents that are unchanged across frames. | 154 // Green represents contents that are unchanged across frames. |
| 155 color.reset(CGColorCreateGenericRGB(0, 1, 0, 1)); | 155 color.reset(CGColorCreateGenericRGB(0, 1, 0, 1)); |
| 156 } else if (z_order != 0) { | 156 } else if (z_order != 0) { |
| 157 // Pink represents overlay planes | 157 // Pink represents overlay planes |
| 158 color.reset(CGColorCreateGenericRGB(1, 0, 1, 1)); | 158 color.reset(CGColorCreateGenericRGB(1, 0, 1, 1)); |
| 159 } else { | 159 } else { |
| 160 // Red represents damaged contents. | 160 // Red represents damaged contents. |
| 161 color.reset(CGColorCreateGenericRGB(1, 0, 0, 1)); | 161 color.reset(CGColorCreateGenericRGB(1, 0, 0, 1)); |
| 162 } | 162 } |
| 163 [ca_layer setBorderWidth:2]; | 163 [ca_layer setBorderWidth:1]; |
| 164 [ca_layer setBorderColor:color]; | 164 [ca_layer setBorderColor:color]; |
| 165 } | 165 } |
| 166 layer_needs_update = false; | 166 layer_needs_update = false; |
| 167 } | 167 } |
| 168 | 168 |
| 169 void Destroy() { | 169 void Destroy() { |
| 170 if (!ca_layer) | 170 if (!ca_layer) |
| 171 return; | 171 return; |
| 172 [ca_layer setContents:nil]; | 172 [ca_layer setContents:nil]; |
| 173 [ca_layer removeFromSuperlayer]; | 173 [ca_layer removeFromSuperlayer]; |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 swap->gl_fence.reset(); | 364 swap->gl_fence.reset(); |
| 365 CheckGLErrors("while deleting active fence"); | 365 CheckGLErrors("while deleting active fence"); |
| 366 } | 366 } |
| 367 | 367 |
| 368 // Update the plane lists. | 368 // Update the plane lists. |
| 369 { | 369 { |
| 370 // Sort the input planes by z-index, and remove any overlays from the | 370 // Sort the input planes by z-index, and remove any overlays from the |
| 371 // damage rect. | 371 // damage rect. |
| 372 gfx::RectF dip_damage_rect = ConvertRectToDIPF( | 372 gfx::RectF dip_damage_rect = ConvertRectToDIPF( |
| 373 swap->scale_factor, swap->pixel_damage_rect); | 373 swap->scale_factor, swap->pixel_damage_rect); |
| 374 std::sort(swap->overlay_planes.begin(), swap->overlay_planes.end(), | |
| 375 OverlayPlane::Compare); | |
| 376 for (auto& plane : swap->overlay_planes) | 374 for (auto& plane : swap->overlay_planes) |
| 377 dip_damage_rect.Subtract(plane->dip_frame_rect); | 375 dip_damage_rect.Subtract(plane->dip_frame_rect); |
| 378 | 376 |
| 379 ScopedCAActionDisabler disabler; | 377 ScopedCAActionDisabler disabler; |
| 380 UpdateRootAndPartialDamagePlanes(swap->root_plane, dip_damage_rect); | 378 UpdateRootAndPartialDamagePlanes(swap->root_plane, dip_damage_rect); |
| 381 UpdateOverlayPlanes(swap->overlay_planes); | 379 UpdateOverlayPlanes(swap->overlay_planes); |
| 382 UpdateCALayerTree(); | 380 UpdateCALayerTree(); |
| 383 swap->overlay_planes.clear(); | 381 swap->overlay_planes.clear(); |
| 384 } | 382 } |
| 385 | 383 |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 // Compute the previous vsync time. | 744 // Compute the previous vsync time. |
| 747 base::TimeTicks previous_vsync = | 745 base::TimeTicks previous_vsync = |
| 748 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + | 746 vsync_interval_ * ((from - vsync_timebase_) / vsync_interval_) + |
| 749 vsync_timebase_; | 747 vsync_timebase_; |
| 750 | 748 |
| 751 // Return |interval_fraction| through the next vsync. | 749 // Return |interval_fraction| through the next vsync. |
| 752 return previous_vsync + (1 + interval_fraction) * vsync_interval_; | 750 return previous_vsync + (1 + interval_fraction) * vsync_interval_; |
| 753 } | 751 } |
| 754 | 752 |
| 755 } // namespace content | 753 } // namespace content |
| OLD | NEW |