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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 | 236 // TODO(senorblanco): Make this smarter for SkImageFilter case: once |
237 // SkImageFilters can report affectsOpacity(), call that. | 237 // SkImageFilters can report affectsOpacity(), call that. |
238 if (finished_target->mask_layer() || | 238 if (finished_target->mask_layer() || |
239 !SurfaceOpacityKnown(surface) || | 239 !SurfaceOpacityKnown(surface) || |
240 surface->draw_opacity() < 1 || | 240 surface->draw_opacity() < 1 || |
| 241 surface->has_blend_mode() || |
241 target_is_only_for_copy_request || | 242 target_is_only_for_copy_request || |
242 finished_target->filters().HasFilterThatAffectsOpacity() || | 243 finished_target->filters().HasFilterThatAffectsOpacity() || |
243 finished_target->filter()) { | 244 finished_target->filter()) { |
244 stack_.back().occlusion_from_outside_target.Clear(); | 245 stack_.back().occlusion_from_outside_target.Clear(); |
245 stack_.back().occlusion_from_inside_target.Clear(); | 246 stack_.back().occlusion_from_inside_target.Clear(); |
246 } else if (!SurfaceTransformsToTargetKnown(surface)) { | 247 } else if (!SurfaceTransformsToTargetKnown(surface)) { |
247 stack_.back().occlusion_from_inside_target.Clear(); | 248 stack_.back().occlusion_from_inside_target.Clear(); |
248 stack_.back().occlusion_from_outside_target.Clear(); | 249 stack_.back().occlusion_from_outside_target.Clear(); |
249 } | 250 } |
250 } | 251 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 void OcclusionTrackerBase<LayerType, RenderSurfaceType>:: | 414 void OcclusionTrackerBase<LayerType, RenderSurfaceType>:: |
414 MarkOccludedBehindLayer(const LayerType* layer) { | 415 MarkOccludedBehindLayer(const LayerType* layer) { |
415 DCHECK(!stack_.empty()); | 416 DCHECK(!stack_.empty()); |
416 DCHECK_EQ(layer->render_target(), stack_.back().target); | 417 DCHECK_EQ(layer->render_target(), stack_.back().target); |
417 if (stack_.empty()) | 418 if (stack_.empty()) |
418 return; | 419 return; |
419 | 420 |
420 if (!LayerOpacityKnown(layer) || layer->draw_opacity() < 1) | 421 if (!LayerOpacityKnown(layer) || layer->draw_opacity() < 1) |
421 return; | 422 return; |
422 | 423 |
| 424 if (layer->has_blend_mode()) |
| 425 return; |
| 426 |
423 if (LayerIsInUnsorted3dRenderingContext(layer)) | 427 if (LayerIsInUnsorted3dRenderingContext(layer)) |
424 return; | 428 return; |
425 | 429 |
426 if (!LayerTransformsToTargetKnown(layer)) | 430 if (!LayerTransformsToTargetKnown(layer)) |
427 return; | 431 return; |
428 | 432 |
429 Region opaque_contents = layer->VisibleContentOpaqueRegion(); | 433 Region opaque_contents = layer->VisibleContentOpaqueRegion(); |
430 if (opaque_contents.IsEmpty()) | 434 if (opaque_contents.IsEmpty()) |
431 return; | 435 return; |
432 | 436 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
737 } | 741 } |
738 | 742 |
739 return unoccluded_rect; | 743 return unoccluded_rect; |
740 } | 744 } |
741 | 745 |
742 // Instantiate (and export) templates here for the linker. | 746 // Instantiate (and export) templates here for the linker. |
743 template class OcclusionTrackerBase<Layer, RenderSurface>; | 747 template class OcclusionTrackerBase<Layer, RenderSurface>; |
744 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; | 748 template class OcclusionTrackerBase<LayerImpl, RenderSurfaceImpl>; |
745 | 749 |
746 } // namespace cc | 750 } // namespace cc |
OLD | NEW |