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

Side by Side Diff: chrome/browser/ui/extensions/icon_with_badge_image_source.cc

Issue 2066323002: Remove SK_SUPPORT_LEGACY_TYPEFACE_PTR (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: moar Mac fixes Created 4 years, 6 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 | « cc/layers/heads_up_display_layer.cc ('k') | media/blink/webmediaplayer_cast_android.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 "chrome/browser/ui/extensions/icon_with_badge_image_source.h" 5 #include "chrome/browser/ui/extensions/icon_with_badge_image_source.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 // typeface will be NULL. If we don't do manual fallback then we'll crash. 75 // typeface will be NULL. If we don't do manual fallback then we'll crash.
76 if (typeface) { 76 if (typeface) {
77 text_paint->setFakeBoldText(true); 77 text_paint->setFakeBoldText(true);
78 } else { 78 } else {
79 // Fall back to the system font. We don't bold it because we aren't sure 79 // Fall back to the system font. We don't bold it because we aren't sure
80 // how it will look. 80 // how it will look.
81 // For the most part this code path will only be hit on Linux systems 81 // For the most part this code path will only be hit on Linux systems
82 // that don't have Arial. 82 // that don't have Arial.
83 ResourceBundle& rb = ResourceBundle::GetSharedInstance(); 83 ResourceBundle& rb = ResourceBundle::GetSharedInstance();
84 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont); 84 const gfx::Font& base_font = rb.GetFont(ResourceBundle::BaseFont);
85 typeface = sk_sp<SkTypeface>(SkTypeface::MakeFromName( 85 typeface = SkTypeface::MakeFromName(base_font.GetFontName().c_str(),
86 base_font.GetFontName().c_str(), SkFontStyle())); 86 SkFontStyle());
87 DCHECK(typeface); 87 DCHECK(typeface);
88 } 88 }
89 89
90 text_paint->setTypeface(typeface.get()); 90 text_paint->setTypeface(std::move(typeface));
91 // |text_paint| adds its own ref. Release the ref from CreateFontName.
92 } 91 }
93 return text_paint; 92 return text_paint;
94 } 93 }
95 94
96 gfx::ImageSkiaRep ScaleImageSkiaRep(const gfx::ImageSkiaRep& rep, 95 gfx::ImageSkiaRep ScaleImageSkiaRep(const gfx::ImageSkiaRep& rep,
97 int target_width_dp, 96 int target_width_dp,
98 float target_scale) { 97 float target_scale) {
99 int width_px = target_width_dp * target_scale; 98 int width_px = target_width_dp * target_scale;
100 return gfx::ImageSkiaRep( 99 return gfx::ImageSkiaRep(
101 skia::ImageOperations::Resize(rep.sk_bitmap(), 100 skia::ImageOperations::Resize(rep.sk_bitmap(),
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 } 306 }
308 307
309 void IconWithBadgeImageSource::PaintBlockedActionDecoration( 308 void IconWithBadgeImageSource::PaintBlockedActionDecoration(
310 gfx::Canvas* canvas) { 309 gfx::Canvas* canvas) {
311 canvas->Save(); 310 canvas->Save();
312 gfx::ImageSkia img = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed( 311 gfx::ImageSkia img = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
313 IDR_BLOCKED_EXTENSION_SCRIPT); 312 IDR_BLOCKED_EXTENSION_SCRIPT);
314 canvas->DrawImageInt(img, size().width() - img.width(), 0); 313 canvas->DrawImageInt(img, size().width() - img.width(), 0);
315 canvas->Restore(); 314 canvas->Restore();
316 } 315 }
OLDNEW
« no previous file with comments | « cc/layers/heads_up_display_layer.cc ('k') | media/blink/webmediaplayer_cast_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698