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

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

Issue 867003002: Cache gfx::RenderText instances in views::Label. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 10 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
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 if (flags & Canvas::NO_SUBPIXEL_RENDERING)
146 render_text->set_background_is_transparent(true); 146 render_text->set_subpixel_rendering_enabled(false);
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698