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

Side by Side Diff: ui/views/animation/bounds_animator.cc

Issue 11270042: Add non-member non-mutating methods for common gfx::Rect operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/screen_mac.mm ('k') | ui/views/animation/bounds_animator_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "ui/views/animation/bounds_animator.h" 5 #include "ui/views/animation/bounds_animator.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "ui/base/animation/animation_container.h" 8 #include "ui/base/animation/animation_container.h"
9 #include "ui/base/animation/slide_animation.h" 9 #include "ui/base/animation/slide_animation.h"
10 #include "ui/views/animation/bounds_animator_observer.h" 10 #include "ui/views/animation/bounds_animator_observer.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 228
229 void BoundsAnimator::AnimationProgressed(const Animation* animation) { 229 void BoundsAnimator::AnimationProgressed(const Animation* animation) {
230 DCHECK(animation_to_view_.find(animation) != animation_to_view_.end()); 230 DCHECK(animation_to_view_.find(animation) != animation_to_view_.end());
231 231
232 View* view = animation_to_view_[animation]; 232 View* view = animation_to_view_[animation];
233 DCHECK(view); 233 DCHECK(view);
234 const Data& data = data_[view]; 234 const Data& data = data_[view];
235 gfx::Rect new_bounds = 235 gfx::Rect new_bounds =
236 animation->CurrentValueBetween(data.start_bounds, data.target_bounds); 236 animation->CurrentValueBetween(data.start_bounds, data.target_bounds);
237 if (new_bounds != view->bounds()) { 237 if (new_bounds != view->bounds()) {
238 gfx::Rect total_bounds = view->bounds(); 238 gfx::Rect total_bounds = gfx::UnionRects(new_bounds, view->bounds());
239 total_bounds.Union(new_bounds);
240 239
241 // Build up the region to repaint in repaint_bounds_. We'll do the repaint 240 // Build up the region to repaint in repaint_bounds_. We'll do the repaint
242 // when all animations complete (in AnimationContainerProgressed). 241 // when all animations complete (in AnimationContainerProgressed).
243 repaint_bounds_.Union(total_bounds); 242 repaint_bounds_.Union(total_bounds);
244 243
245 view->SetBoundsRect(new_bounds); 244 view->SetBoundsRect(new_bounds);
246 } 245 }
247 246
248 if (data.delegate) 247 if (data.delegate)
249 data.delegate->AnimationProgressed(animation); 248 data.delegate->AnimationProgressed(animation);
(...skipping 27 matching lines...) Expand all
277 FOR_EACH_OBSERVER(BoundsAnimatorObserver, 276 FOR_EACH_OBSERVER(BoundsAnimatorObserver,
278 observers_, 277 observers_,
279 OnBoundsAnimatorDone(this)); 278 OnBoundsAnimatorDone(this));
280 } 279 }
281 } 280 }
282 281
283 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) { 282 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) {
284 } 283 }
285 284
286 } // namespace views 285 } // namespace views
OLDNEW
« no previous file with comments | « ui/gfx/screen_mac.mm ('k') | ui/views/animation/bounds_animator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698