| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/chromeos/login/rounded_rect_painter.h" | 5 #include "chrome/browser/chromeos/login/rounded_rect_painter.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "chrome/browser/chromeos/login/helper.h" | 8 #include "chrome/browser/chromeos/login/helper.h" |
| 9 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" | 9 #include "third_party/skia/include/effects/SkBlurMaskFilter.h" |
| 10 #include "third_party/skia/include/effects/SkGradientShader.h" | 10 #include "third_party/skia/include/effects/SkGradientShader.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 void RoundedRectBorder::GetInsets(gfx::Insets* insets) const { | 178 void RoundedRectBorder::GetInsets(gfx::Insets* insets) const { |
| 179 DCHECK(insets); | 179 DCHECK(insets); |
| 180 int shadow = border_->shadow; | 180 int shadow = border_->shadow; |
| 181 int inset = border_->corner_radius / 2 + border_->padding + shadow; | 181 int inset = border_->corner_radius / 2 + border_->padding + shadow; |
| 182 insets->Set(inset - shadow / 3, inset, inset + shadow / 3, inset); | 182 insets->Set(inset - shadow / 3, inset, inset + shadow / 3, inset); |
| 183 } | 183 } |
| 184 | 184 |
| 185 // Simple solid round background. | 185 // Simple solid round background. |
| 186 class RoundedBackground : public views::Background { | 186 class RoundedBackground : public views::Background { |
| 187 public: | 187 public: |
| 188 explicit RoundedBackground(int corner_radius, | 188 RoundedBackground(int corner_radius, |
| 189 int stroke_width, | 189 int stroke_width, |
| 190 const SkColor& background_color, | 190 const SkColor& background_color, |
| 191 const SkColor& stroke_color) | 191 const SkColor& stroke_color) |
| 192 : corner_radius_(corner_radius), | 192 : corner_radius_(corner_radius), |
| 193 stroke_width_(stroke_width), | 193 stroke_width_(stroke_width), |
| 194 stroke_color_(stroke_color) { | 194 stroke_color_(stroke_color) { |
| 195 SetNativeControlColor(background_color); | 195 SetNativeControlColor(background_color); |
| 196 } | 196 } |
| 197 | 197 |
| 198 virtual void Paint(gfx::Canvas* canvas, views::View* view) const { | 198 virtual void Paint(gfx::Canvas* canvas, views::View* view) const { |
| 199 SkRect rect; | 199 SkRect rect; |
| 200 rect.iset(0, 0, view->width(), view->height()); | 200 rect.iset(0, 0, view->width(), view->height()); |
| 201 SkPath path; | 201 SkPath path; |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 | 256 |
| 257 views::Background* CreateRoundedBackground(int corner_radius, | 257 views::Background* CreateRoundedBackground(int corner_radius, |
| 258 int stroke_width, | 258 int stroke_width, |
| 259 SkColor background_color, | 259 SkColor background_color, |
| 260 SkColor stroke_color) { | 260 SkColor stroke_color) { |
| 261 return new RoundedBackground( | 261 return new RoundedBackground( |
| 262 corner_radius, stroke_width, background_color, stroke_color); | 262 corner_radius, stroke_width, background_color, stroke_color); |
| 263 } | 263 } |
| 264 | 264 |
| 265 } // namespace chromeos | 265 } // namespace chromeos |
| OLD | NEW |