OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/launcher/overflow_button.h" | 5 #include "ash/launcher/overflow_button.h" |
6 | 6 |
7 #include "grit/ash_resources.h" | 7 #include "grit/ash_resources.h" |
8 #include "grit/ash_strings.h" | 8 #include "grit/ash_strings.h" |
9 #include "third_party/skia/include/core/SkPaint.h" | 9 #include "third_party/skia/include/core/SkPaint.h" |
10 #include "third_party/skia/include/core/SkPath.h" | 10 #include "third_party/skia/include/core/SkPath.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 namespace { | 21 namespace { |
22 | 22 |
23 const int kButtonHoverAlpha = 150; | 23 const int kButtonHoverAlpha = 150; |
24 | 24 |
25 const int kButtonCornerRadius = 2; | 25 const int kButtonCornerRadius = 2; |
26 | 26 |
27 const int kButtonHoverSize = 28; | 27 const int kButtonHoverSize = 28; |
28 | 28 |
29 const int kBackgroundOffset = (48 - kButtonHoverSize) / 2; | 29 const int kBackgroundOffset = (48 - kButtonHoverSize) / 2; |
30 | 30 |
31 void RotateCounterclockwise(ui::Transform* transform) { | 31 void RotateCounterclockwise(gfx::Transform* transform) { |
32 transform->matrix().set3x3(0, -1, 0, | 32 transform->matrix().set3x3(0, -1, 0, |
33 1, 0, 0, | 33 1, 0, 0, |
34 0, 0, 1); | 34 0, 0, 1); |
35 } | 35 } |
36 | 36 |
37 void RotateClockwise(ui::Transform* transform) { | 37 void RotateClockwise(gfx::Transform* transform) { |
38 transform->matrix().set3x3( 0, 1, 0, | 38 transform->matrix().set3x3( 0, 1, 0, |
39 -1, 0, 0, | 39 -1, 0, 0, |
40 0, 0, 1); | 40 0, 0, 1); |
41 } | 41 } |
42 | 42 |
43 } // namesapce | 43 } // namesapce |
44 | 44 |
45 OverflowButton::OverflowButton(views::ButtonListener* listener) | 45 OverflowButton::OverflowButton(views::ButtonListener* listener) |
46 : CustomButton(listener), | 46 : CustomButton(listener), |
47 alignment_(SHELF_ALIGNMENT_BOTTOM), | 47 alignment_(SHELF_ALIGNMENT_BOTTOM), |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 PaintBackground( | 100 PaintBackground( |
101 canvas, | 101 canvas, |
102 kButtonHoverAlpha * hover_animation_->GetCurrentValue()); | 102 kButtonHoverAlpha * hover_animation_->GetCurrentValue()); |
103 } else if (state() == BS_HOT || state() == BS_PUSHED) { | 103 } else if (state() == BS_HOT || state() == BS_PUSHED) { |
104 PaintBackground(canvas, kButtonHoverAlpha); | 104 PaintBackground(canvas, kButtonHoverAlpha); |
105 } | 105 } |
106 | 106 |
107 if (height() < kButtonHoverSize) | 107 if (height() < kButtonHoverSize) |
108 return; | 108 return; |
109 | 109 |
110 ui::Transform transform; | 110 gfx::Transform transform; |
111 | 111 |
112 switch (alignment_) { | 112 switch (alignment_) { |
113 case SHELF_ALIGNMENT_BOTTOM: | 113 case SHELF_ALIGNMENT_BOTTOM: |
114 // Shift 1 pixel left to align with overflow bubble tip. | 114 // Shift 1 pixel left to align with overflow bubble tip. |
115 transform.ConcatTranslate(-1, kBackgroundOffset); | 115 transform.ConcatTranslate(-1, kBackgroundOffset); |
116 break; | 116 break; |
117 case SHELF_ALIGNMENT_LEFT: | 117 case SHELF_ALIGNMENT_LEFT: |
118 RotateClockwise(&transform); | 118 RotateClockwise(&transform); |
119 transform.ConcatTranslate(kBackgroundOffset, -1); | 119 transform.ConcatTranslate(kBackgroundOffset, -1); |
120 break; | 120 break; |
(...skipping 14 matching lines...) Expand all Loading... |
135 } else { | 135 } else { |
136 canvas->DrawImageInt(*image_, | 136 canvas->DrawImageInt(*image_, |
137 kButtonHoverSize - image_->width(), | 137 kButtonHoverSize - image_->width(), |
138 rect.y() + (rect.height() - image_->height()) / 2); | 138 rect.y() + (rect.height() - image_->height()) / 2); |
139 } | 139 } |
140 canvas->Restore(); | 140 canvas->Restore(); |
141 } | 141 } |
142 | 142 |
143 } // namespace internal | 143 } // namespace internal |
144 } // namespace ash | 144 } // namespace ash |
OLD | NEW |