OLD | NEW |
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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/damage_tracker.h" | 5 #include "cc/damage_tracker.h" |
6 | 6 |
7 #include "cc/layer_impl.h" | 7 #include "cc/layer_impl.h" |
8 #include "cc/layer_tree_host_common.h" | 8 #include "cc/layer_tree_host_common.h" |
9 #include "cc/math_util.h" | 9 #include "cc/math_util.h" |
10 #include "cc/render_surface_impl.h" | 10 #include "cc/render_surface_impl.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 { | 41 { |
42 gfx::RectF expandedDamageRect = damageRect; | 42 gfx::RectF expandedDamageRect = damageRect; |
43 expandRectWithFilters(expandedDamageRect, filters); | 43 expandRectWithFilters(expandedDamageRect, filters); |
44 gfx::RectF filterRect = preFilterRect; | 44 gfx::RectF filterRect = preFilterRect; |
45 expandRectWithFilters(filterRect, filters); | 45 expandRectWithFilters(filterRect, filters); |
46 | 46 |
47 expandedDamageRect.Intersect(filterRect); | 47 expandedDamageRect.Intersect(filterRect); |
48 damageRect.Union(expandedDamageRect); | 48 damageRect.Union(expandedDamageRect); |
49 } | 49 } |
50 | 50 |
51 void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
erList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDesce
ndant, const gfx::Rect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLa
yer, const WebKit::WebFilterOperations& filters, SkImageFilter* filter) | 51 void DamageTracker::updateDamageTrackingState(const std::vector<LayerImpl*>& lay
erList, int targetSurfaceLayerID, bool targetSurfacePropertyChangedOnlyFromDesce
ndant, const gfx::Rect& targetSurfaceContentRect, LayerImpl* targetSurfaceMaskLa
yer, const WebKit::WebFilterOperations& filters, const SkRefPtr<SkImageFilter>&
filter) |
52 { | 52 { |
53 // | 53 // |
54 // This function computes the "damage rect" of a target surface, and updates
the state | 54 // This function computes the "damage rect" of a target surface, and updates
the state |
55 // that is used to correctly track damage across frames. The damage rect is
the region | 55 // that is used to correctly track damage across frames. The damage rect is
the region |
56 // of the surface that may have changed and needs to be redrawn. This can be
used to | 56 // of the surface that may have changed and needs to be redrawn. This can be
used to |
57 // scissor what is actually drawn, to save GPU computation and bandwidth. | 57 // scissor what is actually drawn, to save GPU computation and bandwidth. |
58 // | 58 // |
59 // The surface's damage rect is computed as the union of all possible change
s that | 59 // The surface's damage rect is computed as the union of all possible change
s that |
60 // have happened to the surface since the last frame was drawn. This include
s: | 60 // have happened to the surface since the last frame was drawn. This include
s: |
61 // - any changes for existing layers/surfaces that contribute to the targe
t surface | 61 // - any changes for existing layers/surfaces that contribute to the targe
t surface |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 | 334 |
335 // If the layer has a background filter, this may cause pixels in our surfac
e to be expanded, so we will need to expand any damage | 335 // If the layer has a background filter, this may cause pixels in our surfac
e to be expanded, so we will need to expand any damage |
336 // at or below this layer. We expand the damage from this layer too, as we n
eed to readback those pixels from the surface with only | 336 // at or below this layer. We expand the damage from this layer too, as we n
eed to readback those pixels from the surface with only |
337 // the contents of layers below this one in them. This means we need to redr
aw any pixels in the surface being used for the blur in | 337 // the contents of layers below this one in them. This means we need to redr
aw any pixels in the surface being used for the blur in |
338 // this layer this frame. | 338 // this layer this frame. |
339 if (layer->backgroundFilters().hasFilterThatMovesPixels()) | 339 if (layer->backgroundFilters().hasFilterThatMovesPixels()) |
340 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar
getSpace, layer->backgroundFilters()); | 340 expandDamageRectInsideRectWithFilters(targetDamageRect, surfaceRectInTar
getSpace, layer->backgroundFilters()); |
341 } | 341 } |
342 | 342 |
343 } // namespace cc | 343 } // namespace cc |
OLD | NEW |