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/base/range/range.h" | 10 #include "ui/base/range/range.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 #if defined(OS_LINUX) | 181 #if defined(OS_LINUX) |
182 // TODO(asvitkine): ash/tooltips/tooltip_controller.cc adds \n's to the string | 182 // TODO(asvitkine): ash/tooltips/tooltip_controller.cc adds \n's to the string |
183 // without passing MULTI_LINE. | 183 // without passing MULTI_LINE. |
184 if (text.find('\n') != string16::npos) | 184 if (text.find('\n') != string16::npos) |
185 flags |= gfx::Canvas::MULTI_LINE; | 185 flags |= gfx::Canvas::MULTI_LINE; |
186 #endif | 186 #endif |
187 | 187 |
188 return flags; | 188 return flags; |
189 } | 189 } |
190 | 190 |
191 } // anonymous namespace | 191 } // namespace |
192 | 192 |
193 namespace gfx { | 193 namespace gfx { |
194 | 194 |
195 // static | 195 // static |
196 void Canvas::SizeStringInt(const string16& text, | 196 void Canvas::SizeStringInt(const string16& text, |
197 const gfx::Font& font, | 197 const gfx::Font& font, |
198 int* width, int* height, | 198 int* width, int* height, |
199 int flags) { | 199 int flags) { |
200 DCHECK_GE(*width, 0); | 200 DCHECK_GE(*width, 0); |
201 DCHECK_GE(*height, 0); | 201 DCHECK_GE(*height, 0); |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 rect.set_height(line_height); | 470 rect.set_height(line_height); |
471 render_text->SetDisplayRect(rect); | 471 render_text->SetDisplayRect(rect); |
472 | 472 |
473 canvas_->save(SkCanvas::kClip_SaveFlag); | 473 canvas_->save(SkCanvas::kClip_SaveFlag); |
474 ClipRect(display_rect); | 474 ClipRect(display_rect); |
475 render_text->Draw(this); | 475 render_text->Draw(this); |
476 canvas_->restore(); | 476 canvas_->restore(); |
477 } | 477 } |
478 | 478 |
479 } // namespace gfx | 479 } // namespace gfx |
OLD | NEW |