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

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

Issue 14883003: cc: Fix impl-side painting flashing due to missing tiles (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/resources/picture_layer_tiling.h » ('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 8
9 #include "base/time.h" 9 #include "base/time.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 *contents_scale_x = max_contents_scale; 370 *contents_scale_x = max_contents_scale;
371 *contents_scale_y = max_contents_scale; 371 *contents_scale_y = max_contents_scale;
372 *content_bounds = gfx::ToCeiledSize( 372 *content_bounds = gfx::ToCeiledSize(
373 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale)); 373 gfx::ScaleSize(bounds(), max_contents_scale, max_contents_scale));
374 } 374 }
375 375
376 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() { 376 skia::RefPtr<SkPicture> PictureLayerImpl::GetPicture() {
377 return pile_->GetFlattenedPicture(); 377 return pile_->GetFlattenedPicture();
378 } 378 }
379 379
380 scoped_refptr<Tile> PictureLayerImpl::CreateTile(PictureLayerTiling* tiling, 380 scoped_refptr<Tile> PictureLayerImpl::CreateTile(
381 gfx::Rect content_rect) { 381 const PictureLayerTiling* tiling,
enne (OOO) 2013/05/02 23:25:37 This isn't actually needed. I previously was tryi
382 gfx::Rect content_rect) {
382 if (!pile_->CanRaster(tiling->contents_scale(), content_rect)) 383 if (!pile_->CanRaster(tiling->contents_scale(), content_rect))
383 return scoped_refptr<Tile>(); 384 return scoped_refptr<Tile>();
384 385
385 return make_scoped_refptr(new Tile( 386 return make_scoped_refptr(new Tile(
386 layer_tree_impl()->tile_manager(), 387 layer_tree_impl()->tile_manager(),
387 pile_.get(), 388 pile_.get(),
388 content_rect.size(), 389 content_rect.size(),
389 content_rect, 390 content_rect,
390 contents_opaque() ? content_rect : gfx::Rect(), 391 contents_opaque() ? content_rect : gfx::Rect(),
391 tiling->contents_scale(), 392 tiling->contents_scale(),
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 518
518 tilings_->CloneAll(*other->tilings_, MinimumContentsScale()); 519 tilings_->CloneAll(*other->tilings_, MinimumContentsScale());
519 DCHECK(bounds() == tilings_->layer_bounds()); 520 DCHECK(bounds() == tilings_->layer_bounds());
520 } 521 }
521 522
522 void PictureLayerImpl::SyncTiling( 523 void PictureLayerImpl::SyncTiling(
523 const PictureLayerTiling* tiling) { 524 const PictureLayerTiling* tiling) {
524 if (!DrawsContent() || tiling->contents_scale() < MinimumContentsScale()) 525 if (!DrawsContent() || tiling->contents_scale() < MinimumContentsScale())
525 return; 526 return;
526 tilings_->Clone(tiling); 527 tilings_->Clone(tiling);
528
529 // If this tree needs update draw properties, then the tiling will
530 // get updated prior to drawing or activation. If this tree does not
531 // need update draw properties, then its transforms are up to date and
532 // we can create tiles for this tiling immediately.
533 if (!layer_tree_impl()->needs_update_draw_properties())
534 UpdateTilePriorities();
527 } 535 }
528 536
529 void PictureLayerImpl::SetIsMask(bool is_mask) { 537 void PictureLayerImpl::SetIsMask(bool is_mask) {
530 if (is_mask_ == is_mask) 538 if (is_mask_ == is_mask)
531 return; 539 return;
532 is_mask_ = is_mask; 540 is_mask_ = is_mask;
533 if (tilings_) 541 if (tilings_)
534 tilings_->RemoveAllTiles(); 542 tilings_->RemoveAllTiles();
535 } 543 }
536 544
(...skipping 13 matching lines...) Expand all
550 // Masks only supported if they fit on exactly one tile. 558 // Masks only supported if they fit on exactly one tile.
551 if (iter.geometry_rect() != content_rect) 559 if (iter.geometry_rect() != content_rect)
552 return 0; 560 return 0;
553 return iter->drawing_info().get_resource_id(); 561 return iter->drawing_info().get_resource_id();
554 } 562 }
555 return 0; 563 return 0;
556 } 564 }
557 565
558 bool PictureLayerImpl::AreVisibleResourcesReady() const { 566 bool PictureLayerImpl::AreVisibleResourcesReady() const {
559 DCHECK(layer_tree_impl()->IsPendingTree()); 567 DCHECK(layer_tree_impl()->IsPendingTree());
568 DCHECK(!layer_tree_impl()->needs_update_draw_properties());
560 DCHECK(ideal_contents_scale_); 569 DCHECK(ideal_contents_scale_);
561 570
562 if (!tilings_->num_tilings()) 571 if (!tilings_->num_tilings())
563 return true; 572 return true;
564 573
565 gfx::Rect rect(visible_content_rect()); 574 gfx::Rect rect(visible_content_rect());
566 575
567 float min_acceptable_scale = 576 float min_acceptable_scale =
568 std::min(raster_contents_scale_, ideal_contents_scale_); 577 std::min(raster_contents_scale_, ideal_contents_scale_);
569 578
(...skipping 11 matching lines...) Expand all
581 // called for active twin. 590 // called for active twin.
582 if (twin_min_acceptable_scale != 0.0f) { 591 if (twin_min_acceptable_scale != 0.0f) {
583 min_acceptable_scale = 592 min_acceptable_scale =
584 std::min(min_acceptable_scale, twin_min_acceptable_scale); 593 std::min(min_acceptable_scale, twin_min_acceptable_scale);
585 } 594 }
586 } 595 }
587 596
588 Region missing_region = rect; 597 Region missing_region = rect;
589 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { 598 for (size_t i = 0; i < tilings_->num_tilings(); ++i) {
590 PictureLayerTiling* tiling = tilings_->tiling_at(i); 599 PictureLayerTiling* tiling = tilings_->tiling_at(i);
600 DCHECK(tiling->has_ever_been_updated());
591 601
592 if (tiling->contents_scale() < min_acceptable_scale) 602 if (tiling->contents_scale() < min_acceptable_scale)
593 continue; 603 continue;
594 604
595 for (PictureLayerTiling::CoverageIterator iter(tiling, 605 for (PictureLayerTiling::CoverageIterator iter(tiling,
596 contents_scale_x(), 606 contents_scale_x(),
597 rect); 607 rect);
598 iter; 608 iter;
599 ++iter) { 609 ++iter) {
600 if (should_force_uploads && *iter) 610 if (should_force_uploads && *iter)
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
911 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const { 921 scoped_ptr<base::Value> PictureLayerImpl::AsValue() const {
912 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); 922 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue());
913 LayerImpl::AsValueInto(state.get()); 923 LayerImpl::AsValueInto(state.get());
914 924
915 state->SetDouble("ideal_contents_scale", ideal_contents_scale_); 925 state->SetDouble("ideal_contents_scale", ideal_contents_scale_);
916 state->Set("tilings", tilings_->AsValue().release()); 926 state->Set("tilings", tilings_->AsValue().release());
917 return state.PassAs<base::Value>(); 927 return state.PassAs<base::Value>();
918 } 928 }
919 929
920 } // namespace cc 930 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/picture_layer_impl.h ('k') | cc/resources/picture_layer_tiling.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698