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

Side by Side Diff: cc/trees/occlusion_tracker.cc

Issue 547723002: Reland of: cc: Add occlusion checker as a fixed view of occlusion tracker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 unified diff | Download patch
« cc/trees/occlusion_checker.h ('K') | « cc/trees/occlusion_tracker.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 OcclusionChecker<LayerType> OcclusionTracker<
32 LayerType>::GenerateOcclusionChecker(const LayerType* render_target,
danakj 2014/09/05 19:31:29 not used, get rid of the render_target parameter.
vmpstr 2014/09/05 21:00:06 Done.
33 const gfx::Transform& draw_transform) {
34 if (stack_.empty() || !render_target)
35 return OcclusionChecker<LayerType>();
36
37 const StackObject& back = stack_.back();
38 if (back.occlusion_from_inside_target.IsEmpty() &&
39 back.occlusion_from_outside_target.IsEmpty()) {
40 return OcclusionChecker<LayerType>();
41 }
42 return OcclusionChecker<LayerType>(draw_transform,
43 back.occlusion_from_outside_target,
44 back.occlusion_from_inside_target);
45 }
46
47 template <typename LayerType>
31 void OcclusionTracker<LayerType>::EnterLayer( 48 void OcclusionTracker<LayerType>::EnterLayer(
32 const LayerIteratorPosition<LayerType>& layer_iterator) { 49 const LayerIteratorPosition<LayerType>& layer_iterator) {
33 LayerType* render_target = layer_iterator.target_render_surface_layer; 50 LayerType* render_target = layer_iterator.target_render_surface_layer;
34 51
35 if (layer_iterator.represents_itself) 52 if (layer_iterator.represents_itself)
36 EnterRenderTarget(render_target); 53 EnterRenderTarget(render_target);
37 else if (layer_iterator.represents_target_render_surface) 54 else if (layer_iterator.represents_target_render_surface)
38 FinishedRenderTarget(render_target); 55 FinishedRenderTarget(render_target);
39 } 56 }
40 57
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
620 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) 637 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i)
621 visible_region.Subtract(occluded.GetRect(i)); 638 visible_region.Subtract(occluded.GetRect(i));
622 return visible_region; 639 return visible_region;
623 } 640 }
624 641
625 // Instantiate (and export) templates here for the linker. 642 // Instantiate (and export) templates here for the linker.
626 template class OcclusionTracker<Layer>; 643 template class OcclusionTracker<Layer>;
627 template class OcclusionTracker<LayerImpl>; 644 template class OcclusionTracker<LayerImpl>;
628 645
629 } // namespace cc 646 } // namespace cc
OLDNEW
« cc/trees/occlusion_checker.h ('K') | « cc/trees/occlusion_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698