| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
| 9 #include "chrome/browser/chromeos/login/rounded_view.h" | 9 #include "chrome/browser/chromeos/login/rounded_view.h" |
| 10 #include "gfx/canvas.h" | 10 #include "gfx/canvas.h" |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 | 148 |
| 149 SkPaint paint; | 149 SkPaint paint; |
| 150 paint.setShader(composite_shader)->unref(); | 150 paint.setShader(composite_shader)->unref(); |
| 151 canvas.drawPaint(paint); | 151 canvas.drawPaint(paint); |
| 152 } | 152 } |
| 153 | 153 |
| 154 // Draw the text. | 154 // Draw the text. |
| 155 // Note, direct call of the DrawStringInt method produces the green dots | 155 // Note, direct call of the DrawStringInt method produces the green dots |
| 156 // along the text perimeter (when the label is place on the white background). | 156 // along the text perimeter (when the label is place on the white background). |
| 157 SkColor kInvisibleHaloColor = 0x00000000; | 157 SkColor kInvisibleHaloColor = 0x00000000; |
| 158 canvas.DrawStringWithHalo(GetText(), font(), GetColor(), kInvisibleHaloColor, | 158 canvas.DrawStringWithHalo(WideToUTF16Hack(GetText()), font(), GetColor(), |
| 159 bounds.x() + margin_width_, bounds.y(), | 159 kInvisibleHaloColor, bounds.x() + margin_width_, |
| 160 bounds.width() - 2 * margin_width_, bounds.height(), | 160 bounds.y(), bounds.width() - 2 * margin_width_, |
| 161 flags); | 161 bounds.height(), flags); |
| 162 | 162 |
| 163 text_image_.reset(new SkBitmap(canvas.ExtractBitmap())); | 163 text_image_.reset(new SkBitmap(canvas.ExtractBitmap())); |
| 164 | 164 |
| 165 if (use_fading_for_text) { | 165 if (use_fading_for_text) { |
| 166 // Fade out only the text in the end. Use regualar background. | 166 // Fade out only the text in the end. Use regualar background. |
| 167 canvas.drawColor(kLabelBackgoundColor, SkXfermode::kSrc_Mode); | 167 canvas.drawColor(kLabelBackgoundColor, SkXfermode::kSrc_Mode); |
| 168 SkShader* image_shader = SkShader::CreateBitmapShader( | 168 SkShader* image_shader = SkShader::CreateBitmapShader( |
| 169 *text_image_, | 169 *text_image_, |
| 170 SkShader::kRepeat_TileMode, | 170 SkShader::kRepeat_TileMode, |
| 171 SkShader::kRepeat_TileMode); | 171 SkShader::kRepeat_TileMode); |
| 172 SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrcIn_Mode); | 172 SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrcIn_Mode); |
| 173 SkShader* composite_shader = new SkComposeShader(gradient_shader, | 173 SkShader* composite_shader = new SkComposeShader(gradient_shader, |
| 174 image_shader, mode); | 174 image_shader, mode); |
| 175 gradient_shader->unref(); | 175 gradient_shader->unref(); |
| 176 image_shader->unref(); | 176 image_shader->unref(); |
| 177 | 177 |
| 178 SkPaint paint; | 178 SkPaint paint; |
| 179 paint.setShader(composite_shader)->unref(); | 179 paint.setShader(composite_shader)->unref(); |
| 180 canvas.drawPaint(paint); | 180 canvas.drawPaint(paint); |
| 181 text_image_.reset(new SkBitmap(canvas.ExtractBitmap())); | 181 text_image_.reset(new SkBitmap(canvas.ExtractBitmap())); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 | 184 |
| 185 } // namespace chromeos | 185 } // namespace chromeos |
| OLD | NEW |