| 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 "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "ui/gfx/font_list.h" | 10 #include "ui/gfx/font_list.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 flags |= Canvas::DefaultCanvasTextAlignment(); | 135 flags |= Canvas::DefaultCanvasTextAlignment(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 if (flags & Canvas::TEXT_ALIGN_RIGHT) | 138 if (flags & Canvas::TEXT_ALIGN_RIGHT) |
| 139 render_text->SetHorizontalAlignment(ALIGN_RIGHT); | 139 render_text->SetHorizontalAlignment(ALIGN_RIGHT); |
| 140 else if (flags & Canvas::TEXT_ALIGN_CENTER) | 140 else if (flags & Canvas::TEXT_ALIGN_CENTER) |
| 141 render_text->SetHorizontalAlignment(ALIGN_CENTER); | 141 render_text->SetHorizontalAlignment(ALIGN_CENTER); |
| 142 else | 142 else |
| 143 render_text->SetHorizontalAlignment(ALIGN_LEFT); | 143 render_text->SetHorizontalAlignment(ALIGN_LEFT); |
| 144 | 144 |
| 145 if (flags & Canvas::NO_SUBPIXEL_RENDERING) | 145 render_text->set_subpixel_rendering_enabled( |
| 146 render_text->set_background_is_transparent(true); | 146 (flags & Canvas::NO_SUBPIXEL_RENDERING) == 0); |
| 147 | 147 |
| 148 render_text->SetColor(color); | 148 render_text->SetColor(color); |
| 149 const int font_style = font_list.GetFontStyle(); | 149 const int font_style = font_list.GetFontStyle(); |
| 150 render_text->SetStyle(BOLD, (font_style & Font::BOLD) != 0); | 150 render_text->SetStyle(BOLD, (font_style & Font::BOLD) != 0); |
| 151 render_text->SetStyle(ITALIC, (font_style & Font::ITALIC) != 0); | 151 render_text->SetStyle(ITALIC, (font_style & Font::ITALIC) != 0); |
| 152 render_text->SetStyle(UNDERLINE, (font_style & Font::UNDERLINE) != 0); | 152 render_text->SetStyle(UNDERLINE, (font_style & Font::UNDERLINE) != 0); |
| 153 } | 153 } |
| 154 | 154 |
| 155 } // namespace | 155 } // namespace |
| 156 | 156 |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 395 UpdateRenderText(rect, text, font_list, flags, color, render_text.get()); | 395 UpdateRenderText(rect, text, font_list, flags, color, render_text.get()); |
| 396 render_text->SetElideBehavior(FADE_TAIL); | 396 render_text->SetElideBehavior(FADE_TAIL); |
| 397 | 397 |
| 398 canvas_->save(); | 398 canvas_->save(); |
| 399 ClipRect(display_rect); | 399 ClipRect(display_rect); |
| 400 render_text->Draw(this); | 400 render_text->Draw(this); |
| 401 canvas_->restore(); | 401 canvas_->restore(); |
| 402 } | 402 } |
| 403 | 403 |
| 404 } // namespace gfx | 404 } // namespace gfx |
| OLD | NEW |