Commit 34fba514 authored by Evan Stade's avatar Evan Stade Committed by Commit Bot

Remove obsolete VectorIcon animation code.

This was added at a time when there was interest in exploring more
animated transitions between icon states, but never had a client that
wasn't gated on a feature flag, and currently is dead code.

Bug: 718549
Change-Id: Idaf4667930e68feac92daafcab7c5778355546ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1986109
Commit-Queue: Evan Stade <estade@chromium.org>
Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#728111}
parent 94640cad
...@@ -23,7 +23,6 @@ aggregate_vector_icons("chrome_vector_icons") { ...@@ -23,7 +23,6 @@ aggregate_vector_icons("chrome_vector_icons") {
"blocked_redirect.icon", "blocked_redirect.icon",
"bluetooth.icon", "bluetooth.icon",
"browser_tools.icon", "browser_tools.icon",
"browser_tools_animated.icon",
"browser_tools_error.icon", "browser_tools_error.icon",
"browser_tools_update.icon", "browser_tools_update.icon",
"caret_down.icon", "caret_down.icon",
......
// Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 32,
// Top dot.
TRANSITION_FROM,
TRANSITION_FROM,
MOVE_TO, 16, 9,
CUBIC_TO, 17.66f, 9, 19, 7.66f, 19, 6,
CUBIC_TO, 19, 4.34f, 17.66f, 3, 16, 3,
R_H_LINE_TO, 0,
CUBIC_TO, 14.34f, 3, 13, 4.34f, 13, 6,
CUBIC_TO, 13, 7.66f, 14.34f, 9, 16, 9,
TRANSITION_TO,
MOVE_TO, 21.65f, 8,
CUBIC_TO, 22.76f, 8, 23.65f, 6.66f, 23.65f, 6,
CUBIC_TO, 23.65f, 5.34f, 22.76f, 4, 21.65f, 4,
R_H_LINE_TO, -11.29f,
CUBIC_TO, 9.24f, 4, 8.35f, 5.34f, 8.35f, 6,
CUBIC_TO, 8.35f, 6.66f, 9.24f, 8, 10.35f, 8,
TRANSITION_END, 133, 150, gfx::Tween::FAST_OUT_SLOW_IN,
TRANSITION_TO,
MOVE_TO, 16, 9,
CUBIC_TO, 17.66f, 9, 19, 7.66f, 19, 6,
CUBIC_TO, 19, 4.34f, 17.66f, 3, 16, 3,
R_H_LINE_TO, 0,
CUBIC_TO, 14.34f, 3, 13, 4.34f, 13, 6,
CUBIC_TO, 13, 7.66f, 14.34f, 9, 16, 9,
TRANSITION_END, 416, 533, gfx::Tween::FAST_OUT_SLOW_IN,
CLOSE,
NEW_PATH,
// Middle dot.
TRANSITION_FROM,
TRANSITION_FROM,
MOVE_TO, 16, 19,
CUBIC_TO, 17.66f, 19, 19, 17.66f, 19, 16,
CUBIC_TO, 19, 14.34f, 17.66f, 13, 16, 13,
R_H_LINE_TO, 0,
CUBIC_TO, 14.34f, 13, 13, 14.34f, 13, 16,
CUBIC_TO, 13, 17.66f, 14.34f, 19, 16, 19,
TRANSITION_TO,
MOVE_TO, 21.65f, 18,
CUBIC_TO, 22.76f, 18, 23.65f, 16.66f, 23.65f, 16,
CUBIC_TO, 23.65f, 15.34f, 22.76f, 14, 21.65f, 14,
R_H_LINE_TO, -11.29f,
CUBIC_TO, 9.24f, 14, 8.35f, 15.34f, 8.35f, 16,
CUBIC_TO, 8.35f, 16.66f, 9.24f, 18, 10.35f, 18,
TRANSITION_END, 67, 150, gfx::Tween::FAST_OUT_SLOW_IN,
TRANSITION_TO,
MOVE_TO, 16, 19,
CUBIC_TO, 17.66f, 19, 19, 17.66f, 19, 16,
CUBIC_TO, 19, 14.34f, 17.66f, 13, 16, 13,
R_H_LINE_TO, 0,
CUBIC_TO, 14.34f, 13, 13, 14.34f, 13, 16,
CUBIC_TO, 13, 17.66f, 14.34f, 19, 16, 19,
TRANSITION_END, 350, 383, gfx::Tween::FAST_OUT_SLOW_IN,
CLOSE,
NEW_PATH,
// Bottom dot.
TRANSITION_FROM,
TRANSITION_FROM,
MOVE_TO, 16, 29,
CUBIC_TO, 17.66f, 29, 19, 27.66f, 19, 26,
CUBIC_TO, 19, 24.34f, 17.66f, 23, 16, 23,
R_H_LINE_TO, 0,
CUBIC_TO, 14.34f, 23, 13, 24.34f, 13, 26,
CUBIC_TO, 13, 27.66f, 14.34f, 29, 16, 29,
TRANSITION_TO,
MOVE_TO, 21.65f, 28,
CUBIC_TO, 22.76f, 28, 23.65f, 26.66f, 23.65f, 26,
CUBIC_TO, 23.65f, 25.34f, 22.76f, 24, 21.65f, 24,
R_H_LINE_TO, -11.29f,
CUBIC_TO, 9.24f, 24, 8.35f, 25.34f, 8.35f, 26,
CUBIC_TO, 8.35f, 26.66f, 9.24f, 28, 10.35f, 28,
TRANSITION_END, 0, 150, gfx::Tween::FAST_OUT_SLOW_IN,
TRANSITION_TO,
MOVE_TO, 16, 29,
CUBIC_TO, 17.66f, 29, 19, 27.66f, 19, 26,
CUBIC_TO, 19, 24.34f, 17.66f, 23, 16, 23,
R_H_LINE_TO, 0,
CUBIC_TO, 14.34f, 23, 13, 24.34f, 13, 26,
CUBIC_TO, 13, 27.66f, 14.34f, 29, 16, 29,
TRANSITION_END, 283, 400, gfx::Tween::FAST_OUT_SLOW_IN,
CLOSE,
CANVAS_DIMENSIONS, 16,
// Top dot.
TRANSITION_FROM,
TRANSITION_FROM,
MOVE_TO, 7, 3.5f,
CUBIC_TO, 7, 2.67f, 7.67f, 2, 8.5f, 2,
R_H_LINE_TO, 0,
CUBIC_TO, 9.33f, 2, 10, 2.67f, 10, 3.5f,
CUBIC_TO, 10, 4.33f, 9.33f, 5, 8.5f, 5,
R_H_LINE_TO, 0,
CUBIC_TO, 7.67f, 5, 7, 4.33f, 7, 3.5f,
TRANSITION_TO,
MOVE_TO, 4.68f, 3.5f,
CUBIC_TO, 4.68f, 2.95f, 5.13f, 2.5f, 5.68f, 2.5f,
R_H_LINE_TO, 5.65f,
CUBIC_TO, 11.87f, 2.5f, 12.32f, 2.95f, 12.32f, 3.5f,
CUBIC_TO, 12.32f, 4.05f, 11.87f, 4.5f, 11.32f, 4.5f,
R_H_LINE_TO, -5.65f,
CUBIC_TO, 5.13f, 4.5f, 4.68f, 4.05f, 4.68f, 2.5f,
TRANSITION_END, 133, 150, gfx::Tween::FAST_OUT_SLOW_IN,
TRANSITION_TO,
MOVE_TO, 7, 3.5f,
CUBIC_TO, 7, 2.67f, 7.67f, 2, 8.5f, 2,
R_H_LINE_TO, 0,
CUBIC_TO, 9.33f, 2, 10, 2.67f, 10, 3.5f,
CUBIC_TO, 10, 4.33f, 9.33f, 5, 8.5f, 5,
R_H_LINE_TO, 0,
CUBIC_TO, 7.67f, 5, 7, 4.33f, 7, 3.5f,
TRANSITION_END, 416, 533, gfx::Tween::FAST_OUT_SLOW_IN,
CLOSE,
NEW_PATH,
// Middle dot.
TRANSITION_FROM,
TRANSITION_FROM,
MOVE_TO, 7, 8.5f,
CUBIC_TO, 7, 7.67f, 7.67f, 7, 8.5f, 7,
R_H_LINE_TO, 0,
CUBIC_TO, 9.33f, 7, 10, 7.67f, 10, 8.5f,
CUBIC_TO, 10, 9.33f, 9.33f, 10, 8.5f, 10,
R_H_LINE_TO, 0,
CUBIC_TO, 7.67f, 10, 7, 9.33f, 7, 8.5f,
TRANSITION_TO,
MOVE_TO, 4.68f, 8.5f,
CUBIC_TO, 4.68f, 7.95f, 5.13f, 7.5f, 5.68f, 7.5f,
R_H_LINE_TO, 5.65f,
CUBIC_TO, 11.87f, 7.5f, 12.32f, 7.95f, 12.32f, 8.5f,
CUBIC_TO, 12.32f, 9.05f, 11.87f, 9.5f, 11.32f, 9.5f,
R_H_LINE_TO, -5.65f,
CUBIC_TO, 5.13f, 9.5f, 4.68f, 9.05f, 4.68f, 7.5f,
TRANSITION_END, 67, 150, gfx::Tween::FAST_OUT_SLOW_IN,
TRANSITION_TO,
MOVE_TO, 7, 8.5f,
CUBIC_TO, 7, 7.67f, 7.67f, 7, 8.5f, 7,
R_H_LINE_TO, 0,
CUBIC_TO, 9.33f, 7, 10, 7.67f, 10, 8.5f,
CUBIC_TO, 10, 9.33f, 9.33f, 10, 8.5f, 10,
R_H_LINE_TO, 0,
CUBIC_TO, 7.67f, 10, 7, 9.33f, 7, 8.5f,
TRANSITION_END, 350, 383, gfx::Tween::FAST_OUT_SLOW_IN,
CLOSE,
NEW_PATH,
// Bottom dot.
TRANSITION_FROM,
TRANSITION_FROM,
MOVE_TO, 7, 13.5f,
CUBIC_TO, 7, 12.67f, 7.67f, 12, 8.5f, 12,
R_H_LINE_TO, 0,
CUBIC_TO, 9.33f, 12, 10, 12.67f, 10, 13.5f,
CUBIC_TO, 10, 14.33f, 9.33f, 15, 8.5f, 15,
R_H_LINE_TO, 0,
CUBIC_TO, 7.67f, 15, 7, 14.33f, 7, 13.5f,
TRANSITION_TO,
MOVE_TO, 4.68f, 13.5f,
CUBIC_TO, 4.68f, 12.95f, 5.13f, 12.5f, 5.68f, 12.5f,
R_H_LINE_TO, 5.65f,
CUBIC_TO, 11.87f, 12.5f, 12.32f, 12.95f, 12.32f, 13.5f,
CUBIC_TO, 12.32f, 14.05f, 11.87f, 14.5f, 11.32f, 14.5f,
R_H_LINE_TO, -5.65f,
CUBIC_TO, 5.13f, 14.5f, 4.68f, 14.05f, 4.68f, 12.5f,
TRANSITION_END, 0, 150, gfx::Tween::FAST_OUT_SLOW_IN,
TRANSITION_TO,
MOVE_TO, 7, 13.5f,
CUBIC_TO, 7, 12.67f, 7.67f, 12, 8.5f, 12,
R_H_LINE_TO, 0,
CUBIC_TO, 9.33f, 12, 10, 12.67f, 10, 13.5f,
CUBIC_TO, 10, 14.33f, 9.33f, 15, 8.5f, 15,
R_H_LINE_TO, 0,
CUBIC_TO, 7.67f, 15, 7, 14.33f, 7, 13.5f,
TRANSITION_END, 283, 400, gfx::Tween::FAST_OUT_SLOW_IN,
CLOSE
...@@ -90,9 +90,9 @@ bool RelaunchRecommendedBubbleView::ShouldShowCloseButton() const { ...@@ -90,9 +90,9 @@ bool RelaunchRecommendedBubbleView::ShouldShowCloseButton() const {
} }
gfx::ImageSkia RelaunchRecommendedBubbleView::GetWindowIcon() { gfx::ImageSkia RelaunchRecommendedBubbleView::GetWindowIcon() {
return gfx::CreateVectorIcon(gfx::IconDescription( return gfx::CreateVectorIcon(
vector_icons::kBusinessIcon, kTitleIconSize, gfx::kChromeIconGrey, gfx::IconDescription(vector_icons::kBusinessIcon, kTitleIconSize,
base::TimeDelta(), gfx::kNoneIcon)); gfx::kChromeIconGrey, gfx::kNoneIcon));
} }
bool RelaunchRecommendedBubbleView::ShouldShowWindowIcon() const { bool RelaunchRecommendedBubbleView::ShouldShowWindowIcon() const {
......
...@@ -87,9 +87,9 @@ bool RelaunchRequiredDialogView::ShouldShowCloseButton() const { ...@@ -87,9 +87,9 @@ bool RelaunchRequiredDialogView::ShouldShowCloseButton() const {
} }
gfx::ImageSkia RelaunchRequiredDialogView::GetWindowIcon() { gfx::ImageSkia RelaunchRequiredDialogView::GetWindowIcon() {
return gfx::CreateVectorIcon(gfx::IconDescription( return gfx::CreateVectorIcon(
vector_icons::kBusinessIcon, kTitleIconSize, gfx::kChromeIconGrey, gfx::IconDescription(vector_icons::kBusinessIcon, kTitleIconSize,
base::TimeDelta(), gfx::kNoneIcon)); gfx::kChromeIconGrey, gfx::kNoneIcon));
} }
bool RelaunchRequiredDialogView::ShouldShowWindowIcon() const { bool RelaunchRequiredDialogView::ShouldShowWindowIcon() const {
......
...@@ -149,9 +149,9 @@ void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged( ...@@ -149,9 +149,9 @@ void ProfileSigninConfirmationDialogViews::ViewHierarchyChanged(
// Create business icon. // Create business icon.
int business_icon_size = 20; int business_icon_size = 20;
auto business_icon = std::make_unique<views::ImageView>(); auto business_icon = std::make_unique<views::ImageView>();
business_icon->SetImage(gfx::CreateVectorIcon(gfx::IconDescription( business_icon->SetImage(gfx::CreateVectorIcon(
vector_icons::kBusinessIcon, business_icon_size, gfx::kChromeIconGrey, gfx::IconDescription(vector_icons::kBusinessIcon, business_icon_size,
base::TimeDelta(), gfx::kNoneIcon))); gfx::kChromeIconGrey, gfx::kNoneIcon)));
// Create the prompt label. // Create the prompt label.
size_t offset; size_t offset;
......
...@@ -207,7 +207,6 @@ void AuthenticatorRequestSheetView::UpdateIconImageFromModel() { ...@@ -207,7 +207,6 @@ void AuthenticatorRequestSheetView::UpdateIconImageFromModel() {
model()->GetStepIllustration(GetNativeTheme()->ShouldUseDarkColors() model()->GetStepIllustration(GetNativeTheme()->ShouldUseDarkColors()
? ImageColorScheme::kDark ? ImageColorScheme::kDark
: ImageColorScheme::kLight), : ImageColorScheme::kLight),
0 /* automatic dip_size */, SK_ColorBLACK, base::TimeDelta(), 0 /* automatic dip_size */, SK_ColorBLACK, gfx::kNoneIcon);
gfx::kNoneIcon);
step_illustration_->SetImage(gfx::CreateVectorIcon(icon_description)); step_illustration_->SetImage(gfx::CreateVectorIcon(icon_description));
} }
...@@ -75,8 +75,8 @@ struct CompareIconDescription { ...@@ -75,8 +75,8 @@ struct CompareIconDescription {
const VectorIcon* b_icon = &b.icon; const VectorIcon* b_icon = &b.icon;
const VectorIcon* a_badge = &a.badge_icon; const VectorIcon* a_badge = &a.badge_icon;
const VectorIcon* b_badge = &b.badge_icon; const VectorIcon* b_badge = &b.badge_icon;
return std::tie(a_icon, a.dip_size, a.color, a.elapsed_time, a_badge) < return std::tie(a_icon, a.dip_size, a.color, a_badge) <
std::tie(b_icon, b.dip_size, b.color, b.elapsed_time, b_badge); std::tie(b_icon, b.dip_size, b.color, b_badge);
} }
}; };
...@@ -119,7 +119,6 @@ class PathParser { ...@@ -119,7 +119,6 @@ class PathParser {
return 2; return 2;
case CIRCLE: case CIRCLE:
case TRANSITION_END:
return 3; return 3;
case PATH_COLOR_ARGB: case PATH_COLOR_ARGB:
...@@ -144,8 +143,6 @@ class PathParser { ...@@ -144,8 +143,6 @@ class PathParser {
case CLOSE: case CLOSE:
case DISABLE_AA: case DISABLE_AA:
case FLIPS_IN_RTL: case FLIPS_IN_RTL:
case TRANSITION_FROM:
case TRANSITION_TO:
return 0; return 0;
} }
...@@ -219,8 +216,7 @@ void PaintPath(Canvas* canvas, ...@@ -219,8 +216,7 @@ void PaintPath(Canvas* canvas,
const PathElement* path_elements, const PathElement* path_elements,
size_t path_size, size_t path_size,
int dip_size, int dip_size,
SkColor color, SkColor color) {
const base::TimeDelta& elapsed_time) {
int canvas_size = kReferenceSizeDip; int canvas_size = kReferenceSizeDip;
std::vector<SkPath> paths; std::vector<SkPath> paths;
std::vector<cc::PaintFlags> flags_array; std::vector<cc::PaintFlags> flags_array;
...@@ -405,68 +401,6 @@ void PaintPath(Canvas* canvas, ...@@ -405,68 +401,6 @@ void PaintPath(Canvas* canvas,
case FLIPS_IN_RTL: case FLIPS_IN_RTL:
flips_in_rtl = true; flips_in_rtl = true;
break; break;
// Transitions work by pushing new paths and a new set of flags onto the
// stack. When TRANSITION_END is seen, the paths and flags are
// interpolated based on |elapsed_time| and the tween type.
case TRANSITION_FROM: {
start_new_path();
break;
}
case TRANSITION_TO: {
start_new_path();
start_new_flags();
break;
}
case TRANSITION_END: {
DCHECK_GT(paths.size(), 2U);
// TODO(estade): check whether this operation (interpolation) is costly,
// and remove this TRACE log if not.
TRACE_EVENT0("ui", "PaintVectorIcon TRANSITION_END");
const base::TimeDelta delay =
base::TimeDelta::FromMillisecondsD(SkScalarToDouble(arg(0)));
const base::TimeDelta duration =
base::TimeDelta::FromMillisecondsD(SkScalarToDouble(arg(1)));
double state = 0;
if (elapsed_time >= delay + duration) {
state = 1;
} else if (elapsed_time > delay) {
DCHECK(!duration.is_zero());
state = (elapsed_time - delay).InMicroseconds() /
static_cast<double>(duration.InMicroseconds());
}
auto weight = Tween::CalculateValue(
static_cast<Tween::Type>(SkScalarTruncToInt(arg(2))), state);
SkPath path1, path2;
path1.swap(paths.back());
paths.pop_back();
path2.swap(paths.back());
paths.pop_back();
SkPath interpolated_path;
bool could_interpolate =
path1.interpolate(path2, weight, &interpolated_path);
DCHECK(could_interpolate);
paths.back().addPath(interpolated_path);
// Perform manual interpolation of flags properties. TODO(estade): fill
// more of these in as necessary.
DCHECK_GT(flags_array.size(), 1U);
cc::PaintFlags& end_flags = flags_array.back();
cc::PaintFlags& start_flags = flags_array[flags_array.size() - 2];
start_flags.setColor(Tween::ColorValueBetween(
weight, start_flags.getColor(), end_flags.getColor()));
flags_array.pop_back();
break;
}
} }
previous_command_type = command_type; previous_command_type = command_type;
...@@ -497,7 +431,7 @@ class VectorIconSource : public CanvasImageSource { ...@@ -497,7 +431,7 @@ class VectorIconSource : public CanvasImageSource {
VectorIconSource(const std::string& definition, int dip_size, SkColor color) VectorIconSource(const std::string& definition, int dip_size, SkColor color)
: CanvasImageSource(Size(dip_size, dip_size)), : CanvasImageSource(Size(dip_size, dip_size)),
data_(kNoneIcon, dip_size, color, base::TimeDelta(), kNoneIcon), data_(kNoneIcon, dip_size, color, kNoneIcon),
path_(PathFromSource(definition)) {} path_(PathFromSource(definition)) {}
~VectorIconSource() override {} ~VectorIconSource() override {}
...@@ -509,13 +443,11 @@ class VectorIconSource : public CanvasImageSource { ...@@ -509,13 +443,11 @@ class VectorIconSource : public CanvasImageSource {
void Draw(Canvas* canvas) override { void Draw(Canvas* canvas) override {
if (path_.empty()) { if (path_.empty()) {
PaintVectorIcon(canvas, data_.icon, size_.width(), data_.color, PaintVectorIcon(canvas, data_.icon, size_.width(), data_.color);
data_.elapsed_time);
if (!data_.badge_icon.is_empty()) if (!data_.badge_icon.is_empty())
PaintVectorIcon(canvas, data_.badge_icon, size_.width(), data_.color); PaintVectorIcon(canvas, data_.badge_icon, size_.width(), data_.color);
} else { } else {
PaintPath(canvas, path_.data(), path_.size(), size_.width(), data_.color, PaintPath(canvas, path_.data(), path_.size(), size_.width(), data_.color);
base::TimeDelta());
} }
} }
...@@ -561,12 +493,10 @@ IconDescription::IconDescription(const IconDescription& other) = default; ...@@ -561,12 +493,10 @@ IconDescription::IconDescription(const IconDescription& other) = default;
IconDescription::IconDescription(const VectorIcon& icon, IconDescription::IconDescription(const VectorIcon& icon,
int dip_size, int dip_size,
SkColor color, SkColor color,
const base::TimeDelta& elapsed_time,
const VectorIcon& badge_icon) const VectorIcon& badge_icon)
: icon(icon), : icon(icon),
dip_size(dip_size), dip_size(dip_size),
color(color), color(color),
elapsed_time(elapsed_time),
badge_icon(badge_icon) { badge_icon(badge_icon) {
if (dip_size == 0) if (dip_size == 0)
this->dip_size = GetDefaultSizeOfVectorIcon(icon); this->dip_size = GetDefaultSizeOfVectorIcon(icon);
...@@ -576,25 +506,20 @@ IconDescription::~IconDescription() {} ...@@ -576,25 +506,20 @@ IconDescription::~IconDescription() {}
const VectorIcon kNoneIcon = {}; const VectorIcon kNoneIcon = {};
void PaintVectorIcon(Canvas* canvas, void PaintVectorIcon(Canvas* canvas, const VectorIcon& icon, SkColor color) {
const VectorIcon& icon, PaintVectorIcon(canvas, icon, GetDefaultSizeOfVectorIcon(icon), color);
SkColor color,
const base::TimeDelta& elapsed_time) {
PaintVectorIcon(canvas, icon, GetDefaultSizeOfVectorIcon(icon), color,
elapsed_time);
} }
void PaintVectorIcon(Canvas* canvas, void PaintVectorIcon(Canvas* canvas,
const VectorIcon& icon, const VectorIcon& icon,
int dip_size, int dip_size,
SkColor color, SkColor color) {
const base::TimeDelta& elapsed_time) {
DCHECK(!icon.is_empty()); DCHECK(!icon.is_empty());
for (size_t i = 0; i < icon.reps_size; ++i) for (size_t i = 0; i < icon.reps_size; ++i)
DCHECK(icon.reps[i].path_size > 0); DCHECK(icon.reps[i].path_size > 0);
const int px_size = gfx::ToCeiledInt(canvas->image_scale() * dip_size); const int px_size = gfx::ToCeiledInt(canvas->image_scale() * dip_size);
const VectorIconRep* rep = GetRepForPxSize(icon, px_size); const VectorIconRep* rep = GetRepForPxSize(icon, px_size);
PaintPath(canvas, rep->path, rep->path_size, dip_size, color, elapsed_time); PaintPath(canvas, rep->path, rep->path_size, dip_size, color);
} }
ImageSkia CreateVectorIcon(const IconDescription& params) { ImageSkia CreateVectorIcon(const IconDescription& params) {
...@@ -611,16 +536,14 @@ ImageSkia CreateVectorIcon(const VectorIcon& icon, SkColor color) { ...@@ -611,16 +536,14 @@ ImageSkia CreateVectorIcon(const VectorIcon& icon, SkColor color) {
ImageSkia CreateVectorIcon(const VectorIcon& icon, ImageSkia CreateVectorIcon(const VectorIcon& icon,
int dip_size, int dip_size,
SkColor color) { SkColor color) {
return CreateVectorIcon( return CreateVectorIcon(IconDescription(icon, dip_size, color, kNoneIcon));
IconDescription(icon, dip_size, color, base::TimeDelta(), kNoneIcon));
} }
ImageSkia CreateVectorIconWithBadge(const VectorIcon& icon, ImageSkia CreateVectorIconWithBadge(const VectorIcon& icon,
int dip_size, int dip_size,
SkColor color, SkColor color,
const VectorIcon& badge_icon) { const VectorIcon& badge_icon) {
return CreateVectorIcon( return CreateVectorIcon(IconDescription(icon, dip_size, color, badge_icon));
IconDescription(icon, dip_size, color, base::TimeDelta(), badge_icon));
} }
ImageSkia CreateVectorIconFromSource(const std::string& source, ImageSkia CreateVectorIconFromSource(const std::string& source,
...@@ -642,19 +565,4 @@ int GetDefaultSizeOfVectorIcon(const VectorIcon& icon) { ...@@ -642,19 +565,4 @@ int GetDefaultSizeOfVectorIcon(const VectorIcon& icon) {
return GetCanvasDimensions(default_icon_path); return GetCanvasDimensions(default_icon_path);
} }
base::TimeDelta GetDurationOfAnimation(const VectorIcon& icon) {
base::TimeDelta last_motion;
for (PathParser parser(icon.reps[0].path, icon.reps[0].path_size);
parser.HasCommandsRemaining(); parser.Advance()) {
if (parser.CurrentCommand() != TRANSITION_END)
continue;
auto end_time = base::TimeDelta::FromMillisecondsD(parser.GetArgument(0)) +
base::TimeDelta::FromMillisecondsD(parser.GetArgument(1));
if (end_time > last_motion)
last_motion = end_time;
}
return last_motion;
}
} // namespace gfx } // namespace gfx
...@@ -5,7 +5,6 @@ ...@@ -5,7 +5,6 @@
#ifndef UI_GFX_PAINT_VECTOR_ICON_H_ #ifndef UI_GFX_PAINT_VECTOR_ICON_H_
#define UI_GFX_PAINT_VECTOR_ICON_H_ #define UI_GFX_PAINT_VECTOR_ICON_H_
#include "base/time/time.h"
#include "third_party/skia/include/core/SkColor.h" #include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/gfx_export.h" #include "ui/gfx/gfx_export.h"
#include "ui/gfx/image/image_skia.h" #include "ui/gfx/image/image_skia.h"
...@@ -23,7 +22,6 @@ struct GFX_EXPORT IconDescription { ...@@ -23,7 +22,6 @@ struct GFX_EXPORT IconDescription {
IconDescription(const VectorIcon& icon, IconDescription(const VectorIcon& icon,
int dip_size, int dip_size,
SkColor color, SkColor color,
const base::TimeDelta& elapsed_time,
const VectorIcon& badge_icon); const VectorIcon& badge_icon);
~IconDescription(); ~IconDescription();
...@@ -31,7 +29,6 @@ struct GFX_EXPORT IconDescription { ...@@ -31,7 +29,6 @@ struct GFX_EXPORT IconDescription {
const VectorIcon& icon; const VectorIcon& icon;
int dip_size; int dip_size;
SkColor color; SkColor color;
const base::TimeDelta elapsed_time;
const VectorIcon& badge_icon; const VectorIcon& badge_icon;
}; };
...@@ -39,22 +36,17 @@ GFX_EXPORT extern const VectorIcon kNoneIcon; ...@@ -39,22 +36,17 @@ GFX_EXPORT extern const VectorIcon kNoneIcon;
// Draws a vector icon identified by |id| onto |canvas| at (0, 0). |color| is // Draws a vector icon identified by |id| onto |canvas| at (0, 0). |color| is
// used as the fill. The size will come from the .icon file (the 1x version, if // used as the fill. The size will come from the .icon file (the 1x version, if
// multiple versions exist). |elapsed_time| is used to determine the state of // multiple versions exist).
// any transitions the icon may define. GFX_EXPORT void PaintVectorIcon(Canvas* canvas,
GFX_EXPORT void PaintVectorIcon( const VectorIcon& icon,
Canvas* canvas, SkColor color);
const VectorIcon& icon,
SkColor color, // As above, with a specified size. |dip_size| is the length of a single edge
const base::TimeDelta& elapsed_time = base::TimeDelta());
// As above, with a specificed size. |dip_size| is the length of a single edge
// of the square icon, in device independent pixels. // of the square icon, in device independent pixels.
GFX_EXPORT void PaintVectorIcon( GFX_EXPORT void PaintVectorIcon(Canvas* canvas,
Canvas* canvas, const VectorIcon& icon,
const VectorIcon& icon, int dip_size,
int dip_size, SkColor color);
SkColor color,
const base::TimeDelta& elapsed_time = base::TimeDelta());
// Creates an ImageSkia which will render the icon on demand. // Creates an ImageSkia which will render the icon on demand.
// TODO(estade): update clients to use this version and remove the other // TODO(estade): update clients to use this version and remove the other
...@@ -90,10 +82,6 @@ GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source, ...@@ -90,10 +82,6 @@ GFX_EXPORT ImageSkia CreateVectorIconFromSource(const std::string& source,
// smallest icon size |icon| contains. // smallest icon size |icon| contains.
GFX_EXPORT int GetDefaultSizeOfVectorIcon(const gfx::VectorIcon& icon); GFX_EXPORT int GetDefaultSizeOfVectorIcon(const gfx::VectorIcon& icon);
// Calculates and returns the elapsed time at which all animations/transitions
// will be finished.
GFX_EXPORT base::TimeDelta GetDurationOfAnimation(const VectorIcon& icon);
} // namespace gfx } // namespace gfx
#endif // UI_GFX_PAINT_VECTOR_ICON_H_ #endif // UI_GFX_PAINT_VECTOR_ICON_H_
...@@ -58,13 +58,7 @@ namespace gfx { ...@@ -58,13 +58,7 @@ namespace gfx {
DECLARE_VECTOR_COMMAND(DISABLE_AA) \ DECLARE_VECTOR_COMMAND(DISABLE_AA) \
/* Flips the x-axis in RTL locales. Default is false, this command sets */ \ /* Flips the x-axis in RTL locales. Default is false, this command sets */ \
/* it to true. */ \ /* it to true. */ \
DECLARE_VECTOR_COMMAND(FLIPS_IN_RTL) \ DECLARE_VECTOR_COMMAND(FLIPS_IN_RTL)
/* Defines a timed transition for other elements. */ \
DECLARE_VECTOR_COMMAND(TRANSITION_FROM) \
DECLARE_VECTOR_COMMAND(TRANSITION_TO) \
/* Parameters are delay (ms), duration (ms), and tween type */ \
/* (gfx::Tween::Type). */ \
DECLARE_VECTOR_COMMAND(TRANSITION_END)
#define DECLARE_VECTOR_COMMAND(x) x, #define DECLARE_VECTOR_COMMAND(x) x,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment