Chromium Code Reviews| Index: ui/gfx/render_text_win.cc |
| =================================================================== |
| --- ui/gfx/render_text_win.cc (revision 109436) |
| +++ ui/gfx/render_text_win.cc (working copy) |
| @@ -10,6 +10,7 @@ |
| #include "base/logging.h" |
| #include "base/stl_util.h" |
| #include "base/string_util.h" |
| +#include "base/win/scoped_hdc.h" |
| #include "third_party/skia/include/core/SkTypeface.h" |
| #include "ui/gfx/canvas.h" |
| #include "ui/gfx/canvas_skia.h" |
| @@ -316,9 +317,10 @@ |
| void RenderTextWin::UpdateLayout() { |
| // TODO(msw): Skip complex processing if ScriptIsComplex returns false. |
| ItemizeLogicalText(); |
| - HDC hdc = CreateCompatibleDC(NULL); |
| - LayoutVisualText(hdc); |
| - DeleteDC(hdc); |
| + if (!runs_.empty()) { |
| + base::win::ScopedCreateDC hdc(CreateCompatibleDC(NULL)); |
|
msw
2011/11/10 22:22:08
You can optionally move this (and the runs_.empty
Alexei Svitkine (slow)
2011/11/11 14:53:48
Done.
|
| + LayoutVisualText(hdc); |
| + } |
| } |
| size_t RenderTextWin::IndexOfAdjacentGrapheme(size_t index, bool next) { |