OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/common/frame/caption_buttons/frame_caption_button.h" | 5 #include "ash/common/frame/caption_buttons/frame_caption_button.h" |
6 | 6 |
7 #include "ui/gfx/animation/slide_animation.h" | 7 #include "ui/gfx/animation/slide_animation.h" |
8 #include "ui/gfx/animation/throb_animation.h" | 8 #include "ui/gfx/animation/throb_animation.h" |
9 #include "ui/gfx/canvas.h" | 9 #include "ui/gfx/canvas.h" |
10 #include "ui/gfx/color_palette.h" | 10 #include "ui/gfx/color_palette.h" |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 use_light_images_ ? SK_ColorWHITE : SK_ColorBLACK, bg_alpha)); | 120 use_light_images_ ? SK_ColorWHITE : SK_ColorBLACK, bg_alpha)); |
121 } | 121 } |
122 | 122 |
123 int icon_alpha = swap_images_animation_->CurrentValueBetween(0, 255); | 123 int icon_alpha = swap_images_animation_->CurrentValueBetween(0, 255); |
124 int crossfade_icon_alpha = 0; | 124 int crossfade_icon_alpha = 0; |
125 if (icon_alpha < static_cast<int>(kFadeOutRatio * 255)) | 125 if (icon_alpha < static_cast<int>(kFadeOutRatio * 255)) |
126 crossfade_icon_alpha = static_cast<int>(255 - icon_alpha / kFadeOutRatio); | 126 crossfade_icon_alpha = static_cast<int>(255 - icon_alpha / kFadeOutRatio); |
127 | 127 |
128 if (crossfade_icon_alpha > 0 && !crossfade_icon_image_.isNull()) { | 128 if (crossfade_icon_alpha > 0 && !crossfade_icon_image_.isNull()) { |
129 gfx::Canvas icon_canvas(icon_image_.size(), canvas->image_scale(), false); | 129 gfx::Canvas icon_canvas(icon_image_.size(), canvas->image_scale(), false); |
130 SkPaint paint; | 130 cc::PaintFlags paint; |
131 paint.setAlpha(icon_alpha); | 131 paint.setAlpha(icon_alpha); |
132 icon_canvas.DrawImageInt(icon_image_, 0, 0, paint); | 132 icon_canvas.DrawImageInt(icon_image_, 0, 0, paint); |
133 | 133 |
134 paint.setAlpha(crossfade_icon_alpha); | 134 paint.setAlpha(crossfade_icon_alpha); |
135 paint.setBlendMode(SkBlendMode::kPlus); | 135 paint.setBlendMode(SkBlendMode::kPlus); |
136 icon_canvas.DrawImageInt(crossfade_icon_image_, 0, 0, paint); | 136 icon_canvas.DrawImageInt(crossfade_icon_image_, 0, 0, paint); |
137 | 137 |
138 PaintCentered(canvas, gfx::ImageSkia(icon_canvas.ExtractImageRep()), | 138 PaintCentered(canvas, gfx::ImageSkia(icon_canvas.ExtractImageRep()), |
139 alpha_); | 139 alpha_); |
140 } else { | 140 } else { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 double inactive_alpha = kInactiveIconAlpha; | 175 double inactive_alpha = kInactiveIconAlpha; |
176 if (hover_animation().is_animating()) { | 176 if (hover_animation().is_animating()) { |
177 inactive_alpha = | 177 inactive_alpha = |
178 hover_animation().CurrentValueBetween(inactive_alpha, 1.0f); | 178 hover_animation().CurrentValueBetween(inactive_alpha, 1.0f); |
179 } else if (state() == STATE_PRESSED || state() == STATE_HOVERED) { | 179 } else if (state() == STATE_PRESSED || state() == STATE_HOVERED) { |
180 inactive_alpha = 1.0f; | 180 inactive_alpha = 1.0f; |
181 } | 181 } |
182 alpha *= inactive_alpha; | 182 alpha *= inactive_alpha; |
183 } | 183 } |
184 | 184 |
185 SkPaint paint; | 185 cc::PaintFlags paint; |
186 paint.setAlpha(alpha); | 186 paint.setAlpha(alpha); |
187 canvas->DrawImageInt(to_center, (width() - to_center.width()) / 2, | 187 canvas->DrawImageInt(to_center, (width() - to_center.width()) / 2, |
188 (height() - to_center.height()) / 2, paint); | 188 (height() - to_center.height()) / 2, paint); |
189 } | 189 } |
190 | 190 |
191 } // namespace ash | 191 } // namespace ash |
OLD | NEW |