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

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

Issue 10332002: win: Fix a few minor issues found by clang. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 7 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 | « sandbox/src/target_process.cc ('k') | ui/views/widget/monitor_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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 base_font_ref_->AddRef(); 215 base_font_ref_->AddRef();
216 } 216 }
217 return base_font_ref_; 217 return base_font_ref_;
218 } 218 }
219 219
220 PlatformFontWin::HFontRef* PlatformFontWin::CreateHFontRef(HFONT font) { 220 PlatformFontWin::HFontRef* PlatformFontWin::CreateHFontRef(HFONT font) {
221 TEXTMETRIC font_metrics; 221 TEXTMETRIC font_metrics;
222 222
223 { 223 {
224 base::win::ScopedGetDC screen_dc(NULL); 224 base::win::ScopedGetDC screen_dc(NULL);
225 base::win::ScopedSelectObject font(screen_dc, font); 225 base::win::ScopedSelectObject scoped_font(screen_dc, font);
226 ui::ScopedSetMapMode mode(screen_dc, MM_TEXT); 226 ui::ScopedSetMapMode mode(screen_dc, MM_TEXT);
227 GetTextMetrics(screen_dc, &font_metrics); 227 GetTextMetrics(screen_dc, &font_metrics);
228 } 228 }
229 229
230 const int height = std::max<int>(1, font_metrics.tmHeight); 230 const int height = std::max<int>(1, font_metrics.tmHeight);
231 const int baseline = std::max<int>(1, font_metrics.tmAscent); 231 const int baseline = std::max<int>(1, font_metrics.tmAscent);
232 const int ave_char_width = std::max<int>(1, font_metrics.tmAveCharWidth); 232 const int ave_char_width = std::max<int>(1, font_metrics.tmAveCharWidth);
233 const int font_size = 233 const int font_size =
234 std::max<int>(1, font_metrics.tmHeight - font_metrics.tmInternalLeading); 234 std::max<int>(1, font_metrics.tmHeight - font_metrics.tmInternalLeading);
235 int style = 0; 235 int style = 0;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 return new PlatformFontWin(native_font); 309 return new PlatformFontWin(native_font);
310 } 310 }
311 311
312 // static 312 // static
313 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name, 313 PlatformFont* PlatformFont::CreateFromNameAndSize(const std::string& font_name,
314 int font_size) { 314 int font_size) {
315 return new PlatformFontWin(font_name, font_size); 315 return new PlatformFontWin(font_name, font_size);
316 } 316 }
317 317
318 } // namespace gfx 318 } // namespace gfx
OLDNEW
« no previous file with comments | « sandbox/src/target_process.cc ('k') | ui/views/widget/monitor_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698