| 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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ROUNDED_VIEW_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_ROUNDED_VIEW_H_ |
| 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ROUNDED_VIEW_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_ROUNDED_VIEW_H_ |
| 7 | 7 |
| 8 #include "gfx/canvas.h" | 8 #include "gfx/canvas.h" |
| 9 #include "gfx/canvas_skia.h" | 9 #include "gfx/canvas_skia.h" |
| 10 #include "gfx/rect.h" | 10 #include "gfx/rect.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } // namespace rounded_view | 28 } // namespace rounded_view |
| 29 | 29 |
| 30 // Class that sets up the round rectangle as a clip region of the view. | 30 // Class that sets up the round rectangle as a clip region of the view. |
| 31 // |C| - class inherited from |views::View|. | 31 // |C| - class inherited from |views::View|. |
| 32 template<typename C> | 32 template<typename C> |
| 33 class RoundedView: public C { | 33 class RoundedView: public C { |
| 34 public: | 34 public: |
| 35 // Empty constructor. | 35 // Empty constructor. |
| 36 RoundedView() {} | 36 RoundedView() {} |
| 37 | 37 |
| 38 // One argument constructor. | 38 // Constructors. |
| 39 template<typename D> | 39 template<typename D> |
| 40 explicit RoundedView(const D &value) : C(value) {} | 40 explicit RoundedView(const D &value) : C(value) {} |
| 41 template<typename D1, typename D2> |
| 42 explicit RoundedView(const D1 &val1, const D2 &val2) : C(val1, val2) {} |
| 41 | 43 |
| 42 // Overrides views::View. | 44 // Overrides views::View. |
| 43 virtual void ProcessPaint(gfx::Canvas* canvas); | 45 virtual void ProcessPaint(gfx::Canvas* canvas); |
| 44 | 46 |
| 45 protected: | 47 protected: |
| 46 // Returns the path that will be used for a clip. | 48 // Returns the path that will be used for a clip. |
| 47 virtual SkPath GetClipPath() const; | 49 virtual SkPath GetClipPath() const; |
| 48 | 50 |
| 49 // Returns maximal rectangle in the view. | 51 // Returns maximal rectangle in the view. |
| 50 virtual SkRect GetViewRect() const; | 52 virtual SkRect GetViewRect() const; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 view_rect.offset(rounded_view::kStrokeWidth - kDelta, | 124 view_rect.offset(rounded_view::kStrokeWidth - kDelta, |
| 123 rounded_view::kStrokeWidth - kDelta); | 125 rounded_view::kStrokeWidth - kDelta); |
| 124 paint.setColor(rounded_view::kOuterFrameColor); | 126 paint.setColor(rounded_view::kOuterFrameColor); |
| 125 canvas->AsCanvasSkia()->drawRoundRect(view_rect, rounded_view::kCornerRadius, | 127 canvas->AsCanvasSkia()->drawRoundRect(view_rect, rounded_view::kCornerRadius, |
| 126 rounded_view::kCornerRadius, paint); | 128 rounded_view::kCornerRadius, paint); |
| 127 } | 129 } |
| 128 | 130 |
| 129 } | 131 } |
| 130 | 132 |
| 131 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ROUNDED_VIEW_H_ | 133 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_ROUNDED_VIEW_H_ |
| OLD | NEW |