| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wm/overview/window_grid.h" | 5 #include "ash/common/wm/overview/window_grid.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <functional> | 8 #include <functional> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 views::View::OnPaint(canvas); | 112 views::View::OnPaint(canvas); |
| 113 | 113 |
| 114 SkScalar radius = SkIntToScalar(corner_radius_); | 114 SkScalar radius = SkIntToScalar(corner_radius_); |
| 115 const SkScalar kRadius[8] = {radius, radius, radius, radius, | 115 const SkScalar kRadius[8] = {radius, radius, radius, radius, |
| 116 radius, radius, radius, radius}; | 116 radius, radius, radius, radius}; |
| 117 SkPath path; | 117 SkPath path; |
| 118 gfx::Rect bounds(size()); | 118 gfx::Rect bounds(size()); |
| 119 bounds.set_height(bounds.height() + radius); | 119 bounds.set_height(bounds.height() + radius); |
| 120 path.addRoundRect(gfx::RectToSkRect(bounds), kRadius); | 120 path.addRoundRect(gfx::RectToSkRect(bounds), kRadius); |
| 121 | 121 |
| 122 cc::PaintFlags paint; | |
| 123 paint.setAntiAlias(true); | |
| 124 canvas->ClipPath(path, true); | 122 canvas->ClipPath(path, true); |
| 125 canvas->DrawColor(background_); | 123 canvas->DrawColor(background_); |
| 126 } | 124 } |
| 127 | 125 |
| 128 private: | 126 private: |
| 129 int corner_radius_; | 127 int corner_radius_; |
| 130 SkColor background_; | 128 SkColor background_; |
| 131 | 129 |
| 132 DISALLOW_COPY_AND_ASSIGN(RoundedRectView); | 130 DISALLOW_COPY_AND_ASSIGN(RoundedRectView); |
| 133 }; | 131 }; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 border_rect_f.Scale(scale); | 174 border_rect_f.Scale(scale); |
| 177 const float inset = border_thickness_ * scale - 0.5f; | 175 const float inset = border_thickness_ * scale - 0.5f; |
| 178 border_rect_f.Inset(inset, inset); | 176 border_rect_f.Inset(inset, inset); |
| 179 | 177 |
| 180 SkPath path; | 178 SkPath path; |
| 181 const SkScalar scaled_corner_radius = | 179 const SkScalar scaled_corner_radius = |
| 182 SkFloatToScalar(corner_radius_ * scale + 0.5f); | 180 SkFloatToScalar(corner_radius_ * scale + 0.5f); |
| 183 path.addRoundRect(gfx::RectFToSkRect(border_rect_f), scaled_corner_radius, | 181 path.addRoundRect(gfx::RectFToSkRect(border_rect_f), scaled_corner_radius, |
| 184 scaled_corner_radius); | 182 scaled_corner_radius); |
| 185 | 183 |
| 186 SkPaint paint; | 184 SkPaint flags; |
| 187 paint.setStyle(SkPaint::kStroke_Style); | 185 flags.setStyle(SkPaint::kStroke_Style); |
| 188 paint.setStrokeWidth(1); | 186 flags.setStrokeWidth(1); |
| 189 paint.setAntiAlias(true); | 187 flags.setAntiAlias(true); |
| 190 | 188 |
| 191 SkPath stroke_path; | 189 SkPath stroke_path; |
| 192 paint.getFillPath(path, &stroke_path); | 190 flags.getFillPath(path, &stroke_path); |
| 193 | 191 |
| 194 SkPath fill_path; | 192 SkPath fill_path; |
| 195 Op(path, stroke_path, kDifference_SkPathOp, &fill_path); | 193 Op(path, stroke_path, kDifference_SkPathOp, &fill_path); |
| 196 paint.setStyle(SkPaint::kFill_Style); | 194 flags.setStyle(SkPaint::kFill_Style); |
| 197 paint.setColor(get_color()); | 195 flags.setColor(get_color()); |
| 198 canvas->sk_canvas()->drawPath(fill_path, paint); | 196 canvas->sk_canvas()->drawPath(fill_path, flags); |
| 199 | 197 |
| 200 if (border_thickness_ > 0) { | 198 if (border_thickness_ > 0) { |
| 201 paint.setColor(border_color_); | 199 flags.setColor(border_color_); |
| 202 canvas->sk_canvas()->drawPath(stroke_path, paint); | 200 canvas->sk_canvas()->drawPath(stroke_path, flags); |
| 203 } | 201 } |
| 204 } | 202 } |
| 205 | 203 |
| 206 // Returns the vector for the fade in animation. | 204 // Returns the vector for the fade in animation. |
| 207 gfx::Vector2d GetSlideVectorForFadeIn(WindowSelector::Direction direction, | 205 gfx::Vector2d GetSlideVectorForFadeIn(WindowSelector::Direction direction, |
| 208 const gfx::Rect& bounds) { | 206 const gfx::Rect& bounds) { |
| 209 gfx::Vector2d vector; | 207 gfx::Vector2d vector; |
| 210 switch (direction) { | 208 switch (direction) { |
| 211 case WindowSelector::UP: | 209 case WindowSelector::UP: |
| 212 case WindowSelector::LEFT: | 210 case WindowSelector::LEFT: |
| (...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 840 *min_right = left; | 838 *min_right = left; |
| 841 if (*max_right < left) | 839 if (*max_right < left) |
| 842 *max_right = left; | 840 *max_right = left; |
| 843 } | 841 } |
| 844 *max_bottom = top + height; | 842 *max_bottom = top + height; |
| 845 } | 843 } |
| 846 return windows_fit; | 844 return windows_fit; |
| 847 } | 845 } |
| 848 | 846 |
| 849 } // namespace ash | 847 } // namespace ash |
| OLD | NEW |