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 "base/stringprintf.h" | 7 #include "base/stringprintf.h" |
8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
9 #include "cc/debug/debug_colors.h" | 9 #include "cc/debug/debug_colors.h" |
10 #include "cc/debug/debug_rect_history.h" | 10 #include "cc/debug/debug_rect_history.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 LayerTreeImpl* tree_impl) { | 78 LayerTreeImpl* tree_impl) { |
79 return HeadsUpDisplayLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 79 return HeadsUpDisplayLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
80 } | 80 } |
81 | 81 |
82 void HeadsUpDisplayLayerImpl::WillDraw(ResourceProvider* resource_provider) { | 82 void HeadsUpDisplayLayerImpl::WillDraw(ResourceProvider* resource_provider) { |
83 LayerImpl::WillDraw(resource_provider); | 83 LayerImpl::WillDraw(resource_provider); |
84 | 84 |
85 if (!hud_texture_) | 85 if (!hud_texture_) |
86 hud_texture_ = ScopedResource::create(resource_provider); | 86 hud_texture_ = ScopedResource::create(resource_provider); |
87 | 87 |
88 // TODO(danakj): Scale the HUD by deviceScale to make it more friendly under | 88 // TODO(danakj): Scale the HUD by device scale to make it more friendly under |
89 // high DPI. | 89 // high DPI. |
90 | 90 |
91 // TODO(danakj): The HUD could swap between two textures instead of creating a | 91 // TODO(danakj): The HUD could swap between two textures instead of creating a |
92 // texture every frame in ubercompositor. | 92 // texture every frame in ubercompositor. |
93 if (hud_texture_->size() != bounds() || | 93 if (hud_texture_->size() != bounds() || |
94 resource_provider->InUseByConsumer(hud_texture_->id())) | 94 resource_provider->InUseByConsumer(hud_texture_->id())) |
95 hud_texture_->Free(); | 95 hud_texture_->Free(); |
96 | 96 |
97 if (!hud_texture_->id()) { | 97 if (!hud_texture_->id()) { |
98 hud_texture_->Allocate( | 98 hud_texture_->Allocate( |
(...skipping 589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
688 } | 688 } |
689 | 689 |
690 canvas->restore(); | 690 canvas->restore(); |
691 } | 691 } |
692 | 692 |
693 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { | 693 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { |
694 return "HeadsUpDisplayLayer"; | 694 return "HeadsUpDisplayLayer"; |
695 } | 695 } |
696 | 696 |
697 } // namespace cc | 697 } // namespace cc |
OLD | NEW |