| 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/base/region.h" | 10 #include "cc/base/region.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 OcclusionTracker<LayerType>::OcclusionTracker( | 21 OcclusionTracker<LayerType>::OcclusionTracker( |
| 22 const gfx::Rect& screen_space_clip_rect) | 22 const gfx::Rect& screen_space_clip_rect) |
| 23 : screen_space_clip_rect_(screen_space_clip_rect), | 23 : screen_space_clip_rect_(screen_space_clip_rect), |
| 24 occluding_screen_space_rects_(NULL), | 24 occluding_screen_space_rects_(NULL), |
| 25 non_occluding_screen_space_rects_(NULL) {} | 25 non_occluding_screen_space_rects_(NULL) {} |
| 26 | 26 |
| 27 template <typename LayerType> | 27 template <typename LayerType> |
| 28 OcclusionTracker<LayerType>::~OcclusionTracker() {} | 28 OcclusionTracker<LayerType>::~OcclusionTracker() {} |
| 29 | 29 |
| 30 template <typename LayerType> | 30 template <typename LayerType> |
| 31 Occlusion OcclusionTracker<LayerType>::GetCurrentOcclusionForLayer( | |
| 32 const gfx::Transform& draw_transform) const { | |
| 33 DCHECK(!stack_.empty()); | |
| 34 const StackObject& back = stack_.back(); | |
| 35 return Occlusion(draw_transform, | |
| 36 back.occlusion_from_outside_target, | |
| 37 back.occlusion_from_inside_target); | |
| 38 } | |
| 39 | |
| 40 template <typename LayerType> | |
| 41 void OcclusionTracker<LayerType>::EnterLayer( | 31 void OcclusionTracker<LayerType>::EnterLayer( |
| 42 const LayerIteratorPosition<LayerType>& layer_iterator) { | 32 const LayerIteratorPosition<LayerType>& layer_iterator) { |
| 43 LayerType* render_target = layer_iterator.target_render_surface_layer; | 33 LayerType* render_target = layer_iterator.target_render_surface_layer; |
| 44 | 34 |
| 45 if (layer_iterator.represents_itself) | 35 if (layer_iterator.represents_itself) |
| 46 EnterRenderTarget(render_target); | 36 EnterRenderTarget(render_target); |
| 47 else if (layer_iterator.represents_target_render_surface) | 37 else if (layer_iterator.represents_target_render_surface) |
| 48 FinishedRenderTarget(render_target); | 38 FinishedRenderTarget(render_target); |
| 49 } | 39 } |
| 50 | 40 |
| (...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) | 620 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) |
| 631 visible_region.Subtract(occluded.GetRect(i)); | 621 visible_region.Subtract(occluded.GetRect(i)); |
| 632 return visible_region; | 622 return visible_region; |
| 633 } | 623 } |
| 634 | 624 |
| 635 // Instantiate (and export) templates here for the linker. | 625 // Instantiate (and export) templates here for the linker. |
| 636 template class OcclusionTracker<Layer>; | 626 template class OcclusionTracker<Layer>; |
| 637 template class OcclusionTracker<LayerImpl>; | 627 template class OcclusionTracker<LayerImpl>; |
| 638 | 628 |
| 639 } // namespace cc | 629 } // namespace cc |
| OLD | NEW |