OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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 "cc/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <algorithm> | 10 #include <algorithm> |
8 #include <cmath> | 11 #include <cmath> |
9 #include <limits> | 12 #include <limits> |
10 #include <set> | 13 #include <set> |
11 | 14 |
12 #include "base/time/time.h" | 15 #include "base/time/time.h" |
13 #include "base/trace_event/trace_event_argument.h" | 16 #include "base/trace_event/trace_event_argument.h" |
14 #include "cc/base/math_util.h" | 17 #include "cc/base/math_util.h" |
15 #include "cc/debug/debug_colors.h" | 18 #include "cc/debug/debug_colors.h" |
16 #include "cc/debug/micro_benchmark_impl.h" | 19 #include "cc/debug/micro_benchmark_impl.h" |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
340 SolidColorDrawQuad* quad = | 343 SolidColorDrawQuad* quad = |
341 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 344 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
342 quad->SetNew(shared_quad_state, geometry_rect, visible_geometry_rect, | 345 quad->SetNew(shared_quad_state, geometry_rect, visible_geometry_rect, |
343 color, false); | 346 color, false); |
344 ValidateQuadResources(quad); | 347 ValidateQuadResources(quad); |
345 | 348 |
346 if (geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { | 349 if (geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { |
347 append_quads_data->num_missing_tiles++; | 350 append_quads_data->num_missing_tiles++; |
348 ++missing_tile_count; | 351 ++missing_tile_count; |
349 } | 352 } |
350 int64 checkerboarded_area = | 353 int64_t checkerboarded_area = |
351 visible_geometry_rect.width() * visible_geometry_rect.height(); | 354 visible_geometry_rect.width() * visible_geometry_rect.height(); |
352 append_quads_data->checkerboarded_visible_content_area += | 355 append_quads_data->checkerboarded_visible_content_area += |
353 checkerboarded_area; | 356 checkerboarded_area; |
354 // Intersect checkerboard rect with interest rect to generate rect where | 357 // Intersect checkerboard rect with interest rect to generate rect where |
355 // we checkerboarded and has recording. The area where we don't have | 358 // we checkerboarded and has recording. The area where we don't have |
356 // recording is not necessarily a Rect, and its area is calculated using | 359 // recording is not necessarily a Rect, and its area is calculated using |
357 // subtraction. | 360 // subtraction. |
358 gfx::Rect visible_rect_has_recording = visible_geometry_rect; | 361 gfx::Rect visible_rect_has_recording = visible_geometry_rect; |
359 visible_rect_has_recording.Intersect(scaled_recorded_viewport); | 362 visible_rect_has_recording.Intersect(scaled_recorded_viewport); |
360 int64 checkerboarded_has_recording_area = | 363 int64_t checkerboarded_has_recording_area = |
361 visible_rect_has_recording.width() * | 364 visible_rect_has_recording.width() * |
362 visible_rect_has_recording.height(); | 365 visible_rect_has_recording.height(); |
363 append_quads_data->checkerboarded_needs_raster_content_area += | 366 append_quads_data->checkerboarded_needs_raster_content_area += |
364 checkerboarded_has_recording_area; | 367 checkerboarded_has_recording_area; |
365 append_quads_data->checkerboarded_no_recording_content_area += | 368 append_quads_data->checkerboarded_no_recording_content_area += |
366 checkerboarded_area - checkerboarded_has_recording_area; | 369 checkerboarded_area - checkerboarded_has_recording_area; |
367 continue; | 370 continue; |
368 } | 371 } |
369 | 372 |
370 if (iter.resolution() != HIGH_RESOLUTION) { | 373 if (iter.resolution() != HIGH_RESOLUTION) { |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
970 // layer's rastered content would become larger than the viewport. | 973 // layer's rastered content would become larger than the viewport. |
971 if (draw_properties().screen_space_transform_is_animating && | 974 if (draw_properties().screen_space_transform_is_animating && |
972 !ShouldAdjustRasterScaleDuringScaleAnimations()) { | 975 !ShouldAdjustRasterScaleDuringScaleAnimations()) { |
973 bool can_raster_at_maximum_scale = false; | 976 bool can_raster_at_maximum_scale = false; |
974 bool should_raster_at_starting_scale = false; | 977 bool should_raster_at_starting_scale = false; |
975 float maximum_scale = draw_properties().maximum_animation_contents_scale; | 978 float maximum_scale = draw_properties().maximum_animation_contents_scale; |
976 float starting_scale = draw_properties().starting_animation_contents_scale; | 979 float starting_scale = draw_properties().starting_animation_contents_scale; |
977 if (maximum_scale) { | 980 if (maximum_scale) { |
978 gfx::Size bounds_at_maximum_scale = | 981 gfx::Size bounds_at_maximum_scale = |
979 gfx::ScaleToCeiledSize(raster_source_->GetSize(), maximum_scale); | 982 gfx::ScaleToCeiledSize(raster_source_->GetSize(), maximum_scale); |
980 int64 maximum_area = static_cast<int64>(bounds_at_maximum_scale.width()) * | 983 int64_t maximum_area = |
981 static_cast<int64>(bounds_at_maximum_scale.height()); | 984 static_cast<int64_t>(bounds_at_maximum_scale.width()) * |
| 985 static_cast<int64_t>(bounds_at_maximum_scale.height()); |
982 gfx::Size viewport = layer_tree_impl()->device_viewport_size(); | 986 gfx::Size viewport = layer_tree_impl()->device_viewport_size(); |
983 int64 viewport_area = static_cast<int64>(viewport.width()) * | 987 int64_t viewport_area = static_cast<int64_t>(viewport.width()) * |
984 static_cast<int64>(viewport.height()); | 988 static_cast<int64_t>(viewport.height()); |
985 if (maximum_area <= viewport_area) | 989 if (maximum_area <= viewport_area) |
986 can_raster_at_maximum_scale = true; | 990 can_raster_at_maximum_scale = true; |
987 } | 991 } |
988 if (starting_scale && starting_scale > maximum_scale) { | 992 if (starting_scale && starting_scale > maximum_scale) { |
989 gfx::Size bounds_at_starting_scale = | 993 gfx::Size bounds_at_starting_scale = |
990 gfx::ScaleToCeiledSize(raster_source_->GetSize(), starting_scale); | 994 gfx::ScaleToCeiledSize(raster_source_->GetSize(), starting_scale); |
991 int64 start_area = static_cast<int64>(bounds_at_starting_scale.width()) * | 995 int64_t start_area = |
992 static_cast<int64>(bounds_at_starting_scale.height()); | 996 static_cast<int64_t>(bounds_at_starting_scale.width()) * |
| 997 static_cast<int64_t>(bounds_at_starting_scale.height()); |
993 gfx::Size viewport = layer_tree_impl()->device_viewport_size(); | 998 gfx::Size viewport = layer_tree_impl()->device_viewport_size(); |
994 int64 viewport_area = static_cast<int64>(viewport.width()) * | 999 int64_t viewport_area = static_cast<int64_t>(viewport.width()) * |
995 static_cast<int64>(viewport.height()); | 1000 static_cast<int64_t>(viewport.height()); |
996 if (start_area <= viewport_area) | 1001 if (start_area <= viewport_area) |
997 should_raster_at_starting_scale = true; | 1002 should_raster_at_starting_scale = true; |
998 } | 1003 } |
999 // Use the computed scales for the raster scale directly, do not try to use | 1004 // Use the computed scales for the raster scale directly, do not try to use |
1000 // the ideal scale here. The current ideal scale may be way too large in the | 1005 // the ideal scale here. The current ideal scale may be way too large in the |
1001 // case of an animation with scale, and will be constantly changing. | 1006 // case of an animation with scale, and will be constantly changing. |
1002 if (should_raster_at_starting_scale) | 1007 if (should_raster_at_starting_scale) |
1003 raster_contents_scale_ = starting_scale; | 1008 raster_contents_scale_ = starting_scale; |
1004 else if (can_raster_at_maximum_scale) | 1009 else if (can_raster_at_maximum_scale) |
1005 raster_contents_scale_ = maximum_scale; | 1010 raster_contents_scale_ = maximum_scale; |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1241 | 1246 |
1242 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1247 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1243 return !layer_tree_impl()->IsRecycleTree(); | 1248 return !layer_tree_impl()->IsRecycleTree(); |
1244 } | 1249 } |
1245 | 1250 |
1246 bool PictureLayerImpl::HasValidTilePriorities() const { | 1251 bool PictureLayerImpl::HasValidTilePriorities() const { |
1247 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1252 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
1248 } | 1253 } |
1249 | 1254 |
1250 } // namespace cc | 1255 } // namespace cc |
OLD | NEW |