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

Side by Side Diff: chrome/browser/chromeos/login/username_view.cc

Issue 8221027: Make views::Label and views::Link auto-color themselves to be readable over their background colo... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 months 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
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 "chrome/browser/chromeos/login/username_view.h" 5 #include "chrome/browser/chromeos/login/username_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 solid_shader->unref(); 106 solid_shader->unref();
107 107
108 SkPaint paint; 108 SkPaint paint;
109 paint.setShader(composite_shader)->unref(); 109 paint.setShader(composite_shader)->unref();
110 canvas.sk_canvas()->drawPaint(paint); 110 canvas.sk_canvas()->drawPaint(paint);
111 } 111 }
112 112
113 // Draw the text. 113 // Draw the text.
114 // Note, direct call of the DrawStringInt method produces the green dots 114 // Note, direct call of the DrawStringInt method produces the green dots
115 // along the text perimeter (when the label is place on the white background). 115 // along the text perimeter (when the label is place on the white background).
116 SkColor text_color = IsEnabled() ? enabled_color() : disabled_color();
116 SkColor kInvisibleHaloColor = 0x00000000; 117 SkColor kInvisibleHaloColor = 0x00000000;
117 canvas.DrawStringWithHalo(GetText(), font(), GetColor(), 118 canvas.DrawStringWithHalo(GetText(), font(), text_color,
118 kInvisibleHaloColor, bounds.x() + margin_width_, 119 kInvisibleHaloColor, bounds.x() + margin_width_,
119 bounds.y(), bounds.width() - 2 * margin_width_, 120 bounds.y(), bounds.width() - 2 * margin_width_,
120 bounds.height(), flags); 121 bounds.height(), flags);
121 122
122 text_image_.reset(new SkBitmap(canvas.ExtractBitmap())); 123 text_image_.reset(new SkBitmap(canvas.ExtractBitmap()));
123 124
124 if (use_fading_for_text) { 125 if (use_fading_for_text) {
125 // Fade out only the text in the end. Use regular background. 126 // Fade out only the text in the end. Use regular background.
126 canvas.sk_canvas()->drawColor(kLabelBackgoundColor, SkXfermode::kSrc_Mode); 127 canvas.sk_canvas()->drawColor(kLabelBackgoundColor, SkXfermode::kSrc_Mode);
127 SkShader* image_shader = SkShader::CreateBitmapShader( 128 SkShader* image_shader = SkShader::CreateBitmapShader(
(...skipping 16 matching lines...) Expand all
144 void UsernameView::OnLocaleChanged() { 145 void UsernameView::OnLocaleChanged() {
145 if (is_guest_) { 146 if (is_guest_) {
146 SetText(l10n_util::GetStringUTF16(IDS_GUEST)); 147 SetText(l10n_util::GetStringUTF16(IDS_GUEST));
147 } 148 }
148 // Repaint because the font may have changed. 149 // Repaint because the font may have changed.
149 text_image_.reset(); 150 text_image_.reset();
150 SchedulePaint(); 151 SchedulePaint();
151 } 152 }
152 153
153 } // namespace chromeos 154 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/user_view.cc ('k') | chrome/browser/chromeos/options/vpn_config_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698