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

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

Issue 606453002: Remove implicit HANDLE conversions from ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « ui/gfx/icon_util.cc ('k') | ui/native_theme/native_theme_win.cc » ('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/platform_font_win.h" 5 #include "ui/gfx/platform_font_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <math.h> 8 #include <math.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 return font_ref_->font_name(); 173 return font_ref_->font_name();
174 } 174 }
175 175
176 std::string PlatformFontWin::GetLocalizedFontName() const { 176 std::string PlatformFontWin::GetLocalizedFontName() const {
177 base::win::ScopedCreateDC memory_dc(CreateCompatibleDC(NULL)); 177 base::win::ScopedCreateDC memory_dc(CreateCompatibleDC(NULL));
178 if (!memory_dc.Get()) 178 if (!memory_dc.Get())
179 return GetFontName(); 179 return GetFontName();
180 180
181 // When a font has a localized name for a language matching the system 181 // When a font has a localized name for a language matching the system
182 // locale, GetTextFace() returns the localized name. 182 // locale, GetTextFace() returns the localized name.
183 base::win::ScopedSelectObject font(memory_dc, font_ref_->hfont()); 183 base::win::ScopedSelectObject font(memory_dc.Get(), font_ref_->hfont());
184 wchar_t localized_font_name[LF_FACESIZE]; 184 wchar_t localized_font_name[LF_FACESIZE];
185 int length = GetTextFace(memory_dc, arraysize(localized_font_name), 185 int length = GetTextFace(memory_dc.Get(), arraysize(localized_font_name),
186 &localized_font_name[0]); 186 &localized_font_name[0]);
187 if (length <= 0) 187 if (length <= 0)
188 return GetFontName(); 188 return GetFontName();
189 return base::SysWideToUTF8(localized_font_name); 189 return base::SysWideToUTF8(localized_font_name);
190 } 190 }
191 191
192 int PlatformFontWin::GetFontSize() const { 192 int PlatformFontWin::GetFontSize() const {
193 return font_ref_->font_size(); 193 return font_ref_->font_size();
194 } 194 }
195 195
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 return new PlatformFontWin(native_font); 377 return new PlatformFontWin(native_font);
378 } 378 }
379 379
380 // static 380 // static
381 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, 381 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name,
382 int font_size) { 382 int font_size) {
383 return new PlatformFontWin(font_name, font_size); 383 return new PlatformFontWin(font_name, font_size);
384 } 384 }
385 385
386 } // namespace gfx 386 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/icon_util.cc ('k') | ui/native_theme/native_theme_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698