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

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

Issue 551463005: Revert 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
« no previous file with comments | « cc/trees/occlusion.h ('k') | cc/trees/occlusion_tracker.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "cc/trees/occlusion.h"
6
7 #include "cc/base/math_util.h"
8 #include "ui/gfx/rect.h"
9
10 namespace cc {
11
12 Occlusion::Occlusion() {
13 }
14
15 Occlusion::Occlusion(const gfx::Transform& draw_transform,
16 const SimpleEnclosedRegion& occlusion_from_outside_target,
17 const SimpleEnclosedRegion& occlusion_from_inside_target)
18 : draw_transform_(draw_transform),
19 occlusion_from_outside_target_(occlusion_from_outside_target),
20 occlusion_from_inside_target_(occlusion_from_inside_target) {
21 }
22
23 bool Occlusion::IsOccluded(const gfx::Rect& content_rect) const {
24 if (content_rect.IsEmpty())
25 return true;
26
27 if (occlusion_from_inside_target_.IsEmpty() &&
28 occlusion_from_outside_target_.IsEmpty()) {
29 return false;
30 }
31
32 // Take the ToEnclosingRect at each step, as we want to contain any unoccluded
33 // partial pixels in the resulting Rect.
34 gfx::Rect unoccluded_rect_in_target_surface =
35 MathUtil::MapEnclosingClippedRect(draw_transform_, content_rect);
36 DCHECK_LE(occlusion_from_inside_target_.GetRegionComplexity(), 1u);
37 DCHECK_LE(occlusion_from_outside_target_.GetRegionComplexity(), 1u);
38 // These subtract operations are more lossy than if we did both operations at
39 // once.
40 unoccluded_rect_in_target_surface.Subtract(
41 occlusion_from_inside_target_.bounds());
42 unoccluded_rect_in_target_surface.Subtract(
43 occlusion_from_outside_target_.bounds());
44
45 return unoccluded_rect_in_target_surface.IsEmpty();
46 }
47
48 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/occlusion.h ('k') | cc/trees/occlusion_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698