| 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 | 143 |
| 144 SkPaint paint; | 144 SkPaint paint; |
| 145 paint.setShader(composite_shader)->unref(); | 145 paint.setShader(composite_shader)->unref(); |
| 146 canvas.drawPaint(paint); | 146 canvas.drawPaint(paint); |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Draw the text. | 149 // Draw the text. |
| 150 // Note, direct call of the DrawStringInt method produces the green dots | 150 // Note, direct call of the DrawStringInt method produces the green dots |
| 151 // along the text perimeter (when the label is place on the white background). | 151 // along the text perimeter (when the label is place on the white background). |
| 152 SkColor kInvisibleHaloColor = 0x00000000; | 152 SkColor kInvisibleHaloColor = 0x00000000; |
| 153 canvas.DrawStringWithHalo(GetText(), font(), GetColor(), kInvisibleHaloColor, | 153 canvas.DrawStringWithHalo(WideToUTF16Hack(GetText()), font(), GetColor(), |
| 154 bounds.x() + margin_width_, bounds.y(), | 154 kInvisibleHaloColor, bounds.x() + margin_width_, |
| 155 bounds.width() - 2 * margin_width_, bounds.height(), | 155 bounds.y(), bounds.width() - 2 * margin_width_, |
| 156 flags); | 156 bounds.height(), flags); |
| 157 | 157 |
| 158 text_image_.reset(new SkBitmap(canvas.ExtractBitmap())); | 158 text_image_.reset(new SkBitmap(canvas.ExtractBitmap())); |
| 159 | 159 |
| 160 if (use_fading_for_text) { | 160 if (use_fading_for_text) { |
| 161 // Fade out only the text in the end. Use regualar background. | 161 // Fade out only the text in the end. Use regualar background. |
| 162 canvas.drawColor(kLabelBackgoundColor, SkXfermode::kSrc_Mode); | 162 canvas.drawColor(kLabelBackgoundColor, SkXfermode::kSrc_Mode); |
| 163 SkShader* image_shader = SkShader::CreateBitmapShader( | 163 SkShader* image_shader = SkShader::CreateBitmapShader( |
| 164 *text_image_, | 164 *text_image_, |
| 165 SkShader::kRepeat_TileMode, | 165 SkShader::kRepeat_TileMode, |
| 166 SkShader::kRepeat_TileMode); | 166 SkShader::kRepeat_TileMode); |
| 167 SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrcIn_Mode); | 167 SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrcIn_Mode); |
| 168 SkShader* composite_shader = new SkComposeShader(gradient_shader, | 168 SkShader* composite_shader = new SkComposeShader(gradient_shader, |
| 169 image_shader, mode); | 169 image_shader, mode); |
| 170 gradient_shader->unref(); | 170 gradient_shader->unref(); |
| 171 image_shader->unref(); | 171 image_shader->unref(); |
| 172 | 172 |
| 173 SkPaint paint; | 173 SkPaint paint; |
| 174 paint.setShader(composite_shader)->unref(); | 174 paint.setShader(composite_shader)->unref(); |
| 175 canvas.drawPaint(paint); | 175 canvas.drawPaint(paint); |
| 176 text_image_.reset(new SkBitmap(canvas.ExtractBitmap())); | 176 text_image_.reset(new SkBitmap(canvas.ExtractBitmap())); |
| 177 } | 177 } |
| 178 } | 178 } |
| 179 | 179 |
| 180 } // namespace chromeos | 180 } // namespace chromeos |
| OLD | NEW |