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/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 if (!hud_resource_) | 87 if (!hud_resource_) |
88 hud_resource_ = ScopedResource::create(resource_provider); | 88 hud_resource_ = ScopedResource::create(resource_provider); |
89 | 89 |
90 // TODO(danakj): The HUD could swap between two textures instead of creating a | 90 // TODO(danakj): The HUD could swap between two textures instead of creating a |
91 // texture every frame in ubercompositor. | 91 // texture every frame in ubercompositor. |
92 if (hud_resource_->size() != content_bounds() || | 92 if (hud_resource_->size() != content_bounds() || |
93 resource_provider->InUseByConsumer(hud_resource_->id())) | 93 resource_provider->InUseByConsumer(hud_resource_->id())) |
94 hud_resource_->Free(); | 94 hud_resource_->Free(); |
95 | 95 |
96 if (!hud_resource_->id()) { | 96 if (!hud_resource_->id()) { |
97 hud_resource_->Allocate( | 97 hud_resource_->Allocate(content_bounds(), |
98 content_bounds(), GL_RGBA, ResourceProvider::TextureUsageAny); | 98 ResourceProvider::TextureUsageAny, |
| 99 RGBA_8888); |
99 } | 100 } |
100 | 101 |
101 return LayerImpl::WillDraw(draw_mode, resource_provider); | 102 return LayerImpl::WillDraw(draw_mode, resource_provider); |
102 } | 103 } |
103 | 104 |
104 void HeadsUpDisplayLayerImpl::AppendQuads(QuadSink* quad_sink, | 105 void HeadsUpDisplayLayerImpl::AppendQuads(QuadSink* quad_sink, |
105 AppendQuadsData* append_quads_data) { | 106 AppendQuadsData* append_quads_data) { |
106 if (!hud_resource_->id()) | 107 if (!hud_resource_->id()) |
107 return; | 108 return; |
108 | 109 |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 canvas->restore(); | 688 canvas->restore(); |
688 } | 689 } |
689 } | 690 } |
690 } | 691 } |
691 | 692 |
692 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { | 693 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { |
693 return "cc::HeadsUpDisplayLayerImpl"; | 694 return "cc::HeadsUpDisplayLayerImpl"; |
694 } | 695 } |
695 | 696 |
696 } // namespace cc | 697 } // namespace cc |
OLD | NEW |