| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/gfx/native_theme_android.h" | 5 #include "ui/gfx/native_theme_android.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/basictypes.h" |
| 9 #include "base/logging.h" | 10 #include "base/logging.h" |
| 10 #include "grit/gfx_resources.h" | 11 #include "grit/gfx_resources.h" |
| 11 #include "third_party/skia/include/effects/SkGradientShader.h" | 12 #include "third_party/skia/include/effects/SkGradientShader.h" |
| 12 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
| 13 #include "ui/gfx/color_utils.h" | 14 #include "ui/gfx/color_utils.h" |
| 14 #include "ui/gfx/rect.h" | 15 #include "ui/gfx/rect.h" |
| 15 #include "ui/gfx/size.h" | 16 #include "ui/gfx/size.h" |
| 16 | 17 |
| 17 namespace gfx { | 18 namespace gfx { |
| 18 | 19 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 45 if (adjusted.l > 1.0) | 46 if (adjusted.l > 1.0) |
| 46 adjusted.l = 1.0; | 47 adjusted.l = 1.0; |
| 47 if (adjusted.l < 0.0) | 48 if (adjusted.l < 0.0) |
| 48 adjusted.l = 0.0; | 49 adjusted.l = 0.0; |
| 49 | 50 |
| 50 return color_utils::HSLToSkColor(adjusted, alpha); | 51 return color_utils::HSLToSkColor(adjusted, alpha); |
| 51 } | 52 } |
| 52 | 53 |
| 53 // static | 54 // static |
| 54 NativeThemeAndroid* NativeThemeAndroid::instance() { | 55 NativeThemeAndroid* NativeThemeAndroid::instance() { |
| 55 // The global NativeThemeAndroid instance. | 56 CR_DEFINE_STATIC_LOCAL(NativeThemeAndroid, s_native_theme, ()); |
| 56 static NativeThemeAndroid s_native_theme; | |
| 57 return &s_native_theme; | 57 return &s_native_theme; |
| 58 } | 58 } |
| 59 | 59 |
| 60 gfx::Size NativeThemeAndroid::GetPartSize(Part part) const { | 60 gfx::Size NativeThemeAndroid::GetPartSize(Part part) const { |
| 61 switch (part) { | 61 switch (part) { |
| 62 case SCROLLBAR_DOWN_ARROW: | 62 case SCROLLBAR_DOWN_ARROW: |
| 63 case SCROLLBAR_UP_ARROW: | 63 case SCROLLBAR_UP_ARROW: |
| 64 return gfx::Size(kScrollbarWidth, kButtonLength); | 64 return gfx::Size(kScrollbarWidth, kButtonLength); |
| 65 case SCROLLBAR_LEFT_ARROW: | 65 case SCROLLBAR_LEFT_ARROW: |
| 66 case SCROLLBAR_RIGHT_ARROW: | 66 case SCROLLBAR_RIGHT_ARROW: |
| (...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 784 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2, 0.28, 0.5); | 784 SkScalar min_diff = Clamp((hsv1[1] + hsv2[1]) * 1.2, 0.28, 0.5); |
| 785 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5); | 785 SkScalar diff = Clamp(fabs(hsv1[2] - hsv2[2]) / 2, min_diff, 0.5); |
| 786 | 786 |
| 787 if (hsv1[2] + hsv2[2] > 1.0) | 787 if (hsv1[2] + hsv2[2] > 1.0) |
| 788 diff = -diff; | 788 diff = -diff; |
| 789 | 789 |
| 790 return SaturateAndBrighten(hsv2, -0.2, diff); | 790 return SaturateAndBrighten(hsv2, -0.2, diff); |
| 791 } | 791 } |
| 792 | 792 |
| 793 } // namespace gfx | 793 } // namespace gfx |
| OLD | NEW |