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

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

Issue 2042073002: Centered flood fill style ink drop ripples on mouse/touch points. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed LocatedEvent::AsLocatedIfLocatedEvent() as FromIfValid(). Created 4 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/flood_fill_ink_drop_ripple.h" 5 #include "ui/views/animation/flood_fill_ink_drop_ripple.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "third_party/skia/include/core/SkColor.h" 10 #include "third_party/skia/include/core/SkColor.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 gfx::Transform transform = gfx::Transform(); 309 gfx::Transform transform = gfx::Transform();
310 transform.Translate(center_point_.x() - root_layer_.bounds().x(), 310 transform.Translate(center_point_.x() - root_layer_.bounds().x(),
311 center_point_.y() - root_layer_.bounds().y()); 311 center_point_.y() - root_layer_.bounds().y());
312 transform.Scale(target_scale, target_scale); 312 transform.Scale(target_scale, target_scale);
313 transform.Translate(-drawn_center_point.x(), -drawn_center_point.y()); 313 transform.Translate(-drawn_center_point.x(), -drawn_center_point.y());
314 314
315 return transform; 315 return transform;
316 } 316 }
317 317
318 gfx::Transform FloodFillInkDropRipple::GetMaxSizeTargetTransform() const { 318 gfx::Transform FloodFillInkDropRipple::GetMaxSizeTargetTransform() const {
319 // TODO(estade): get rid of this 2, but make the fade out start before the 319 return CalculateTransform(MaxDistanceToCorners(center_point_));
320 // active/action transform is done. 320 }
321 return CalculateTransform(gfx::Vector2dF(root_layer_.bounds().width(), 321
322 root_layer_.bounds().height()) 322 float FloodFillInkDropRipple::MaxDistanceToCorners(
323 .Length() / 323 const gfx::Point& point) const {
324 2); 324 const gfx::Rect bounds = root_layer_.bounds();
325 const float distance_to_top_left = (bounds.origin() - point).Length();
326 const float distance_to_top_right = (bounds.top_right() - point).Length();
327 const float distance_to_bottom_left = (bounds.bottom_left() - point).Length();
328 const float distance_to_bottom_right =
329 (bounds.bottom_right() - point).Length();
330
331 float largest_distance =
332 std::max(distance_to_top_left, distance_to_top_right);
333 largest_distance = std::max(largest_distance, distance_to_bottom_left);
334 largest_distance = std::max(largest_distance, distance_to_bottom_right);
335 return largest_distance;
325 } 336 }
326 337
327 } // namespace views 338 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/animation/flood_fill_ink_drop_ripple.h ('k') | ui/views/animation/flood_fill_ink_drop_ripple_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698