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

Unified Diff: cc/trees/damage_tracker.cc

Issue 2873593002: Force use of and cache render surface. (Closed)
Patch Set: Fix for comments in patch 4. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/trees/damage_tracker.h ('k') | cc/trees/draw_property_utils.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/damage_tracker.cc
diff --git a/cc/trees/damage_tracker.cc b/cc/trees/damage_tracker.cc
index 5dff7581824556b505863ed27ef94bdcee526699..aa738a389863b600ae7714dce41105a949c9d265 100644
--- a/cc/trees/damage_tracker.cc
+++ b/cc/trees/damage_tracker.cc
@@ -25,8 +25,7 @@ std::unique_ptr<DamageTracker> DamageTracker::Create() {
return base::WrapUnique(new DamageTracker());
}
-DamageTracker::DamageTracker()
- : mailboxId_(0) {}
+DamageTracker::DamageTracker() : mailboxId_(0) {}
DamageTracker::~DamageTracker() {}
@@ -364,7 +363,6 @@ void DamageTracker::AccumulateDamageFromLayer(LayerImpl* layer) {
// its target RenderSurface, even if that layer owns the target RenderSurface
// itself. To consider how a layer's target surface contributes to the
// ancestor surface, ExtendDamageForRenderSurface() must be called instead.
-
bool layer_is_new = false;
LayerRectMapData& data = RectDataForLayer(layer->id(), &layer_is_new);
gfx::Rect old_rect_in_target_space = data.rect_;
@@ -380,19 +378,21 @@ void DamageTracker::AccumulateDamageFromLayer(LayerImpl* layer) {
// The layer's old region is now exposed on the target surface, too.
// Note old_rect_in_target_space is already in target space.
damage_for_this_update_.Union(old_rect_in_target_space);
- return;
+ } else {
+ // If the layer properties haven't changed, then the the target surface is
+ // only affected by the layer's damaged area, which could be empty.
+ gfx::Rect damage_rect =
+ gfx::UnionRects(layer->update_rect(), layer->damage_rect());
+ damage_rect.Intersect(gfx::Rect(layer->bounds()));
+ if (!damage_rect.IsEmpty()) {
+ gfx::Rect damage_rect_in_target_space = MathUtil::MapEnclosingClippedRect(
+ layer->DrawTransform(), damage_rect);
+ damage_for_this_update_.Union(damage_rect_in_target_space);
+ }
}
- // If the layer properties haven't changed, then the the target surface is
- // only affected by the layer's damaged area, which could be empty.
- gfx::Rect damage_rect =
- gfx::UnionRects(layer->update_rect(), layer->damage_rect());
- damage_rect.Intersect(gfx::Rect(layer->bounds()));
- if (!damage_rect.IsEmpty()) {
- gfx::Rect damage_rect_in_target_space =
- MathUtil::MapEnclosingClippedRect(layer->DrawTransform(), damage_rect);
- damage_for_this_update_.Union(damage_rect_in_target_space);
- }
+ if (layer_is_new || !layer->LayerPropertyChanged())
wutao 2017/06/09 19:19:10 This might need special check: If the layer is the
+ has_damage_from_contributing_content_ |= !damage_for_this_update_.IsEmpty();
}
void DamageTracker::AccumulateDamageFromRenderSurface(
@@ -456,6 +456,9 @@ void DamageTracker::AccumulateDamageFromRenderSurface(
ExpandDamageInsideRectWithFilters(surface_rect_in_target_space,
background_filters);
}
+
+ if (surface_is_new || !render_surface->SurfacePropertyChanged())
+ has_damage_from_contributing_content_ |= !damage_for_this_update_.IsEmpty();
}
bool DamageTracker::DamageAccumulator::GetAsRect(gfx::Rect* rect) {
« no previous file with comments | « cc/trees/damage_tracker.h ('k') | cc/trees/draw_property_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698