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

Side by Side Diff: cc/layers/heads_up_display_layer.cc

Issue 1819753003: Allow various font weights in gfx. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixes for review issues. Created 4 years, 9 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "cc/layers/heads_up_display_layer.h" 5 #include "cc/layers/heads_up_display_layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "cc/layers/heads_up_display_layer_impl.h" 10 #include "cc/layers/heads_up_display_layer_impl.h"
11 #include "cc/proto/layer.pb.h" 11 #include "cc/proto/layer.pb.h"
12 #include "cc/trees/layer_tree_host.h" 12 #include "cc/trees/layer_tree_host.h"
13 13
14 namespace cc { 14 namespace cc {
15 15
16 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create( 16 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create(
17 const LayerSettings& settings) { 17 const LayerSettings& settings) {
18 return make_scoped_refptr(new HeadsUpDisplayLayer(settings)); 18 return make_scoped_refptr(new HeadsUpDisplayLayer(settings));
19 } 19 }
20 20
21 HeadsUpDisplayLayer::HeadsUpDisplayLayer(const LayerSettings& settings) 21 HeadsUpDisplayLayer::HeadsUpDisplayLayer(const LayerSettings& settings)
22 : Layer(settings), 22 : Layer(settings),
23 typeface_(skia::AdoptRef( 23 typeface_(skia::AdoptRef(
24 SkTypeface::CreateFromName("times new roman", SkTypeface::kNormal))) { 24 SkTypeface::CreateFromName("times new roman", SkFontStyle()))) {
25 if (!typeface_) { 25 if (!typeface_) {
26 typeface_ = skia::AdoptRef( 26 const SkFontStyle style(SkFontStyle::kBold_Weight,
27 SkTypeface::CreateFromName("monospace", SkTypeface::kBold)); 27 SkFontStyle::kNormal_Weight,
msw 2016/03/22 18:24:10 Shouldn't this param be a width, not a weight?
Mikus 2016/03/23 17:53:21 Done.
28 SkFontStyle::kUpright_Slant);
29 typeface_ = skia::AdoptRef(SkTypeface::CreateFromName("monospace", style));
28 } 30 }
29 DCHECK(typeface_.get()); 31 DCHECK(typeface_.get());
30 SetIsDrawable(true); 32 SetIsDrawable(true);
31 UpdateDrawsContent(HasDrawableContent()); 33 UpdateDrawsContent(HasDrawableContent());
32 } 34 }
33 35
34 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {} 36 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {}
35 37
36 void HeadsUpDisplayLayer::PrepareForCalculateDrawProperties( 38 void HeadsUpDisplayLayer::PrepareForCalculateDrawProperties(
37 const gfx::Size& device_viewport, float device_scale_factor) { 39 const gfx::Size& device_viewport, float device_scale_factor) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void HeadsUpDisplayLayer::PushPropertiesTo(LayerImpl* layer) { 79 void HeadsUpDisplayLayer::PushPropertiesTo(LayerImpl* layer) {
78 Layer::PushPropertiesTo(layer); 80 Layer::PushPropertiesTo(layer);
79 TRACE_EVENT0("cc", "HeadsUpDisplayLayer::PushPropertiesTo"); 81 TRACE_EVENT0("cc", "HeadsUpDisplayLayer::PushPropertiesTo");
80 HeadsUpDisplayLayerImpl* layer_impl = 82 HeadsUpDisplayLayerImpl* layer_impl =
81 static_cast<HeadsUpDisplayLayerImpl*>(layer); 83 static_cast<HeadsUpDisplayLayerImpl*>(layer);
82 84
83 layer_impl->SetHUDTypeface(typeface_); 85 layer_impl->SetHUDTypeface(typeface_);
84 } 86 }
85 87
86 } // namespace cc 88 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/autofill/autofill_popup_controller_impl.cc » ('j') | ui/base/resource/resource_bundle.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698