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

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

Issue 1231453002: Compute if a layer is clipped outside CalcDrawProps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: DrawProperties is_clipped removed Created 5 years, 5 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
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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 return; 361 return;
362 362
363 DCHECK(layer->visible_layer_rect().Contains(opaque_layer_region.bounds())); 363 DCHECK(layer->visible_layer_rect().Contains(opaque_layer_region.bounds()));
364 364
365 // TODO(danakj): Find a rect interior to each transformed quad. 365 // TODO(danakj): Find a rect interior to each transformed quad.
366 if (!layer->draw_transform().Preserves2dAxisAlignment()) 366 if (!layer->draw_transform().Preserves2dAxisAlignment())
367 return; 367 return;
368 368
369 gfx::Rect clip_rect_in_target = ScreenSpaceClipRectInTargetSurface( 369 gfx::Rect clip_rect_in_target = ScreenSpaceClipRectInTargetSurface(
370 layer->render_target()->render_surface(), screen_space_clip_rect_); 370 layer->render_target()->render_surface(), screen_space_clip_rect_);
371 if (layer->is_clipped()) { 371 if (layer->is_clipped_from_property_tree()) {
372 clip_rect_in_target.Intersect(layer->clip_rect()); 372 clip_rect_in_target.Intersect(layer->clip_rect());
373 } else { 373 } else {
374 clip_rect_in_target.Intersect( 374 clip_rect_in_target.Intersect(
375 layer->render_target()->render_surface()->content_rect()); 375 layer->render_target()->render_surface()->content_rect());
376 } 376 }
377 377
378 for (size_t i = 0; i < opaque_layer_region.GetRegionComplexity(); ++i) { 378 for (size_t i = 0; i < opaque_layer_region.GetRegionComplexity(); ++i) {
379 gfx::Rect transformed_rect = 379 gfx::Rect transformed_rect =
380 MathUtil::MapEnclosedRectWith2dAxisAlignedTransform( 380 MathUtil::MapEnclosedRectWith2dAxisAlignedTransform(
381 layer->draw_transform(), opaque_layer_region.GetRect(i)); 381 layer->draw_transform(), opaque_layer_region.GetRect(i));
382 transformed_rect.Intersect(clip_rect_in_target); 382 transformed_rect.Intersect(clip_rect_in_target);
383 if (transformed_rect.width() < minimum_tracking_size_.width() && 383 if (transformed_rect.width() < minimum_tracking_size_.width() &&
384 transformed_rect.height() < minimum_tracking_size_.height()) 384 transformed_rect.height() < minimum_tracking_size_.height())
385 continue; 385 continue;
386 stack_.back().occlusion_from_inside_target.Union(transformed_rect); 386 stack_.back().occlusion_from_inside_target.Union(transformed_rect);
387 } 387 }
388 } 388 }
389 389
390 Region OcclusionTracker::ComputeVisibleRegionInScreen() const { 390 Region OcclusionTracker::ComputeVisibleRegionInScreen() const {
391 DCHECK(!stack_.back().target->parent()); 391 DCHECK(!stack_.back().target->parent());
392 const SimpleEnclosedRegion& occluded = 392 const SimpleEnclosedRegion& occluded =
393 stack_.back().occlusion_from_inside_target; 393 stack_.back().occlusion_from_inside_target;
394 Region visible_region(screen_space_clip_rect_); 394 Region visible_region(screen_space_clip_rect_);
395 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) 395 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i)
396 visible_region.Subtract(occluded.GetRect(i)); 396 visible_region.Subtract(occluded.GetRect(i));
397 return visible_region; 397 return visible_region;
398 } 398 }
399 399
400 } // namespace cc 400 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698