Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: cc/layers/picture_layer_impl.cc

Issue 793693003: Tile Compression (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/tiled_layer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <limits> 8 #include <limits>
9 #include <set> 9 #include <set>
10 10
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 SkColor color; 270 SkColor color;
271 float width; 271 float width;
272 if (*iter && iter->IsReadyToDraw()) { 272 if (*iter && iter->IsReadyToDraw()) {
273 ManagedTileState::DrawInfo::Mode mode = iter->draw_info().mode(); 273 ManagedTileState::DrawInfo::Mode mode = iter->draw_info().mode();
274 if (mode == ManagedTileState::DrawInfo::SOLID_COLOR_MODE) { 274 if (mode == ManagedTileState::DrawInfo::SOLID_COLOR_MODE) {
275 color = DebugColors::SolidColorTileBorderColor(); 275 color = DebugColors::SolidColorTileBorderColor();
276 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl()); 276 width = DebugColors::SolidColorTileBorderWidth(layer_tree_impl());
277 } else if (mode == ManagedTileState::DrawInfo::PICTURE_PILE_MODE) { 277 } else if (mode == ManagedTileState::DrawInfo::PICTURE_PILE_MODE) {
278 color = DebugColors::PictureTileBorderColor(); 278 color = DebugColors::PictureTileBorderColor();
279 width = DebugColors::PictureTileBorderWidth(layer_tree_impl()); 279 width = DebugColors::PictureTileBorderWidth(layer_tree_impl());
280 } else if (iter->draw_info().has_compressed_resource()) {
281 color = DebugColors::CompressedTileBorderColor();
282 width = DebugColors::CompressedTileBorderWidth(layer_tree_impl());
280 } else if (iter.resolution() == HIGH_RESOLUTION) { 283 } else if (iter.resolution() == HIGH_RESOLUTION) {
281 color = DebugColors::HighResTileBorderColor(); 284 color = DebugColors::HighResTileBorderColor();
282 width = DebugColors::HighResTileBorderWidth(layer_tree_impl()); 285 width = DebugColors::HighResTileBorderWidth(layer_tree_impl());
283 } else if (iter.resolution() == LOW_RESOLUTION) { 286 } else if (iter.resolution() == LOW_RESOLUTION) {
284 color = DebugColors::LowResTileBorderColor(); 287 color = DebugColors::LowResTileBorderColor();
285 width = DebugColors::LowResTileBorderWidth(layer_tree_impl()); 288 width = DebugColors::LowResTileBorderWidth(layer_tree_impl());
286 } else if (iter->contents_scale() > max_contents_scale) { 289 } else if (iter->contents_scale() > max_contents_scale) {
287 color = DebugColors::ExtraHighResTileBorderColor(); 290 color = DebugColors::ExtraHighResTileBorderColor();
288 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl()); 291 width = DebugColors::ExtraHighResTileBorderWidth(layer_tree_impl());
289 } else { 292 } else {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 .allow_rasterize_on_demand) { 377 .allow_rasterize_on_demand) {
375 ++on_demand_missing_tile_count; 378 ++on_demand_missing_tile_count;
376 break; 379 break;
377 } 380 }
378 381
379 gfx::RectF texture_rect = iter.texture_rect(); 382 gfx::RectF texture_rect = iter.texture_rect();
380 383
381 ResourceProvider* resource_provider = 384 ResourceProvider* resource_provider =
382 layer_tree_impl()->resource_provider(); 385 layer_tree_impl()->resource_provider();
383 ResourceFormat format = 386 ResourceFormat format =
384 resource_provider->memory_efficient_texture_format(); 387 resource_provider->memory_efficient_texture_format(
388 FORMAT_USAGE_NATIVE);
385 PictureDrawQuad* quad = 389 PictureDrawQuad* quad =
386 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); 390 render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>();
387 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect, 391 quad->SetNew(shared_quad_state, geometry_rect, opaque_rect,
388 visible_geometry_rect, texture_rect, iter.texture_size(), 392 visible_geometry_rect, texture_rect, iter.texture_size(),
389 format, iter->content_rect(), iter->contents_scale(), 393 format, iter->content_rect(), iter->contents_scale(),
390 raster_source_); 394 raster_source_);
391 has_draw_quad = true; 395 has_draw_quad = true;
392 break; 396 break;
393 } 397 }
394 case ManagedTileState::DrawInfo::SOLID_COLOR_MODE: { 398 case ManagedTileState::DrawInfo::SOLID_COLOR_MODE: {
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
609 // the tilings have not been managed, request an update draw properties 613 // the tilings have not been managed, request an update draw properties
610 // to force tilings to get managed. 614 // to force tilings to get managed.
611 layer_tree_impl()->set_needs_update_draw_properties(); 615 layer_tree_impl()->set_needs_update_draw_properties();
612 } 616 }
613 617
614 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { 618 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() {
615 return raster_source_->GetFlattenedPicture(); 619 return raster_source_->GetFlattenedPicture();
616 } 620 }
617 621
618 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, 622 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling,
619 const gfx::Rect& content_rect) { 623 const gfx::Rect& content_rect,
624 int flags) {
620 DCHECK(!raster_source_->IsSolidColor()); 625 DCHECK(!raster_source_->IsSolidColor());
621 if (!raster_source_->CoversRect(content_rect, tiling->contents_scale())) 626 if (!raster_source_->CoversRect(content_rect, tiling->contents_scale()))
622 return scoped_refptr<Tile>(); 627 return scoped_refptr<Tile>();
623 628
624 int flags = 0;
625
626 // We don't handle solid color masks, so we shouldn't bother analyzing those. 629 // We don't handle solid color masks, so we shouldn't bother analyzing those.
627 // Otherwise, always analyze to maximize memory savings. 630 // Otherwise, always analyze to maximize memory savings.
628 if (!is_mask_) 631 if (!is_mask_)
629 flags = Tile::USE_PICTURE_ANALYSIS; 632 flags |= Tile::USE_PICTURE_ANALYSIS;
633 if (contents_opaque())
634 flags |= Tile::IS_OPAQUE;
630 635
631 return layer_tree_impl()->tile_manager()->CreateTile( 636 return layer_tree_impl()->tile_manager()->CreateTile(
632 raster_source_.get(), content_rect.size(), content_rect, 637 raster_source_.get(), content_rect.size(), content_rect,
633 tiling->contents_scale(), id(), layer_tree_impl()->source_frame_number(), 638 tiling->contents_scale(), id(), layer_tree_impl()->source_frame_number(),
634 flags); 639 flags);
635 } 640 }
636 641
637 const Region* PictureLayerImpl::GetPendingInvalidation() { 642 const Region* PictureLayerImpl::GetPendingInvalidation() {
638 if (layer_tree_impl()->IsPendingTree()) 643 if (layer_tree_impl()->IsPendingTree())
639 return &invalidation_; 644 return &invalidation_;
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
777 raster_page_scale_ = other->raster_page_scale_; 782 raster_page_scale_ = other->raster_page_scale_;
778 raster_device_scale_ = other->raster_device_scale_; 783 raster_device_scale_ = other->raster_device_scale_;
779 raster_source_scale_ = other->raster_source_scale_; 784 raster_source_scale_ = other->raster_source_scale_;
780 raster_contents_scale_ = other->raster_contents_scale_; 785 raster_contents_scale_ = other->raster_contents_scale_;
781 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_; 786 low_res_raster_contents_scale_ = other->low_res_raster_contents_scale_;
782 787
783 bool synced_high_res_tiling = false; 788 bool synced_high_res_tiling = false;
784 if (CanHaveTilings()) { 789 if (CanHaveTilings()) {
785 synced_high_res_tiling = tilings_->SyncTilings( 790 synced_high_res_tiling = tilings_->SyncTilings(
786 *other->tilings_, raster_source_->GetSize(), invalidation_, 791 *other->tilings_, raster_source_->GetSize(), invalidation_,
787 MinimumContentsScale(), raster_source_.get()); 792 MinimumContentsScale(), raster_source_.get(),
793 layer_tree_impl()->CurrentBeginFrameArgs().frame_time);
788 } else { 794 } else {
789 RemoveAllTilings(); 795 RemoveAllTilings();
790 } 796 }
791 797
792 // If our MinimumContentsScale has changed to prevent the twin's high res 798 // If our MinimumContentsScale has changed to prevent the twin's high res
793 // tiling from being synced, we should reset the raster scale and let it be 799 // tiling from being synced, we should reset the raster scale and let it be
794 // recalculated (1) again. This can happen if our bounds shrink to the point 800 // recalculated (1) again. This can happen if our bounds shrink to the point
795 // where min contents scale grows. 801 // where min contents scale grows.
796 // (1) - TODO(vmpstr) Instead of hoping that this will be recalculated, we 802 // (1) - TODO(vmpstr) Instead of hoping that this will be recalculated, we
797 // should refactor this code a little bit and actually recalculate this. 803 // should refactor this code a little bit and actually recalculate this.
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after
1355 1361
1356 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const { 1362 bool PictureLayerImpl::AllTilesRequiredForDrawAreReadyToDraw() const {
1357 if (!layer_tree_impl()->IsActiveTree()) 1363 if (!layer_tree_impl()->IsActiveTree())
1358 return true; 1364 return true;
1359 1365
1360 return AllTilesRequiredAreReadyToDraw( 1366 return AllTilesRequiredAreReadyToDraw(
1361 &PictureLayerTiling::IsTileRequiredForDrawIfVisible); 1367 &PictureLayerTiling::IsTileRequiredForDrawIfVisible);
1362 } 1368 }
1363 1369
1364 } // namespace cc 1370 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/layers/tiled_layer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698