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 "chrome/browser/ui/views/detachable_toolbar_view.h" | 5 #include "chrome/browser/ui/views/detachable_toolbar_view.h" |
6 | 6 |
7 #include "chrome/browser/themes/theme_service.h" | 7 #include "chrome/browser/themes/theme_service.h" |
8 #include "grit/theme_resources.h" | 8 #include "grit/theme_resources.h" |
9 #include "third_party/skia/include/core/SkShader.h" | 9 #include "third_party/skia/include/core/SkShader.h" |
10 #include "ui/base/resource/resource_bundle.h" | 10 #include "ui/base/resource/resource_bundle.h" |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 // static | 114 // static |
115 void DetachableToolbarView::PaintVerticalDivider(gfx::Canvas* canvas, | 115 void DetachableToolbarView::PaintVerticalDivider(gfx::Canvas* canvas, |
116 int x, | 116 int x, |
117 int height, | 117 int height, |
118 int vertical_padding, | 118 int vertical_padding, |
119 SkColor top_color, | 119 SkColor top_color, |
120 SkColor middle_color, | 120 SkColor middle_color, |
121 SkColor bottom_color) { | 121 SkColor bottom_color) { |
122 // Draw the upper half of the divider. | 122 // Draw the upper half of the divider. |
123 SkPaint paint; | 123 SkPaint paint; |
124 SkSafeUnref(paint.setShader(gfx::CreateGradientShader(vertical_padding + 1, | 124 skia::RefPtr<SkShader> shader = gfx::CreateGradientShader( |
125 height / 2, | 125 vertical_padding + 1, height / 2, top_color, middle_color); |
126 top_color, | 126 paint.setShader(shader.get()); |
127 middle_color))); | |
128 SkRect rc = { SkIntToScalar(x), | 127 SkRect rc = { SkIntToScalar(x), |
129 SkIntToScalar(vertical_padding + 1), | 128 SkIntToScalar(vertical_padding + 1), |
130 SkIntToScalar(x + 1), | 129 SkIntToScalar(x + 1), |
131 SkIntToScalar(height / 2) }; | 130 SkIntToScalar(height / 2) }; |
132 canvas->sk_canvas()->drawRect(rc, paint); | 131 canvas->sk_canvas()->drawRect(rc, paint); |
133 | 132 |
134 // Draw the lower half of the divider. | 133 // Draw the lower half of the divider. |
135 SkPaint paint_down; | 134 SkPaint paint_down; |
136 SkSafeUnref(paint_down.setShader(gfx::CreateGradientShader( | 135 shader = gfx::CreateGradientShader( |
137 height / 2, height - vertical_padding, middle_color, bottom_color))); | 136 height / 2, height - vertical_padding, middle_color, bottom_color); |
| 137 paint_down.setShader(shader.get()); |
138 SkRect rc_down = { SkIntToScalar(x), | 138 SkRect rc_down = { SkIntToScalar(x), |
139 SkIntToScalar(height / 2), | 139 SkIntToScalar(height / 2), |
140 SkIntToScalar(x + 1), | 140 SkIntToScalar(x + 1), |
141 SkIntToScalar(height - vertical_padding) }; | 141 SkIntToScalar(height - vertical_padding) }; |
142 canvas->sk_canvas()->drawRect(rc_down, paint_down); | 142 canvas->sk_canvas()->drawRect(rc_down, paint_down); |
143 } | 143 } |
OLD | NEW |