| 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 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 // trying to produce, even though it may not be ideal. Since that's | 355 // trying to produce, even though it may not be ideal. Since that's |
| 356 // the best the layer can promise in the future, consider those as | 356 // the best the layer can promise in the future, consider those as |
| 357 // complete. But if a tile is ideal scale, we don't want to consider | 357 // complete. But if a tile is ideal scale, we don't want to consider |
| 358 // it incomplete and trying to replace it with a tile at a worse | 358 // it incomplete and trying to replace it with a tile at a worse |
| 359 // scale. | 359 // scale. |
| 360 if (iter->contents_scale_key() != raster_contents_scale_ && | 360 if (iter->contents_scale_key() != raster_contents_scale_ && |
| 361 iter->contents_scale_key() != ideal_contents_scale_ && | 361 iter->contents_scale_key() != ideal_contents_scale_ && |
| 362 geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { | 362 geometry_rect.Intersects(scaled_viewport_for_tile_priority)) { |
| 363 append_quads_data->num_incomplete_tiles++; | 363 append_quads_data->num_incomplete_tiles++; |
| 364 } | 364 } |
| 365 | 365 Region unoccluded_region(visible_geometry_rect); |
| 366 TileDrawQuad* quad = | 366 scaled_occlusion.OccludeContentRegion(&unoccluded_region); |
| 367 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); | 367 for (Region::Iterator iterator(unoccluded_region); |
| 368 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, | 368 iterator.has_rect(); iterator.next()) { |
| 369 visible_geometry_rect, draw_info.resource_id(), | 369 TileDrawQuad* quad = |
| 370 texture_rect, draw_info.resource_size(), | 370 render_pass->CreateAndAppendDrawQuad<TileDrawQuad>(); |
| 371 draw_info.contents_swizzled(), nearest_neighbor_); | 371 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, |
| 372 ValidateQuadResources(quad); | 372 iterator.rect(), draw_info.resource_id(), texture_rect, |
| 373 draw_info.resource_size(), |
| 374 draw_info.contents_swizzled(), nearest_neighbor_); |
| 375 ValidateQuadResources(quad); |
| 376 } |
| 373 has_draw_quad = true; | 377 has_draw_quad = true; |
| 374 break; | 378 break; |
| 375 } | 379 } |
| 376 case TileDrawInfo::SOLID_COLOR_MODE: { | 380 case TileDrawInfo::SOLID_COLOR_MODE: { |
| 377 float alpha = | 381 float alpha = |
| 378 (SkColorGetA(draw_info.solid_color()) * (1.0f / 255.0f)) * | 382 (SkColorGetA(draw_info.solid_color()) * (1.0f / 255.0f)) * |
| 379 shared_quad_state->opacity; | 383 shared_quad_state->opacity; |
| 380 if (mask_type_ == Layer::LayerMaskType::MULTI_TEXTURE_MASK || | 384 if (mask_type_ == Layer::LayerMaskType::MULTI_TEXTURE_MASK || |
| 381 alpha >= std::numeric_limits<float>::epsilon()) { | 385 alpha >= std::numeric_limits<float>::epsilon()) { |
| 382 SolidColorDrawQuad* quad = | 386 Region unoccluded_region(visible_geometry_rect); |
| 383 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); | 387 scaled_occlusion.OccludeContentRegion(&unoccluded_region); |
| 384 quad->SetNew(shared_quad_state, geometry_rect, | 388 for (Region::Iterator iterator(unoccluded_region); |
| 385 visible_geometry_rect, draw_info.solid_color(), false); | 389 iterator.has_rect(); iterator.next()) { |
| 386 ValidateQuadResources(quad); | 390 SolidColorDrawQuad* quad = |
| 391 render_pass->CreateAndAppendDrawQuad<SolidColorDrawQuad>(); |
| 392 quad->SetNew(shared_quad_state, geometry_rect, iterator.rect(), |
| 393 draw_info.solid_color(), false); |
| 394 ValidateQuadResources(quad); |
| 395 } |
| 387 } | 396 } |
| 388 has_draw_quad = true; | 397 has_draw_quad = true; |
| 389 break; | 398 break; |
| 390 } | 399 } |
| 391 case TileDrawInfo::OOM_MODE: | 400 case TileDrawInfo::OOM_MODE: |
| 392 break; // Checkerboard. | 401 break; // Checkerboard. |
| 393 } | 402 } |
| 394 } | 403 } |
| 395 | 404 |
| 396 if (!has_draw_quad) { | 405 if (!has_draw_quad) { |
| (...skipping 1086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1483 } | 1492 } |
| 1484 | 1493 |
| 1485 invalidation_.Union(invalidation); | 1494 invalidation_.Union(invalidation); |
| 1486 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); | 1495 tilings_->UpdateTilingsForImplSideInvalidation(invalidation); |
| 1487 SetNeedsPushProperties(); | 1496 SetNeedsPushProperties(); |
| 1488 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", | 1497 TRACE_EVENT_END1("cc", "PictureLayerImpl::InvalidateRegionForImages", |
| 1489 "Invalidation", invalidation.ToString()); | 1498 "Invalidation", invalidation.ToString()); |
| 1490 } | 1499 } |
| 1491 | 1500 |
| 1492 } // namespace cc | 1501 } // namespace cc |
| OLD | NEW |