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

Side by Side Diff: cc/heads_up_display_layer.cc

Issue 12316005: cc: fix HudLayer to be sized by device (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: temp vars Created 7 years, 10 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 | « no previous file | no next file » | 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/heads_up_display_layer.h" 5 #include "cc/heads_up_display_layer.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "cc/heads_up_display_layer_impl.h" 8 #include "cc/heads_up_display_layer_impl.h"
9 #include "cc/layer_tree_host.h" 9 #include "cc/layer_tree_host.h"
10 10
(...skipping 12 matching lines...) Expand all
23 23
24 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() 24 HeadsUpDisplayLayer::~HeadsUpDisplayLayer()
25 { 25 {
26 } 26 }
27 27
28 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats*) 28 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats*)
29 { 29 {
30 const LayerTreeDebugState& debugState = layerTreeHost()->debugState(); 30 const LayerTreeDebugState& debugState = layerTreeHost()->debugState();
31 int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize; 31 int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize;
32 32
33 int deviceViewportInLayoutPixelsWidth = layerTreeHost()->deviceViewportSize( ).width() / layerTreeHost()->deviceScaleFactor();
34 int deviceViewportInLayoutPixelsHeight = layerTreeHost()->deviceViewportSize ().height() / layerTreeHost()->deviceScaleFactor();
35
33 gfx::Size bounds; 36 gfx::Size bounds;
34 gfx::Transform matrix; 37 gfx::Transform matrix;
35 matrix.MakeIdentity(); 38 matrix.MakeIdentity();
36 39
37 if (debugState.showPlatformLayerTree || debugState.showHudRects()) { 40 if (debugState.showPlatformLayerTree || debugState.showHudRects()) {
38 int width = std::min(maxTextureSize, layerTreeHost()->layoutViewportSize ().width()); 41 int width = std::min(maxTextureSize, deviceViewportInLayoutPixelsWidth);
39 int height = std::min(maxTextureSize, layerTreeHost()->layoutViewportSiz e().height()); 42 int height = std::min(maxTextureSize, deviceViewportInLayoutPixelsHeight );
40 bounds = gfx::Size(width, height); 43 bounds = gfx::Size(width, height);
41 } else { 44 } else {
42 bounds = gfx::Size(256, 256); 45 bounds = gfx::Size(256, 256);
43 matrix.Translate(layerTreeHost()->layoutViewportSize().width() - 256, 0) ; 46 matrix.Translate(deviceViewportInLayoutPixelsWidth - 256, 0);
44 } 47 }
45 48
46 setBounds(bounds); 49 setBounds(bounds);
47 setTransform(matrix); 50 setTransform(matrix);
48 } 51 }
49 52
50 bool HeadsUpDisplayLayer::drawsContent() const 53 bool HeadsUpDisplayLayer::drawsContent() const
51 { 54 {
52 return true; 55 return true;
53 } 56 }
54 57
55 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl(LayerTreeImpl* treeIm pl) 58 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl(LayerTreeImpl* treeIm pl)
56 { 59 {
57 return HeadsUpDisplayLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl >(); 60 return HeadsUpDisplayLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl >();
58 } 61 }
59 62
60 } // namespace cc 63 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698