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

Side by Side Diff: chrome/common/badge_util.cc

Issue 8392017: Change string16 to std::string in the gfx::Font() interface. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add 'UTF-8' everywhere in the comments Created 9 years, 1 month 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 | « chrome/browser/ui/cocoa/status_bubble_mac.mm ('k') | printing/print_settings_initializer.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/common/badge_util.h" 5 #include "chrome/common/badge_util.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "third_party/skia/include/core/SkPaint.h" 9 #include "third_party/skia/include/core/SkPaint.h"
10 #include "third_party/skia/include/core/SkTypeface.h" 10 #include "third_party/skia/include/core/SkTypeface.h"
(...skipping 23 matching lines...) Expand all
34 if (typeface) { 34 if (typeface) {
35 text_paint->setFakeBoldText(true); 35 text_paint->setFakeBoldText(true);
36 } else { 36 } else {
37 // Fall back to the system font. We don't bold it because we aren't sure 37 // Fall back to the system font. We don't bold it because we aren't sure
38 // how it will look. 38 // how it will look.
39 // For the most part this code path will only be hit on Linux systems 39 // For the most part this code path will only be hit on Linux systems
40 // that don't have Arial. 40 // that don't have Arial.
41 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 41 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
42 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); 42 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont);
43 typeface = SkTypeface::CreateFromName( 43 typeface = SkTypeface::CreateFromName(
44 UTF16ToUTF8(base_font.GetFontName()).c_str(), SkTypeface::kNormal); 44 base_font.GetFontName().c_str(), SkTypeface::kNormal);
45 DCHECK(typeface); 45 DCHECK(typeface);
46 } 46 }
47 47
48 text_paint->setTypeface(typeface); 48 text_paint->setTypeface(typeface);
49 // |text_paint| adds its own ref. Release the ref from CreateFontName. 49 // |text_paint| adds its own ref. Release the ref from CreateFontName.
50 typeface->unref(); 50 typeface->unref();
51 } 51 }
52 return text_paint; 52 return text_paint;
53 } 53 }
54 54
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 SkScalar x = (badge_width - text_width)/2; 93 SkScalar x = (badge_width - text_width)/2;
94 SkScalar y = (icon.height() - font_size)/2 + font_size - 1; 94 SkScalar y = (icon.height() - font_size)/2 + font_size - 1;
95 canvas->sk_canvas()->drawText( 95 canvas->sk_canvas()->drawText(
96 badge_text.c_str(), badge_text.size(), x, y, *paint); 96 badge_text.c_str(), badge_text.size(), x, y, *paint);
97 97
98 // Return the generated image. 98 // Return the generated image.
99 return canvas->ExtractBitmap(); 99 return canvas->ExtractBitmap();
100 } 100 }
101 101
102 } // namespace badge_util 102 } // namespace badge_util
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/status_bubble_mac.mm ('k') | printing/print_settings_initializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698