Chromium Code Reviews| Index: cc/layers/picture_layer_impl.cc |
| diff --git a/cc/layers/picture_layer_impl.cc b/cc/layers/picture_layer_impl.cc |
| index 606d3d901a658eb4090ded867d9aeec3fa480bb4..b271098cdd28e3a5063609505468fcaacb80bc42 100644 |
| --- a/cc/layers/picture_layer_impl.cc |
| +++ b/cc/layers/picture_layer_impl.cc |
| @@ -90,7 +90,6 @@ void PictureLayerImpl::PushPropertiesTo(LayerImpl* base_layer) { |
| layer_impl->is_using_lcd_text_ = is_using_lcd_text_; |
| } |
| - |
| void PictureLayerImpl::AppendQuads(QuadSink* quad_sink, |
| AppendQuadsData* append_quads_data) { |
| const gfx::Rect& rect = visible_content_rect(); |
| @@ -372,6 +371,24 @@ void PictureLayerImpl::UpdatePile(Tile* tile) { |
| tile->set_picture_pile(pile_); |
| } |
| +const Region* PictureLayerImpl::GetInvalidation() { |
| + return &invalidation_; |
| +} |
| + |
| +const PictureLayerTiling* PictureLayerImpl::GetTwinTiling( |
| + const PictureLayerTiling* tiling) { |
| + |
| + const PictureLayerImpl* other_layer = layer_tree_impl()->IsActiveTree() ? |
| + PendingTwin() : ActiveTwin(); |
| + if (!other_layer) |
| + return NULL; |
| + for (size_t i = 0; i < other_layer->tilings_->num_tilings(); ++i) |
| + if (other_layer->tilings_->tiling_at(i)->contents_scale() == |
| + tiling->contents_scale()) |
| + return other_layer->tilings_->tiling_at(i); |
| + return NULL; |
| +} |
| + |
| gfx::Size PictureLayerImpl::CalculateTileSize( |
| gfx::Size current_tile_size, |
| gfx::Size content_bounds) { |
| @@ -464,31 +481,20 @@ void PictureLayerImpl::SyncFromActiveLayer(const PictureLayerImpl* other) { |
| } |
| } |
| - tilings_->CloneAll(*other->tilings_, invalidation_, MinimumContentsScale()); |
| - DCHECK(bounds() == tilings_->LayerBounds()); |
| + // Union in the other newly exposed regions as invalid. |
| + Region difference_region = Region(gfx::Rect(bounds())); |
| + difference_region.Subtract(gfx::Rect(other->bounds())); |
| + invalidation_.Union(difference_region); |
| - // It's a sad but unfortunate fact that PicturePile tiling edges do not line |
| - // up with PictureLayerTiling edges. Tiles can only be added if they are |
| - // entirely covered by recordings (that may come from multiple PicturePile |
| - // tiles). This check happens in this class's CreateTile() call. |
| - for (int x = 0; x < pile_->num_tiles_x(); ++x) { |
| - for (int y = 0; y < pile_->num_tiles_y(); ++y) { |
| - bool previously_had = other->pile_->HasRecordingAt(x, y); |
| - bool now_has = pile_->HasRecordingAt(x, y); |
| - if (!now_has || previously_had) |
| - continue; |
| - gfx::Rect layer_rect = pile_->tile_bounds(x, y); |
| - tilings_->CreateTilesFromLayerRect(layer_rect); |
| - } |
| - } |
| + tilings_->CloneAll(*other->tilings_, MinimumContentsScale()); |
| + DCHECK(bounds() == tilings_->LayerBounds()); |
| } |
| void PictureLayerImpl::SyncTiling( |
| - const PictureLayerTiling* tiling, |
| - const Region& pending_layer_invalidation) { |
| + const PictureLayerTiling* tiling) { |
| if (!DrawsContent() || tiling->contents_scale() < MinimumContentsScale()) |
| return; |
| - tilings_->Clone(tiling, pending_layer_invalidation); |
| + tilings_->Clone(tiling); |
| } |
| void PictureLayerImpl::SetIsMask(bool is_mask) { |
| @@ -571,18 +577,15 @@ PictureLayerTiling* PictureLayerImpl::AddTiling(float contents_scale) { |
| const Region& recorded = pile_->recorded_region(); |
| DCHECK(!recorded.IsEmpty()); |
| - for (Region::Iterator iter(recorded); iter.has_rect(); iter.next()) |
| - tiling->CreateTilesFromLayerRect(iter.rect()); |
| - |
| PictureLayerImpl* twin = |
| layer_tree_impl()->IsPendingTree() ? ActiveTwin() : PendingTwin(); |
| if (!twin) |
| return tiling; |
| if (layer_tree_impl()->IsPendingTree()) |
|
enne (OOO)
2013/03/29 20:50:58
This if statement can be simplified.
whunt
2013/03/29 21:52:04
Clearly. I'll go do that.
|
| - twin->SyncTiling(tiling, invalidation_); |
| + twin->SyncTiling(tiling); |
| else |
| - twin->SyncTiling(tiling, twin->invalidation_); |
| + twin->SyncTiling(tiling); |
| return tiling; |
| } |
| @@ -848,10 +851,6 @@ void PictureLayerImpl::UpdateLCDTextStatus() { |
| pending_layer->is_using_lcd_text_ = is_using_lcd_text_; |
| pending_layer->pile_ = PicturePileImpl::CreateFromOther(pending_layer->pile_, |
| is_using_lcd_text_); |
| - |
| - // TODO(enne): if we tracked text regions, we could just invalidate those |
| - // directly rather than tossing away every tile. |
| - pending_layer->tilings_->Invalidate(gfx::Rect(bounds())); |
|
enne (OOO)
2013/03/29 20:50:58
This is incorrect to remove wholesale. Invalidate
whunt
2013/03/29 21:52:04
Good call, I'll investigate the best way to keep t
whunt
2013/03/29 22:17:55
On second thought, I'm not actually sure, we shoul
|
| } |
| void PictureLayerImpl::GetDebugBorderProperties( |