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/trees/occlusion_tracker.h" | 5 #include "cc/trees/occlusion_tracker.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
10 #include "cc/debug/overdraw_metrics.h" | 10 #include "cc/debug/overdraw_metrics.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 | 226 |
227 RenderSurfaceType* surface = finished_target->render_surface(); | 227 RenderSurfaceType* surface = finished_target->render_surface(); |
228 | 228 |
229 // Readbacks always happen on render targets so we only need to check | 229 // Readbacks always happen on render targets so we only need to check |
230 // for readbacks here. | 230 // for readbacks here. |
231 bool target_is_only_for_copy_request = | 231 bool target_is_only_for_copy_request = |
232 finished_target->HasCopyRequest() && LayerIsHidden(finished_target); | 232 finished_target->HasCopyRequest() && LayerIsHidden(finished_target); |
233 | 233 |
234 // If the occlusion within the surface can not be applied to things outside of | 234 // If the occlusion within the surface can not be applied to things outside of |
235 // the surface's subtree, then clear the occlusion here so it won't be used. | 235 // the surface's subtree, then clear the occlusion here so it won't be used. |
236 // TODO(senorblanco): Make this smarter for SkImageFilter case: once | |
237 // SkImageFilters can report affectsOpacity(), call that. | |
238 if (finished_target->mask_layer() || | 236 if (finished_target->mask_layer() || |
239 !SurfaceOpacityKnown(surface) || | 237 !SurfaceOpacityKnown(surface) || |
240 surface->draw_opacity() < 1 || | 238 surface->draw_opacity() < 1 || |
241 target_is_only_for_copy_request || | 239 target_is_only_for_copy_request || |
242 finished_target->filters().HasFilterThatAffectsOpacity() || | 240 finished_target->filters().HasFilterThatAffectsOpacity()) { |
243 finished_target->filter()) { | |
244 stack_.back().occlusion_from_outside_target.Clear(); | 241 stack_.back().occlusion_from_outside_target.Clear(); |
245 stack_.back().occlusion_from_inside_target.Clear(); | 242 stack_.back().occlusion_from_inside_target.Clear(); |
246 } else if (!SurfaceTransformsToTargetKnown(surface)) { | 243 } else if (!SurfaceTransformsToTargetKnown(surface)) { |
247 stack_.back().occlusion_from_inside_target.Clear(); | 244 stack_.back().occlusion_from_inside_target.Clear(); |
248 stack_.back().occlusion_from_outside_target.Clear(); | 245 stack_.back().occlusion_from_outside_target.Clear(); |
249 } | 246 } |
250 } | 247 } |
251 | 248 |
252 template <typename LayerType> | 249 template <typename LayerType> |
253 static void ReduceOcclusionBelowSurface(LayerType* contributing_layer, | 250 static void ReduceOcclusionBelowSurface(LayerType* contributing_layer, |
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 } | 734 } |
738 | 735 |
739 return unoccluded_rect; | 736 return unoccluded_rect; |
740 } | 737 } |
741 | 738 |
742 // Instantiate (and export) templates here for the linker. | 739 // Instantiate (and export) templates here for the linker. |
743 template class OcclusionTrackerBase<Layer, RenderSurface>; | 740 template class OcclusionTrackerBase<Layer, RenderSurface>; |
744 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 741 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; |
745 | 742 |
746 } // namespace cc | 743 } // namespace cc |
OLD | NEW |