OLD | NEW |
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/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/trace_event/trace_event.h" | 12 #include "base/trace_event/trace_event.h" |
13 #include "base/trace_event/trace_event_argument.h" | 13 #include "base/trace_event/trace_event_argument.h" |
14 #include "cc/debug/debug_colors.h" | 14 #include "cc/debug/debug_colors.h" |
15 #include "cc/debug/frame_rate_counter.h" | 15 #include "cc/debug/frame_rate_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/skia/include/core/SkCanvas.h" |
23 #include "third_party/skia/include/core/SkPaint.h" | 24 #include "third_party/skia/include/core/SkPaint.h" |
24 #include "third_party/skia/include/core/SkPath.h" | 25 #include "third_party/skia/include/core/SkPath.h" |
25 #include "third_party/skia/include/core/SkRRect.h" | |
26 #include "third_party/skia/include/core/SkTypeface.h" | 26 #include "third_party/skia/include/core/SkTypeface.h" |
27 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" | 27 #include "third_party/skia/include/effects/SkColorMatrixFilter.h" |
28 #include "third_party/skia/include/effects/SkGradientShader.h" | 28 #include "third_party/skia/include/effects/SkGradientShader.h" |
29 #include "ui/gfx/geometry/point.h" | 29 #include "ui/gfx/geometry/point.h" |
30 #include "ui/gfx/geometry/size.h" | 30 #include "ui/gfx/geometry/size.h" |
31 #include "ui/gfx/geometry/size_conversions.h" | 31 #include "ui/gfx/geometry/size_conversions.h" |
32 #include "ui/gfx/hud_font.h" | 32 #include "ui/gfx/hud_font.h" |
33 | 33 |
34 namespace cc { | 34 namespace cc { |
35 | 35 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 } | 167 } |
168 | 168 |
169 void HeadsUpDisplayLayerImpl::UpdateHudTexture( | 169 void HeadsUpDisplayLayerImpl::UpdateHudTexture( |
170 DrawMode draw_mode, | 170 DrawMode draw_mode, |
171 ResourceProvider* resource_provider) { | 171 ResourceProvider* resource_provider) { |
172 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE || !resources_.back()->id()) | 172 if (draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE || !resources_.back()->id()) |
173 return; | 173 return; |
174 | 174 |
175 SkISize canvas_size; | 175 SkISize canvas_size; |
176 if (hud_surface_) | 176 if (hud_surface_) |
177 canvas_size = hud_surface_->getCanvas()->getDeviceSize(); | 177 canvas_size = hud_surface_->getCanvas()->getBaseLayerSize(); |
178 else | 178 else |
179 canvas_size.set(0, 0); | 179 canvas_size.set(0, 0); |
180 | 180 |
181 if (canvas_size.width() != internal_content_bounds_.width() || | 181 if (canvas_size.width() != internal_content_bounds_.width() || |
182 canvas_size.height() != internal_content_bounds_.height() || | 182 canvas_size.height() != internal_content_bounds_.height() || |
183 !hud_surface_) { | 183 !hud_surface_) { |
184 TRACE_EVENT0("cc", "ResizeHudCanvas"); | 184 TRACE_EVENT0("cc", "ResizeHudCanvas"); |
185 | 185 |
186 hud_surface_ = skia::AdoptRef(SkSurface::NewRasterN32Premul( | 186 hud_surface_ = skia::AdoptRef(SkSurface::NewRasterN32Premul( |
187 internal_content_bounds_.width(), internal_content_bounds_.height())); | 187 internal_content_bounds_.width(), internal_content_bounds_.height())); |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
791 return "cc::HeadsUpDisplayLayerImpl"; | 791 return "cc::HeadsUpDisplayLayerImpl"; |
792 } | 792 } |
793 | 793 |
794 void HeadsUpDisplayLayerImpl::AsValueInto( | 794 void HeadsUpDisplayLayerImpl::AsValueInto( |
795 base::trace_event::TracedValue* dict) const { | 795 base::trace_event::TracedValue* dict) const { |
796 LayerImpl::AsValueInto(dict); | 796 LayerImpl::AsValueInto(dict); |
797 dict->SetString("layer_name", "Heads Up Display Layer"); | 797 dict->SetString("layer_name", "Heads Up Display Layer"); |
798 } | 798 } |
799 | 799 |
800 } // namespace cc | 800 } // namespace cc |
OLD | NEW |