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

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

Issue 1001833005: Update from https://crrev.com/320343 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Supress Created 5 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
« no previous file with comments | « cc/layers/draw_properties.h ('k') | cc/layers/io_surface_layer_impl.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 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_impl.h" 5 #include "cc/layers/heads_up_display_layer_impl.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "base/trace_event/trace_event_argument.h" 12 #include "base/trace_event/trace_event_argument.h"
13 #include "cc/debug/debug_colors.h" 13 #include "cc/debug/debug_colors.h"
14 #include "cc/debug/frame_rate_counter.h" 14 #include "cc/debug/frame_rate_counter.h"
15 #include "cc/debug/paint_time_counter.h" 15 #include "cc/debug/paint_time_counter.h"
16 #include "cc/output/begin_frame_args.h" 16 #include "cc/output/begin_frame_args.h"
17 #include "cc/output/renderer.h" 17 #include "cc/output/renderer.h"
18 #include "cc/quads/texture_draw_quad.h" 18 #include "cc/quads/texture_draw_quad.h"
19 #include "cc/resources/memory_history.h" 19 #include "cc/resources/memory_history.h"
20 #include "cc/trees/layer_tree_host_impl.h" 20 #include "cc/trees/layer_tree_host_impl.h"
21 #include "cc/trees/layer_tree_impl.h" 21 #include "cc/trees/layer_tree_impl.h"
22 #include "skia/ext/platform_canvas.h" 22 #include "skia/ext/platform_canvas.h"
23 #include "third_party/khronos/GLES2/gl2.h"
24 #include "third_party/khronos/GLES2/gl2ext.h"
25 #include "third_party/skia/include/core/SkBitmap.h"
26 #include "third_party/skia/include/core/SkPaint.h" 23 #include "third_party/skia/include/core/SkPaint.h"
27 #include "third_party/skia/include/core/SkTypeface.h" 24 #include "third_party/skia/include/core/SkTypeface.h"
28 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" 25 #include "third_party/skia/include/effects/SkColorMatrixFilter.h"
29 #include "ui/gfx/geometry/point.h" 26 #include "ui/gfx/geometry/point.h"
30 #include "ui/gfx/geometry/size.h" 27 #include "ui/gfx/geometry/size.h"
31 #include "ui/gfx/geometry/size_conversions.h" 28 #include "ui/gfx/geometry/size_conversions.h"
29 #include "ui/gfx/hud_font.h"
32 30
33 namespace cc { 31 namespace cc {
34 32
35 static inline SkPaint CreatePaint() { 33 static inline SkPaint CreatePaint() {
36 SkPaint paint; 34 SkPaint paint;
37 #if (SK_R32_SHIFT || SK_B32_SHIFT != 16) 35 #if (SK_R32_SHIFT || SK_B32_SHIFT != 16)
38 // The SkCanvas is in RGBA but the shader is expecting BGRA, so we need to 36 // The SkCanvas is in RGBA but the shader is expecting BGRA, so we need to
39 // swizzle our colors when drawing to the SkCanvas. 37 // swizzle our colors when drawing to the SkCanvas.
40 SkColorMatrix swizzle_matrix; 38 SkColorMatrix swizzle_matrix;
41 for (int i = 0; i < 20; ++i) 39 for (int i = 0; i < 20; ++i)
(...skipping 21 matching lines...) Expand all
63 61
64 double HeadsUpDisplayLayerImpl::Graph::UpdateUpperBound() { 62 double HeadsUpDisplayLayerImpl::Graph::UpdateUpperBound() {
65 double target_upper_bound = std::max(max, default_upper_bound); 63 double target_upper_bound = std::max(max, default_upper_bound);
66 current_upper_bound += (target_upper_bound - current_upper_bound) * 0.5; 64 current_upper_bound += (target_upper_bound - current_upper_bound) * 0.5;
67 return current_upper_bound; 65 return current_upper_bound;
68 } 66 }
69 67
70 HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(LayerTreeImpl* tree_impl, 68 HeadsUpDisplayLayerImpl::HeadsUpDisplayLayerImpl(LayerTreeImpl* tree_impl,
71 int id) 69 int id)
72 : LayerImpl(tree_impl, id), 70 : LayerImpl(tree_impl, id),
73 typeface_(skia::AdoptRef( 71 typeface_(gfx::GetHudTypeface()),
74 SkTypeface::CreateFromName("monospace", SkTypeface::kBold))),
75 internal_contents_scale_(1.f), 72 internal_contents_scale_(1.f),
76 fps_graph_(60.0, 80.0), 73 fps_graph_(60.0, 80.0),
77 paint_time_graph_(16.0, 48.0), 74 paint_time_graph_(16.0, 48.0),
78 fade_step_(0) { 75 fade_step_(0) {
76 if (!typeface_) {
77 typeface_ = skia::AdoptRef(
78 SkTypeface::CreateFromName("monospace", SkTypeface::kBold));
79 }
79 } 80 }
80 81
81 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {} 82 HeadsUpDisplayLayerImpl::~HeadsUpDisplayLayerImpl() {}
82 83
83 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl( 84 scoped_ptr<LayerImpl> HeadsUpDisplayLayerImpl::CreateLayerImpl(
84 LayerTreeImpl* tree_impl) { 85 LayerTreeImpl* tree_impl) {
85 return HeadsUpDisplayLayerImpl::Create(tree_impl, id()); 86 return HeadsUpDisplayLayerImpl::Create(tree_impl, id());
86 } 87 }
87 88
88 void HeadsUpDisplayLayerImpl::AcquireResource( 89 void HeadsUpDisplayLayerImpl::AcquireResource(
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 return "cc::HeadsUpDisplayLayerImpl"; 835 return "cc::HeadsUpDisplayLayerImpl";
835 } 836 }
836 837
837 void HeadsUpDisplayLayerImpl::AsValueInto( 838 void HeadsUpDisplayLayerImpl::AsValueInto(
838 base::trace_event::TracedValue* dict) const { 839 base::trace_event::TracedValue* dict) const {
839 LayerImpl::AsValueInto(dict); 840 LayerImpl::AsValueInto(dict);
840 dict->SetString("layer_name", "Heads Up Display Layer"); 841 dict->SetString("layer_name", "Heads Up Display Layer");
841 } 842 }
842 843
843 } // namespace cc 844 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/draw_properties.h ('k') | cc/layers/io_surface_layer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698