| 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/theme_helpers.h" | 5 #include "chrome/browser/ui/views/theme_helpers.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlapp.h> | 8 #include <atlapp.h> |
| 9 #include <atltheme.h> | 9 #include <atltheme.h> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 SkColor grad_colors[2]; | 42 SkColor grad_colors[2]; |
| 43 COLORREF hl_ref = ::GetSysColor(COLOR_3DHILIGHT); | 43 COLORREF hl_ref = ::GetSysColor(COLOR_3DHILIGHT); |
| 44 grad_colors[0] = SkColorSetRGB(GetRValue(hl_ref), GetGValue(hl_ref), | 44 grad_colors[0] = SkColorSetRGB(GetRValue(hl_ref), GetGValue(hl_ref), |
| 45 GetBValue(hl_ref)); | 45 GetBValue(hl_ref)); |
| 46 COLORREF face_ref = ::GetSysColor(COLOR_3DFACE); | 46 COLORREF face_ref = ::GetSysColor(COLOR_3DFACE); |
| 47 grad_colors[1] = SkColorSetRGB(GetRValue(face_ref), GetGValue(face_ref), | 47 grad_colors[1] = SkColorSetRGB(GetRValue(face_ref), GetGValue(face_ref), |
| 48 GetBValue(face_ref)); | 48 GetBValue(face_ref)); |
| 49 SkPoint grad_points[2]; | 49 SkPoint grad_points[2]; |
| 50 grad_points[0].set(SkIntToScalar(0), SkIntToScalar(0)); | 50 grad_points[0].set(SkIntToScalar(0), SkIntToScalar(0)); |
| 51 grad_points[1].set(SkIntToScalar(width), SkIntToScalar(0)); | 51 grad_points[1].set(SkIntToScalar(width), SkIntToScalar(0)); |
| 52 SkShader* gradient_shader = SkGradientShader::CreateLinear( | 52 skia::RefPtr<SkShader> gradient_shader = skia::AdoptRef( |
| 53 grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode); | 53 SkGradientShader::CreateLinear( |
| 54 grad_points, grad_colors, NULL, 2, SkShader::kRepeat_TileMode)); |
| 54 SkPaint paint; | 55 SkPaint paint; |
| 55 paint.setShader(gradient_shader); | 56 paint.setShader(gradient_shader.get()); |
| 56 // Shader created with a ref count of 1, release as the paint now owns | 57 // Shader created with a ref count of 1, release as the paint now owns |
| 57 // the gradient. | 58 // the gradient. |
| 58 gradient_shader->unref(); | |
| 59 paint.setStyle(SkPaint::kFill_Style); | 59 paint.setStyle(SkPaint::kFill_Style); |
| 60 canvas.sk_canvas()->drawRectCoords( | 60 canvas.sk_canvas()->drawRectCoords( |
| 61 SkIntToScalar(0), SkIntToScalar(0), | 61 SkIntToScalar(0), SkIntToScalar(0), |
| 62 SkIntToScalar(width), SkIntToScalar(1), paint); | 62 SkIntToScalar(width), SkIntToScalar(1), paint); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Extract the color values from the selected pixels | 65 // Extract the color values from the selected pixels |
| 66 // The | in the following operations forces the alpha to 0xFF. This is | 66 // The | in the following operations forces the alpha to 0xFF. This is |
| 67 // needed as windows sets the alpha to 0 when it renders. | 67 // needed as windows sets the alpha to 0 when it renders. |
| 68 SkDevice* device = skia::GetTopDevice(*canvas.sk_canvas()); | 68 SkDevice* device = skia::GetTopDevice(*canvas.sk_canvas()); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 85 if (!theme.IsThemeNull()) { | 85 if (!theme.IsThemeNull()) { |
| 86 *dark_color = SkColorSetARGB(60, 0, 0, 0); | 86 *dark_color = SkColorSetARGB(60, 0, 0, 0); |
| 87 } else { | 87 } else { |
| 88 COLORREF shadow_ref = ::GetSysColor(COLOR_3DSHADOW); | 88 COLORREF shadow_ref = ::GetSysColor(COLOR_3DSHADOW); |
| 89 *dark_color = SkColorSetARGB(175, | 89 *dark_color = SkColorSetARGB(175, |
| 90 GetRValue(shadow_ref), | 90 GetRValue(shadow_ref), |
| 91 GetGValue(shadow_ref), | 91 GetGValue(shadow_ref), |
| 92 GetBValue(shadow_ref)); | 92 GetBValue(shadow_ref)); |
| 93 } | 93 } |
| 94 } | 94 } |
| OLD | NEW |