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

Side by Side Diff: cc/heads_up_display_layer.cc

Issue 12603013: Part 10 of cc/ directory shuffles: layers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « cc/heads_up_display_layer.h ('k') | cc/heads_up_display_layer_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "cc/heads_up_display_layer.h"
6
7 #include "base/debug/trace_event.h"
8 #include "cc/heads_up_display_layer_impl.h"
9 #include "cc/trees/layer_tree_host.h"
10
11 namespace cc {
12
13 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create() {
14 return make_scoped_refptr(new HeadsUpDisplayLayer());
15 }
16
17 HeadsUpDisplayLayer::HeadsUpDisplayLayer() : Layer() {
18 SetBounds(gfx::Size(256, 256));
19 }
20
21 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {}
22
23 void HeadsUpDisplayLayer::Update(ResourceUpdateQueue*,
24 const OcclusionTracker*,
25 RenderingStats*) {
26 const LayerTreeDebugState& debug_state = layer_tree_host()->debug_state();
27 int max_texture_size =
28 layer_tree_host()->GetRendererCapabilities().max_texture_size;
29
30 int device_viewport_in_layout_pixels_width =
31 layer_tree_host()->device_viewport_size().width() /
32 layer_tree_host()->device_scale_factor();
33 int device_viewport_in_layout_pixels_height =
34 layer_tree_host()->device_viewport_size().height() /
35 layer_tree_host()->device_scale_factor();
36
37 gfx::Size bounds;
38 gfx::Transform matrix;
39 matrix.MakeIdentity();
40
41 if (debug_state.showPlatformLayerTree || debug_state.showHudRects()) {
42 int width =
43 std::min(max_texture_size, device_viewport_in_layout_pixels_width);
44 int height =
45 std::min(max_texture_size, device_viewport_in_layout_pixels_height);
46 bounds = gfx::Size(width, height);
47 } else {
48 bounds = gfx::Size(256, 256);
49 matrix.Translate(device_viewport_in_layout_pixels_width - 256.0, 0.0);
50 }
51
52 SetBounds(bounds);
53 SetTransform(matrix);
54 }
55
56 bool HeadsUpDisplayLayer::DrawsContent() const { return true; }
57
58 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::CreateLayerImpl(
59 LayerTreeImpl* treeImpl) {
60 return HeadsUpDisplayLayerImpl::Create(treeImpl, layer_id_).
61 PassAs<LayerImpl>();
62 }
63
64 } // namespace cc
OLDNEW
« no previous file with comments | « cc/heads_up_display_layer.h ('k') | cc/heads_up_display_layer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698