| Index: cc/layers/heads_up_display_layer_impl.cc
|
| diff --git a/cc/layers/heads_up_display_layer_impl.cc b/cc/layers/heads_up_display_layer_impl.cc
|
| index cdb000ffa17a18560359c8729672c9e4fe9dd846..3eba051e46a093ba665242839218b54a2d247f50 100644
|
| --- a/cc/layers/heads_up_display_layer_impl.cc
|
| +++ b/cc/layers/heads_up_display_layer_impl.cc
|
| @@ -67,19 +67,21 @@ double HeadsUpDisplayLayerImpl::Graph::UpdateUpperBound() {
|
| }
|
|
|
| HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(LayerTreeImpl* tree_impl,
|
| - int id)
|
| + int id,
|
| + SkTypeface* typeface)
|
| : LayerImpl(tree_impl, id),
|
| - typeface_(skia::AdoptRef(
|
| - SkTypeface::CreateFromName("monospace", SkTypeface::kBold))),
|
| + hud_canvas_(nullptr),
|
| + typeface_(typeface),
|
| fps_graph_(60.0, 80.0),
|
| paint_time_graph_(16.0, 48.0),
|
| - fade_step_(0) {}
|
| + fade_step_(0) {
|
| +}
|
|
|
| HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {}
|
|
|
| scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl(
|
| LayerTreeImpl* tree_impl) {
|
| - return HeadsUpDisplayLayerImpl::Create(tree_impl, id());
|
| + return HeadsUpDisplayLayerImpl::Create(tree_impl, id(), typeface_);
|
| }
|
|
|
| void HeadsUpDisplayLayerImpl::AcquireResource(
|
| @@ -181,9 +183,10 @@ void HeadsUpDisplayLayerImpl::UpdateHudTexture(
|
| if (canvas_size.width() != content_bounds().width() ||
|
| canvas_size.height() != content_bounds().height() || !hud_canvas_) {
|
| TRACE_EVENT0("cc", "ResizeHudCanvas");
|
| - bool opaque = false;
|
| - hud_canvas_ = make_scoped_ptr(skia::CreateBitmapCanvas(
|
| - content_bounds().width(), content_bounds().height(), opaque));
|
| +
|
| + hud_surface_ = skia::AdoptRef(SkSurface::NewRasterN32Premul(
|
| + content_bounds().width(), content_bounds().height()));
|
| + hud_canvas_ = hud_surface_->getCanvas();
|
| }
|
|
|
| UpdateHudContents();
|
| @@ -194,7 +197,7 @@ void HeadsUpDisplayLayerImpl::UpdateHudTexture(
|
| hud_canvas_->save();
|
| hud_canvas_->scale(contents_scale_x(), contents_scale_y());
|
|
|
| - DrawHudContents(hud_canvas_.get());
|
| + DrawHudContents(hud_canvas_);
|
|
|
| hud_canvas_->restore();
|
| }
|
| @@ -300,7 +303,7 @@ void HeadsUpDisplayLayerImpl::DrawText(SkCanvas* canvas,
|
|
|
| paint->setTextSize(size);
|
| paint->setTextAlign(align);
|
| - paint->setTypeface(typeface_.get());
|
| + paint->setTypeface(typeface_);
|
| canvas->drawText(text.c_str(), text.length(), x, y, *paint);
|
|
|
| paint->setAntiAlias(anti_alias);
|
| @@ -706,7 +709,7 @@ void HeadsUpDisplayLayerImpl::DrawDebugRect(
|
|
|
| SkPaint label_paint = CreatePaint();
|
| label_paint.setTextSize(kFontHeight);
|
| - label_paint.setTypeface(typeface_.get());
|
| + label_paint.setTypeface(typeface_);
|
| label_paint.setColor(stroke_color);
|
|
|
| const SkScalar label_text_width =
|
|
|