| 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> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 tilings_.get(), max_contents_scale, | 285 tilings_.get(), max_contents_scale, |
| 286 shared_quad_state->visible_quad_layer_rect, ideal_contents_scale_); | 286 shared_quad_state->visible_quad_layer_rect, ideal_contents_scale_); |
| 287 iter; ++iter) { | 287 iter; ++iter) { |
| 288 gfx::Rect geometry_rect = iter.geometry_rect(); | 288 gfx::Rect geometry_rect = iter.geometry_rect(); |
| 289 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); | 289 gfx::Rect opaque_rect = contents_opaque() ? geometry_rect : gfx::Rect(); |
| 290 gfx::Rect visible_geometry_rect = | 290 gfx::Rect visible_geometry_rect = |
| 291 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); | 291 scaled_occlusion.GetUnoccludedContentRect(geometry_rect); |
| 292 if (visible_geometry_rect.IsEmpty()) | 292 if (visible_geometry_rect.IsEmpty()) |
| 293 continue; | 293 continue; |
| 294 | 294 |
| 295 append_quads_data->visible_layer_area += | 295 int64_t visible_geometry_area = |
| 296 visible_geometry_rect.width() * visible_geometry_rect.height(); | 296 static_cast<int64_t>(visible_geometry_rect.width()) * |
| 297 visible_geometry_rect.height(); |
| 298 append_quads_data->visible_layer_area += visible_geometry_area; |
| 297 | 299 |
| 298 bool has_draw_quad = false; | 300 bool has_draw_quad = false; |
| 299 if (*iter && iter->draw_info().IsReadyToDraw()) { | 301 if (*iter && iter->draw_info().IsReadyToDraw()) { |
| 300 const TileDrawInfo& draw_info = iter->draw_info(); | 302 const TileDrawInfo& draw_info = iter->draw_info(); |
| 301 switch (draw_info.mode()) { | 303 switch (draw_info.mode()) { |
| 302 case TileDrawInfo::RESOURCE_MODE: { | 304 case TileDrawInfo::RESOURCE_MODE: { |
| 303 gfx::RectF texture_rect = iter.texture_rect(); | 305 gfx::RectF texture_rect = iter.texture_rect(); |
| 304 | 306 |
| 305 // The raster_contents_scale_ is the best scale that the layer is | 307 // The raster_contents_scale_ is the best scale that the layer is |
| 306 // trying to produce, even though it may not be ideal. Since that's | 308 // trying to produce, even though it may not be ideal. Since that's |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 SolidColorDrawQuad* quad = | 352 SolidColorDrawQuad* quad = |
| 351 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 353 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 352 quad->SetNew(shared_quad_state, geometry_rect, visible_geometry_rect, | 354 quad->SetNew(shared_quad_state, geometry_rect, visible_geometry_rect, |
| 353 color, false); | 355 color, false); |
| 354 ValidateQuadResources(quad); | 356 ValidateQuadResources(quad); |
| 355 | 357 |
| 356 if (geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { | 358 if (geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { |
| 357 append_quads_data->num_missing_tiles++; | 359 append_quads_data->num_missing_tiles++; |
| 358 ++missing_tile_count; | 360 ++missing_tile_count; |
| 359 } | 361 } |
| 360 int64_t checkerboarded_area = | |
| 361 visible_geometry_rect.width() * visible_geometry_rect.height(); | |
| 362 append_quads_data->checkerboarded_visible_content_area += | 362 append_quads_data->checkerboarded_visible_content_area += |
| 363 checkerboarded_area; | 363 visible_geometry_area; |
| 364 // Intersect checkerboard rect with interest rect to generate rect where | 364 // Intersect checkerboard rect with interest rect to generate rect where |
| 365 // we checkerboarded and has recording. The area where we don't have | 365 // we checkerboarded and has recording. The area where we don't have |
| 366 // recording is not necessarily a Rect, and its area is calculated using | 366 // recording is not necessarily a Rect, and its area is calculated using |
| 367 // subtraction. | 367 // subtraction. |
| 368 gfx::Rect visible_rect_has_recording = visible_geometry_rect; | 368 gfx::Rect visible_rect_has_recording = visible_geometry_rect; |
| 369 visible_rect_has_recording.Intersect(scaled_recorded_viewport); | 369 visible_rect_has_recording.Intersect(scaled_recorded_viewport); |
| 370 int64_t checkerboarded_has_recording_area = | 370 int64_t checkerboarded_has_recording_area = |
| 371 visible_rect_has_recording.width() * | 371 static_cast<int64_t>(visible_rect_has_recording.width()) * |
| 372 visible_rect_has_recording.height(); | 372 visible_rect_has_recording.height(); |
| 373 append_quads_data->checkerboarded_needs_raster_content_area += | 373 append_quads_data->checkerboarded_needs_raster_content_area += |
| 374 checkerboarded_has_recording_area; | 374 checkerboarded_has_recording_area; |
| 375 append_quads_data->checkerboarded_no_recording_content_area += | 375 append_quads_data->checkerboarded_no_recording_content_area += |
| 376 checkerboarded_area - checkerboarded_has_recording_area; | 376 visible_geometry_area - checkerboarded_has_recording_area; |
| 377 continue; | 377 continue; |
| 378 } | 378 } |
| 379 | 379 |
| 380 if (iter.resolution() != HIGH_RESOLUTION) { | 380 if (iter.resolution() != HIGH_RESOLUTION) { |
| 381 append_quads_data->approximated_visible_content_area += | 381 append_quads_data->approximated_visible_content_area += |
| 382 visible_geometry_rect.width() * visible_geometry_rect.height(); | 382 visible_geometry_area; |
| 383 } | 383 } |
| 384 | 384 |
| 385 // If we have a draw quad, but it's not low resolution, then | 385 // If we have a draw quad, but it's not low resolution, then |
| 386 // mark that we've used something other than low res to draw. | 386 // mark that we've used something other than low res to draw. |
| 387 if (iter.resolution() != LOW_RESOLUTION) | 387 if (iter.resolution() != LOW_RESOLUTION) |
| 388 only_used_low_res_last_append_quads_ = false; | 388 only_used_low_res_last_append_quads_ = false; |
| 389 | 389 |
| 390 if (last_append_quads_tilings_.empty() || | 390 if (last_append_quads_tilings_.empty() || |
| 391 last_append_quads_tilings_.back() != iter.CurrentTiling()) { | 391 last_append_quads_tilings_.back() != iter.CurrentTiling()) { |
| 392 last_append_quads_tilings_.push_back(iter.CurrentTiling()); | 392 last_append_quads_tilings_.push_back(iter.CurrentTiling()); |
| (...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1307 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1308 return !layer_tree_impl()->IsRecycleTree(); | 1308 return !layer_tree_impl()->IsRecycleTree(); |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 bool PictureLayerImpl::HasValidTilePriorities() const { | 1311 bool PictureLayerImpl::HasValidTilePriorities() const { |
| 1312 return IsOnActiveOrPendingTree() && | 1312 return IsOnActiveOrPendingTree() && |
| 1313 is_drawn_render_surface_layer_list_member(); | 1313 is_drawn_render_surface_layer_list_member(); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 } // namespace cc | 1316 } // namespace cc |
| OLD | NEW |