Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(112)

Side by Side Diff: ui/gfx/canvas_skia.cc

Issue 343513002: Refactor views::Label and gfx::RenderText shadow functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove forbidden static FontList. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ash/wm/overview/window_selector_item.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ClipRect(clip_rect); 233 ClipRect(clip_rect);
234 234
235 Rect rect(text_bounds); 235 Rect rect(text_bounds);
236 base::string16 adjusted_text = text; 236 base::string16 adjusted_text = text;
237 237
238 #if defined(OS_WIN) 238 #if defined(OS_WIN)
239 AdjustStringDirection(flags, &adjusted_text); 239 AdjustStringDirection(flags, &adjusted_text);
240 #endif 240 #endif
241 241
242 scoped_ptr<RenderText> render_text(RenderText::CreateInstance()); 242 scoped_ptr<RenderText> render_text(RenderText::CreateInstance());
243 render_text->SetTextShadows(shadows); 243 render_text->set_shadows(shadows);
244 244
245 if (flags & MULTI_LINE) { 245 if (flags & MULTI_LINE) {
246 WordWrapBehavior wrap_behavior = IGNORE_LONG_WORDS; 246 WordWrapBehavior wrap_behavior = IGNORE_LONG_WORDS;
247 if (flags & CHARACTER_BREAK) 247 if (flags & CHARACTER_BREAK)
248 wrap_behavior = WRAP_LONG_WORDS; 248 wrap_behavior = WRAP_LONG_WORDS;
249 else if (!(flags & NO_ELLIPSIS)) 249 else if (!(flags & NO_ELLIPSIS))
250 wrap_behavior = ELIDE_LONG_WORDS; 250 wrap_behavior = ELIDE_LONG_WORDS;
251 251
252 std::vector<base::string16> strings; 252 std::vector<base::string16> strings;
253 ElideRectangleText(adjusted_text, font_list, text_bounds.width(), 253 ElideRectangleText(adjusted_text, font_list, text_bounds.width(),
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 rect.set_height(line_height); 394 rect.set_height(line_height);
395 render_text->SetDisplayRect(rect); 395 render_text->SetDisplayRect(rect);
396 396
397 canvas_->save(); 397 canvas_->save();
398 ClipRect(display_rect); 398 ClipRect(display_rect);
399 render_text->Draw(this); 399 render_text->Draw(this);
400 canvas_->restore(); 400 canvas_->restore();
401 } 401 }
402 402
403 } // namespace gfx 403 } // namespace gfx
OLDNEW
« no previous file with comments | « ash/wm/overview/window_selector_item.cc ('k') | ui/gfx/render_text.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698