OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/ink_drop_animation.h" | 5 #include "ui/views/animation/ink_drop_animation.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 void InkDropAnimation::SetTransforms(const InkDropTransforms transforms) { | 363 void InkDropAnimation::SetTransforms(const InkDropTransforms transforms) { |
364 for (int i = 0; i < PAINTED_SHAPE_COUNT; ++i) | 364 for (int i = 0; i < PAINTED_SHAPE_COUNT; ++i) |
365 painted_layers_[i]->SetTransform(transforms[i]); | 365 painted_layers_[i]->SetTransform(transforms[i]); |
366 } | 366 } |
367 | 367 |
368 void InkDropAnimation::SetOpacity(float opacity) { | 368 void InkDropAnimation::SetOpacity(float opacity) { |
369 root_layer_->SetOpacity(opacity); | 369 root_layer_->SetOpacity(opacity); |
370 } | 370 } |
371 | 371 |
372 void InkDropAnimation::CalculateCircleTransforms( | 372 void InkDropAnimation::CalculateCircleTransforms( |
373 const gfx::SizeF& size, | 373 const gfx::Size& size, |
374 InkDropTransforms* transforms_out) const { | 374 InkDropTransforms* transforms_out) const { |
375 CalculateRectTransforms(size, std::min(size.width(), size.height()) / 2.0f, | 375 CalculateRectTransforms(size, std::min(size.width(), size.height()) / 2.0f, |
376 transforms_out); | 376 transforms_out); |
377 } | 377 } |
378 | 378 |
379 void InkDropAnimation::CalculateRectTransforms( | 379 void InkDropAnimation::CalculateRectTransforms( |
380 const gfx::SizeF& size, | 380 const gfx::Size& size, |
381 float corner_radius, | 381 float corner_radius, |
382 InkDropTransforms* transforms_out) const { | 382 InkDropTransforms* transforms_out) const { |
383 DCHECK_GE(size.width() / 2.0f, corner_radius) | 383 DCHECK_GE(size.width() / 2.0f, corner_radius) |
384 << "The circle's diameter should not be greater than the total width."; | 384 << "The circle's diameter should not be greater than the total width."; |
385 DCHECK_GE(size.height() / 2.0f, corner_radius) | 385 DCHECK_GE(size.height() / 2.0f, corner_radius) |
386 << "The circle's diameter should not be greater than the total height."; | 386 << "The circle's diameter should not be greater than the total height."; |
387 | 387 |
388 // The shapes are drawn such that their center points are not at the origin. | 388 // The shapes are drawn such that their center points are not at the origin. |
389 // Thus we use the CalculateCircleTransform() and CalculateRectTransform() | 389 // Thus we use the CalculateCircleTransform() and CalculateRectTransform() |
390 // methods to calculate the complex Transforms. | 390 // methods to calculate the complex Transforms. |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 layer->SetFillsBoundsOpaquely(false); | 467 layer->SetFillsBoundsOpaquely(false); |
468 layer->set_delegate(delegate); | 468 layer->set_delegate(delegate); |
469 layer->SetVisible(true); | 469 layer->SetVisible(true); |
470 layer->SetOpacity(1.0); | 470 layer->SetOpacity(1.0); |
471 layer->SetMasksToBounds(false); | 471 layer->SetMasksToBounds(false); |
472 | 472 |
473 painted_layers_[painted_shape].reset(layer); | 473 painted_layers_[painted_shape].reset(layer); |
474 } | 474 } |
475 | 475 |
476 } // namespace views | 476 } // namespace views |
OLD | NEW |