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 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
558 } | 558 } |
559 | 559 |
560 // We could do this after doing UpdateTiles, which would avoid doing this for | 560 // We could do this after doing UpdateTiles, which would avoid doing this for |
561 // tilings that are going to disappear on the pending tree (if scale changed). | 561 // tilings that are going to disappear on the pending tree (if scale changed). |
562 // But that would also be more complicated, so we just do it here for now. | 562 // But that would also be more complicated, so we just do it here for now. |
563 tilings_->UpdateTilingsToCurrentRasterSource( | 563 tilings_->UpdateTilingsToCurrentRasterSource( |
564 raster_source_, pending_set, invalidation_, MinimumContentsScale(), | 564 raster_source_, pending_set, invalidation_, MinimumContentsScale(), |
565 MaximumContentsScale()); | 565 MaximumContentsScale()); |
566 } | 566 } |
567 | 567 |
568 void PictureLayerImpl::UpdateCanUseLCDText() { | |
569 // Don't allow the LCD text state to change once disabled. | |
570 if (!RasterSourceUsesLCDText()) | |
571 return; | |
572 if (can_use_lcd_text() == RasterSourceUsesLCDText()) | |
573 return; | |
574 | |
575 // Raster sources are considered const, so in order to update the state | |
576 // a new one must be created and all tiles recreated. | |
577 scoped_refptr<RasterSource> new_raster_source = | |
578 raster_source_->CreateCloneWithoutLCDText(); | |
579 // Synthetically invalidate everything. | |
580 gfx::Rect bounds_rect(bounds()); | |
581 Region invalidation(bounds_rect); | |
582 UpdateRasterSource(new_raster_source, &invalidation, nullptr); | |
danakj
2015/02/18 01:24:10
what if there is a pending tree, would this happen
enne (OOO)
2015/02/18 02:20:02
This should only ever be called on the sync tree r
danakj
2015/02/18 02:28:13
DCHECK is sync tree sounds good.
| |
583 SetUpdateRect(bounds_rect); | |
584 | |
585 DCHECK(!RasterSourceUsesLCDText()); | |
586 } | |
587 | |
588 bool PictureLayerImpl::RasterSourceUsesLCDText() const { | |
589 return raster_source_ ? raster_source_->CanUseLCDText() | |
590 : layer_tree_impl()->settings().can_use_lcd_text; | |
591 } | |
592 | |
568 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { | 593 void PictureLayerImpl::NotifyTileStateChanged(const Tile* tile) { |
569 if (layer_tree_impl()->IsActiveTree()) { | 594 if (layer_tree_impl()->IsActiveTree()) { |
570 gfx::RectF layer_damage_rect = | 595 gfx::RectF layer_damage_rect = |
571 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); | 596 gfx::ScaleRect(tile->content_rect(), 1.f / tile->contents_scale()); |
572 AddDamageRect(layer_damage_rect); | 597 AddDamageRect(layer_damage_rect); |
573 } | 598 } |
574 } | 599 } |
575 | 600 |
576 void PictureLayerImpl::DidBeginTracing() { | 601 void PictureLayerImpl::DidBeginTracing() { |
577 raster_source_->DidBeginTracing(); | 602 raster_source_->DidBeginTracing(); |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1211 | 1236 |
1212 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1237 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
1213 return !layer_tree_impl()->IsRecycleTree(); | 1238 return !layer_tree_impl()->IsRecycleTree(); |
1214 } | 1239 } |
1215 | 1240 |
1216 bool PictureLayerImpl::HasValidTilePriorities() const { | 1241 bool PictureLayerImpl::HasValidTilePriorities() const { |
1217 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | 1242 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); |
1218 } | 1243 } |
1219 | 1244 |
1220 } // namespace cc | 1245 } // namespace cc |
OLD | NEW |