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

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

Issue 1890863003: Change the bookmark ripple/hover to be 24px in height. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_animation.h" 5 #include "ui/views/animation/flood_fill_ink_drop_animation.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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 : size_(size), 113 : size_(size),
114 center_point_(center_point), 114 center_point_(center_point),
115 root_layer_(ui::LAYER_NOT_DRAWN), 115 root_layer_(ui::LAYER_NOT_DRAWN),
116 circle_layer_delegate_(color, 116 circle_layer_delegate_(color,
117 std::max(size_.width(), size_.height()) / 2.f), 117 std::max(size_.width(), size_.height()) / 2.f),
118 ink_drop_state_(InkDropState::HIDDEN) { 118 ink_drop_state_(InkDropState::HIDDEN) {
119 root_layer_.set_name("FloodFillInkDropAnimation:ROOT_LAYER"); 119 root_layer_.set_name("FloodFillInkDropAnimation:ROOT_LAYER");
120 root_layer_.SetMasksToBounds(true); 120 root_layer_.SetMasksToBounds(true);
121 root_layer_.SetBounds(gfx::Rect(size_)); 121 root_layer_.SetBounds(gfx::Rect(size_));
122 122
123 const gfx::Vector2dF translate_vector =
124 center_point_ - root_layer_.bounds().CenterPoint();
125 gfx::Transform transfrom;
126 transfrom.Translate(translate_vector.x(), translate_vector.y());
127 root_layer_.SetTransform(transfrom);
128
123 const int painted_size_length = 2 * std::max(size_.width(), size_.height()); 129 const int painted_size_length = 2 * std::max(size_.width(), size_.height());
124 130
125 painted_layer_.SetBounds(gfx::Rect(painted_size_length, painted_size_length)); 131 painted_layer_.SetBounds(gfx::Rect(painted_size_length, painted_size_length));
126 painted_layer_.SetFillsBoundsOpaquely(false); 132 painted_layer_.SetFillsBoundsOpaquely(false);
127 painted_layer_.set_delegate(&circle_layer_delegate_); 133 painted_layer_.set_delegate(&circle_layer_delegate_);
128 painted_layer_.SetVisible(true); 134 painted_layer_.SetVisible(true);
129 painted_layer_.SetOpacity(1.0); 135 painted_layer_.SetOpacity(1.0);
130 painted_layer_.SetMasksToBounds(false); 136 painted_layer_.SetMasksToBounds(false);
131 painted_layer_.set_name("FloodFillInkDropAnimation:PAINTED_LAYER"); 137 painted_layer_.set_name("FloodFillInkDropAnimation:PAINTED_LAYER");
132 138
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 animator->StartAnimation(animation_sequence); 306 animator->StartAnimation(animation_sequence);
301 } 307 }
302 308
303 gfx::Transform FloodFillInkDropAnimation::CalculateTransform( 309 gfx::Transform FloodFillInkDropAnimation::CalculateTransform(
304 float target_radius) const { 310 float target_radius) const {
305 const float target_scale = target_radius / circle_layer_delegate_.radius(); 311 const float target_scale = target_radius / circle_layer_delegate_.radius();
306 const gfx::Point drawn_center_point = 312 const gfx::Point drawn_center_point =
307 ToRoundedPoint(circle_layer_delegate_.GetCenterPoint()); 313 ToRoundedPoint(circle_layer_delegate_.GetCenterPoint());
308 314
309 gfx::Transform transform = gfx::Transform(); 315 gfx::Transform transform = gfx::Transform();
310 transform.Translate(center_point_.x(), center_point_.y()); 316 transform.Translate(root_layer_.bounds().CenterPoint().x(),
317 root_layer_.bounds().CenterPoint().y());
311 transform.Scale(target_scale, target_scale); 318 transform.Scale(target_scale, target_scale);
312 transform.Translate(-drawn_center_point.x(), -drawn_center_point.y()); 319 transform.Translate(-drawn_center_point.x(), -drawn_center_point.y());
313 320
314 return transform; 321 return transform;
315 } 322 }
316 323
317 gfx::Transform FloodFillInkDropAnimation::GetMaxSizeTargetTransform() const { 324 gfx::Transform FloodFillInkDropAnimation::GetMaxSizeTargetTransform() const {
318 // TODO(estade): get rid of this 2, but make the fade out start before the 325 // TODO(estade): get rid of this 2, but make the fade out start before the
319 // active/action transform is done. 326 // active/action transform is done.
320 return CalculateTransform( 327 return CalculateTransform(
321 gfx::Vector2dF(size_.width(), size_.height()).Length() / 2); 328 gfx::Vector2dF(size_.width(), size_.height()).Length() / 2);
322 } 329 }
323 330
324 } // namespace views 331 } // namespace views
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/bookmarks/bookmark_bar_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698