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

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

Issue 11110004: Make gfx::Rect class operations consistently mutate the class they are called on. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: cc/ fixes Created 8 years, 2 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 | « 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 = new_bounds.Union(view->bounds()); 238 gfx::Rect total_bounds = view->bounds();
239 total_bounds.Union(new_bounds);
239 240
240 // Build up the region to repaint in repaint_bounds_. We'll do the repaint 241 // Build up the region to repaint in repaint_bounds_. We'll do the repaint
241 // when all animations complete (in AnimationContainerProgressed). 242 // when all animations complete (in AnimationContainerProgressed).
242 if (repaint_bounds_.IsEmpty()) 243 repaint_bounds_.Union(total_bounds);
243 repaint_bounds_ = total_bounds;
244 else
245 repaint_bounds_ = repaint_bounds_.Union(total_bounds);
246 244
247 view->SetBoundsRect(new_bounds); 245 view->SetBoundsRect(new_bounds);
248 } 246 }
249 247
250 if (data.delegate) 248 if (data.delegate)
251 data.delegate->AnimationProgressed(animation); 249 data.delegate->AnimationProgressed(animation);
252 } 250 }
253 251
254 void BoundsAnimator::AnimationEnded(const Animation* animation) { 252 void BoundsAnimator::AnimationEnded(const Animation* animation) {
255 AnimationEndedOrCanceled(animation, ANIMATION_ENDED); 253 AnimationEndedOrCanceled(animation, ANIMATION_ENDED);
(...skipping 23 matching lines...) Expand all
279 FOR_EACH_OBSERVER(BoundsAnimatorObserver, 277 FOR_EACH_OBSERVER(BoundsAnimatorObserver,
280 observers_, 278 observers_,
281 OnBoundsAnimatorDone(this)); 279 OnBoundsAnimatorDone(this));
282 } 280 }
283 } 281 }
284 282
285 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) { 283 void BoundsAnimator::AnimationContainerEmpty(AnimationContainer* container) {
286 } 284 }
287 285
288 } // namespace views 286 } // 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