Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/canvas.h" | 5 #include "ui/gfx/canvas.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 116 else if (flags & Canvas::TEXT_ALIGN_CENTER) | 116 else if (flags & Canvas::TEXT_ALIGN_CENTER) |
| 117 render_text->SetHorizontalAlignment(ALIGN_CENTER); | 117 render_text->SetHorizontalAlignment(ALIGN_CENTER); |
| 118 else | 118 else |
| 119 render_text->SetHorizontalAlignment(ALIGN_LEFT); | 119 render_text->SetHorizontalAlignment(ALIGN_LEFT); |
| 120 | 120 |
| 121 render_text->set_subpixel_rendering_suppressed( | 121 render_text->set_subpixel_rendering_suppressed( |
| 122 (flags & Canvas::NO_SUBPIXEL_RENDERING) != 0); | 122 (flags & Canvas::NO_SUBPIXEL_RENDERING) != 0); |
| 123 | 123 |
| 124 render_text->SetColor(color); | 124 render_text->SetColor(color); |
| 125 const int font_style = font_list.GetFontStyle(); | 125 const int font_style = font_list.GetFontStyle(); |
| 126 render_text->SetStyle(BOLD, (font_style & Font::BOLD) != 0); | 126 render_text->SetWeight(font_list.GetFontWeight()); |
|
msw
2016/03/22 01:53:43
nit: move below SetStyle calls
Mikus
2016/03/22 14:19:50
Done.
| |
| 127 render_text->SetStyle(ITALIC, (font_style & Font::ITALIC) != 0); | 127 render_text->SetStyle(ITALIC, (font_style & Font::ITALIC) != 0); |
| 128 render_text->SetStyle(UNDERLINE, (font_style & Font::UNDERLINE) != 0); | 128 render_text->SetStyle(UNDERLINE, (font_style & Font::UNDERLINE) != 0); |
| 129 } | 129 } |
| 130 | 130 |
| 131 } // namespace | 131 } // namespace |
| 132 | 132 |
| 133 // static | 133 // static |
| 134 void Canvas::SizeStringFloat(const base::string16& text, | 134 void Canvas::SizeStringFloat(const base::string16& text, |
| 135 const FontList& font_list, | 135 const FontList& font_list, |
| 136 float* width, float* height, | 136 float* width, float* height, |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 346 UpdateRenderText(rect, text, font_list, flags, color, render_text.get()); | 346 UpdateRenderText(rect, text, font_list, flags, color, render_text.get()); |
| 347 render_text->SetElideBehavior(FADE_TAIL); | 347 render_text->SetElideBehavior(FADE_TAIL); |
| 348 | 348 |
| 349 canvas_->save(); | 349 canvas_->save(); |
| 350 ClipRect(display_rect); | 350 ClipRect(display_rect); |
| 351 render_text->Draw(this); | 351 render_text->Draw(this); |
| 352 canvas_->restore(); | 352 canvas_->restore(); |
| 353 } | 353 } |
| 354 | 354 |
| 355 } // namespace gfx | 355 } // namespace gfx |
| OLD | NEW |