Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: ui/gfx/native_theme_android.cc

Issue 8520026: Fix statics in NativeTheme*::instance() to avoid destruction post main (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ui/gfx/native_theme_aura.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/native_theme_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698