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

Unified Diff: ui/views/animation/ink_drop_highlight.cc

Issue 2786543002: Make updates to InkDropHighlight to pave the way for improved ink drops (Closed)
Patch Set: improved docs Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/views/animation/ink_drop_highlight.cc
diff --git a/ui/views/animation/ink_drop_highlight.cc b/ui/views/animation/ink_drop_highlight.cc
index 33f2adf0e8ee7c76fb60396b759082641a72778e..8cb343adf4a0d4aaf3d8b6ff2c1134ab4fe1c197 100644
--- a/ui/views/animation/ink_drop_highlight.cc
+++ b/ui/views/animation/ink_drop_highlight.cc
@@ -43,10 +43,10 @@ InkDropHighlight::InkDropHighlight(
layer_delegate_(std::move(layer_delegate)),
layer_(new ui::Layer()),
observer_(nullptr) {
- const gfx::Rect layer_bounds = layer_delegate_->GetPaintedBounds();
- size_ = explode_size_ = layer_bounds.size();
+ const gfx::RectF painted_bounds = layer_delegate_->GetPaintedBounds();
+ size_ = explode_size_ = painted_bounds.size();
- layer_->SetBounds(layer_bounds);
+ layer_->SetBounds(gfx::ToEnclosingRect(painted_bounds));
layer_->SetFillsBoundsOpaquely(false);
layer_->set_delegate(layer_delegate_.get());
layer_->SetVisible(false);
@@ -54,7 +54,7 @@ InkDropHighlight::InkDropHighlight(
layer_->set_name("InkDropHighlight:layer");
}
-InkDropHighlight::InkDropHighlight(const gfx::Size& size,
+InkDropHighlight::InkDropHighlight(const gfx::SizeF& size,
int corner_radius,
const gfx::PointF& center_point,
SkColor color)
@@ -66,6 +66,12 @@ InkDropHighlight::InkDropHighlight(const gfx::Size& size,
layer_->SetOpacity(visible_opacity_);
}
+InkDropHighlight::InkDropHighlight(const gfx::Size& size,
+ int corner_radius,
+ const gfx::PointF& center_point,
+ SkColor color)
+ : InkDropHighlight(gfx::SizeF(size), corner_radius, center_point, color) {}
+
InkDropHighlight::~InkDropHighlight() {
// Explicitly aborting all the animations ensures all callbacks are invoked
// while this instance still exists.
@@ -92,8 +98,8 @@ test::InkDropHighlightTestApi* InkDropHighlight::GetTestApi() {
void InkDropHighlight::AnimateFade(AnimationType animation_type,
const base::TimeDelta& duration,
- const gfx::Size& initial_size,
- const gfx::Size& target_size) {
+ const gfx::SizeF& initial_size,
+ const gfx::SizeF& target_size) {
last_animation_initiated_was_fade_in_ = animation_type == FADE_IN;
layer_->SetTransform(CalculateTransform(initial_size));
@@ -138,7 +144,7 @@ void InkDropHighlight::AnimateFade(AnimationType animation_type,
}
gfx::Transform InkDropHighlight::CalculateTransform(
- const gfx::Size& size) const {
+ const gfx::SizeF& size) const {
gfx::Transform transform;
transform.Translate(center_point_.x(), center_point_.y());
// TODO(bruthig): Fix the InkDropHighlight to work well when initialized with

Powered by Google App Engine
This is Rietveld 408576698