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

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

Issue 1175113010: cc: Rename visible_content_rect and content stuff on quads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename-visible-content-rect: moreandroid Created 5 years, 6 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/layer_tree_impl_unittest.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | 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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 351
352 if (layer->draw_opacity() < 1) 352 if (layer->draw_opacity() < 1)
353 return; 353 return;
354 354
355 if (!layer->uses_default_blend_mode()) 355 if (!layer->uses_default_blend_mode())
356 return; 356 return;
357 357
358 if (layer->Is3dSorted()) 358 if (layer->Is3dSorted())
359 return; 359 return;
360 360
361 SimpleEnclosedRegion opaque_contents = layer->VisibleContentOpaqueRegion(); 361 SimpleEnclosedRegion opaque_layer_region = layer->VisibleOpaqueRegion();
362 if (opaque_contents.IsEmpty()) 362 if (opaque_layer_region.IsEmpty())
363 return; 363 return;
364 364
365 DCHECK(layer->visible_content_rect().Contains(opaque_contents.bounds())); 365 DCHECK(layer->visible_layer_rect().Contains(opaque_layer_region.bounds()));
366 366
367 // TODO(danakj): Find a rect interior to each transformed quad. 367 // TODO(danakj): Find a rect interior to each transformed quad.
368 if (!layer->draw_transform().Preserves2dAxisAlignment()) 368 if (!layer->draw_transform().Preserves2dAxisAlignment())
369 return; 369 return;
370 370
371 gfx::Rect clip_rect_in_target = ScreenSpaceClipRectInTargetSurface( 371 gfx::Rect clip_rect_in_target = ScreenSpaceClipRectInTargetSurface(
372 layer->render_target()->render_surface(), screen_space_clip_rect_); 372 layer->render_target()->render_surface(), screen_space_clip_rect_);
373 if (layer->is_clipped()) { 373 if (layer->is_clipped()) {
374 clip_rect_in_target.Intersect(layer->clip_rect()); 374 clip_rect_in_target.Intersect(layer->clip_rect());
375 } else { 375 } else {
376 clip_rect_in_target.Intersect( 376 clip_rect_in_target.Intersect(
377 layer->render_target()->render_surface()->content_rect()); 377 layer->render_target()->render_surface()->content_rect());
378 } 378 }
379 379
380 for (size_t i = 0; i < opaque_contents.GetRegionComplexity(); ++i) { 380 for (size_t i = 0; i < opaque_layer_region.GetRegionComplexity(); ++i) {
381 gfx::Rect transformed_rect = 381 gfx::Rect transformed_rect =
382 MathUtil::MapEnclosedRectWith2dAxisAlignedTransform( 382 MathUtil::MapEnclosedRectWith2dAxisAlignedTransform(
383 layer->draw_transform(), opaque_contents.GetRect(i)); 383 layer->draw_transform(), opaque_layer_region.GetRect(i));
384 transformed_rect.Intersect(clip_rect_in_target); 384 transformed_rect.Intersect(clip_rect_in_target);
385 if (transformed_rect.width() < minimum_tracking_size_.width() && 385 if (transformed_rect.width() < minimum_tracking_size_.width() &&
386 transformed_rect.height() < minimum_tracking_size_.height()) 386 transformed_rect.height() < minimum_tracking_size_.height())
387 continue; 387 continue;
388 stack_.back().occlusion_from_inside_target.Union(transformed_rect); 388 stack_.back().occlusion_from_inside_target.Union(transformed_rect);
389 } 389 }
390 } 390 }
391 391
392 Region OcclusionTracker::ComputeVisibleRegionInScreen() const { 392 Region OcclusionTracker::ComputeVisibleRegionInScreen() const {
393 DCHECK(!stack_.back().target->parent()); 393 DCHECK(!stack_.back().target->parent());
394 const SimpleEnclosedRegion& occluded = 394 const SimpleEnclosedRegion& occluded =
395 stack_.back().occlusion_from_inside_target; 395 stack_.back().occlusion_from_inside_target;
396 Region visible_region(screen_space_clip_rect_); 396 Region visible_region(screen_space_clip_rect_);
397 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i) 397 for (size_t i = 0; i < occluded.GetRegionComplexity(); ++i)
398 visible_region.Subtract(occluded.GetRect(i)); 398 visible_region.Subtract(occluded.GetRect(i));
399 return visible_region; 399 return visible_region;
400 } 400 }
401 401
402 } // namespace cc 402 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_impl_unittest.cc ('k') | cc/trees/occlusion_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698