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 <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <set> | 10 #include <set> |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 .allow_rasterize_on_demand) { | 355 .allow_rasterize_on_demand) { |
356 ++on_demand_missing_tile_count; | 356 ++on_demand_missing_tile_count; |
357 break; | 357 break; |
358 } | 358 } |
359 | 359 |
360 gfx::RectF texture_rect = iter.texture_rect(); | 360 gfx::RectF texture_rect = iter.texture_rect(); |
361 | 361 |
362 ResourceProvider* resource_provider = | 362 ResourceProvider* resource_provider = |
363 layer_tree_impl()->resource_provider(); | 363 layer_tree_impl()->resource_provider(); |
364 ResourceFormat format = | 364 ResourceFormat format = |
365 resource_provider->memory_efficient_texture_format(); | 365 resource_provider->memory_efficient_texture_format( |
| 366 FORMAT_USAGE_NATIVE); |
366 PictureDrawQuad* quad = | 367 PictureDrawQuad* quad = |
367 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); | 368 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); |
368 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, | 369 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, |
369 visible_geometry_rect, texture_rect, | 370 visible_geometry_rect, texture_rect, |
370 iter->desired_texture_size(), nearest_neighbor_, format, | 371 iter->desired_texture_size(), nearest_neighbor_, format, |
371 iter->content_rect(), iter->contents_scale(), | 372 iter->content_rect(), iter->contents_scale(), |
372 raster_source_); | 373 raster_source_); |
373 has_draw_quad = true; | 374 has_draw_quad = true; |
374 break; | 375 break; |
375 } | 376 } |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
624 | 625 |
625 scoped_refptr<Tile> PictureLayerImpl::CreateTile( | 626 scoped_refptr<Tile> PictureLayerImpl::CreateTile( |
626 float contents_scale, | 627 float contents_scale, |
627 const gfx::Rect& content_rect) { | 628 const gfx::Rect& content_rect) { |
628 int flags = 0; | 629 int flags = 0; |
629 | 630 |
630 // We don't handle solid color masks, so we shouldn't bother analyzing those. | 631 // We don't handle solid color masks, so we shouldn't bother analyzing those. |
631 // Otherwise, always analyze to maximize memory savings. | 632 // Otherwise, always analyze to maximize memory savings. |
632 if (!is_mask_) | 633 if (!is_mask_) |
633 flags = Tile::USE_PICTURE_ANALYSIS; | 634 flags = Tile::USE_PICTURE_ANALYSIS; |
| 635 if (contents_opaque()) |
| 636 flags |= Tile::IS_OPAQUE; |
634 | 637 |
635 return layer_tree_impl()->tile_manager()->CreateTile( | 638 return layer_tree_impl()->tile_manager()->CreateTile( |
636 raster_source_.get(), content_rect.size(), content_rect, contents_scale, | 639 raster_source_.get(), content_rect.size(), content_rect, contents_scale, |
637 id(), layer_tree_impl()->source_frame_number(), flags); | 640 id(), layer_tree_impl()->source_frame_number(), flags); |
638 } | 641 } |
639 | 642 |
640 const Region* PictureLayerImpl::GetPendingInvalidation() { | 643 const Region* PictureLayerImpl::GetPendingInvalidation() { |
641 if (layer_tree_impl()->IsPendingTree()) | 644 if (layer_tree_impl()->IsPendingTree()) |
642 return &invalidation_; | 645 return &invalidation_; |
643 if (layer_tree_impl()->IsRecycleTree()) | 646 if (layer_tree_impl()->IsRecycleTree()) |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1309 | 1312 |
1310 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { | 1313 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { |
1311 if (!layer_tree_impl()->IsActiveTree()) | 1314 if (!layer_tree_impl()->IsActiveTree()) |
1312 return true; | 1315 return true; |
1313 | 1316 |
1314 return AllTilesRequiredAreReadyToDraw( | 1317 return AllTilesRequiredAreReadyToDraw( |
1315 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); | 1318 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); |
1316 } | 1319 } |
1317 | 1320 |
1318 } // namespace cc | 1321 } // namespace cc |
OLD | NEW |