| 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/omnibox/location_bar_util.h" | 5 #include "chrome/browser/ui/omnibox/location_bar_util.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
| 10 #include "third_party/skia/include/core/SkPaint.h" | 10 #include "third_party/skia/include/core/SkPaint.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 return; | 43 return; |
| 44 | 44 |
| 45 SkPoint gradient_bounds[2] = { {SkIntToScalar(bounds.x()), | 45 SkPoint gradient_bounds[2] = { {SkIntToScalar(bounds.x()), |
| 46 SkIntToScalar(bounds.y())}, | 46 SkIntToScalar(bounds.y())}, |
| 47 {SkIntToScalar(bounds.x()), | 47 {SkIntToScalar(bounds.x()), |
| 48 SkIntToScalar(bounds.bottom())} }; | 48 SkIntToScalar(bounds.bottom())} }; |
| 49 SkColor gradient_colors[2] = { | 49 SkColor gradient_colors[2] = { |
| 50 color_utils::AlphaBlend(text_color, background_color, 0x13), | 50 color_utils::AlphaBlend(text_color, background_color, 0x13), |
| 51 color_utils::AlphaBlend(text_color, background_color, 0x1d) | 51 color_utils::AlphaBlend(text_color, background_color, 0x1d) |
| 52 }; | 52 }; |
| 53 SkShader* gradient = SkGradientShader::CreateLinear( | 53 skia::RefPtr<SkShader> gradient = SkGradientShader::CreateLinear( |
| 54 gradient_bounds, gradient_colors, NULL, 2, SkShader::kClamp_TileMode); | 54 gradient_bounds, gradient_colors, NULL, 2, SkShader::kClamp_TileMode); |
| 55 SkPaint paint; | 55 SkPaint paint; |
| 56 paint.setShader(gradient); | 56 paint.setShader(gradient.get()); |
| 57 gradient->unref(); | |
| 58 canvas->DrawRect(bounds, paint); | 57 canvas->DrawRect(bounds, paint); |
| 59 | 58 |
| 60 SkColor border_color = | 59 SkColor border_color = |
| 61 color_utils::AlphaBlend(text_color, background_color, 0x55); | 60 color_utils::AlphaBlend(text_color, background_color, 0x55); |
| 62 canvas->DrawLine(bounds.origin(), | 61 canvas->DrawLine(bounds.origin(), |
| 63 gfx::Point(bounds.x(), bounds.bottom()), | 62 gfx::Point(bounds.x(), bounds.bottom()), |
| 64 border_color); | 63 border_color); |
| 65 // "-1" because gfx::Rects are half-open, not including their right or | 64 // "-1" because gfx::Rects are half-open, not including their right or |
| 66 // bottom edges. | 65 // bottom edges. |
| 67 canvas->DrawLine(gfx::Point(bounds.right() - 1, bounds.y()), | 66 canvas->DrawLine(gfx::Point(bounds.right() - 1, bounds.y()), |
| 68 gfx::Point(bounds.right() - 1, bounds.bottom()), | 67 gfx::Point(bounds.right() - 1, bounds.bottom()), |
| 69 border_color); | 68 border_color); |
| 70 } | 69 } |
| 71 | 70 |
| 72 } // namespace location_bar_util | 71 } // namespace location_bar_util |
| OLD | NEW |