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/heads_up_display_layer_impl.h" | 5 #include "cc/heads_up_display_layer_impl.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
10 #include "cc/debug_colors.h" | 10 #include "cc/debug_colors.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 m_fontAtlas = fontAtlas.Pass(); | 64 m_fontAtlas = fontAtlas.Pass(); |
65 } | 65 } |
66 | 66 |
67 void HeadsUpDisplayLayerImpl::willDraw(ResourceProvider* resourceProvider) | 67 void HeadsUpDisplayLayerImpl::willDraw(ResourceProvider* resourceProvider) |
68 { | 68 { |
69 LayerImpl::willDraw(resourceProvider); | 69 LayerImpl::willDraw(resourceProvider); |
70 | 70 |
71 if (!m_hudTexture) | 71 if (!m_hudTexture) |
72 m_hudTexture = ScopedResource::create(resourceProvider); | 72 m_hudTexture = ScopedResource::create(resourceProvider); |
73 | 73 |
74 // FIXME: Scale the HUD by deviceScale to make it more friendly under high D
PI. | 74 // TODO(danakj): Scale the HUD by deviceScale to make it more friendly under
high DPI. |
75 | 75 |
76 if (m_hudTexture->size() != bounds()) | 76 // TODO(danakj): The HUD could swap between two textures instead of creating
a texture every frame in ubercompositor. |
| 77 if (m_hudTexture->size() != bounds() || resourceProvider->inUseByConsumer(m_
hudTexture->id())) |
77 m_hudTexture->Free(); | 78 m_hudTexture->Free(); |
78 | 79 |
79 if (!m_hudTexture->id()) | 80 if (!m_hudTexture->id()) |
80 m_hudTexture->Allocate(bounds(), GL_RGBA, ResourceProvider::TextureUsage
Any); | 81 m_hudTexture->Allocate(bounds(), GL_RGBA, ResourceProvider::TextureUsage
Any); |
81 } | 82 } |
82 | 83 |
83 void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a
ppendQuadsData) | 84 void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a
ppendQuadsData) |
84 { | 85 { |
85 if (!m_hudTexture->id()) | 86 if (!m_hudTexture->id()) |
86 return; | 87 return; |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
376 | 377 |
377 canvas->restore(); | 378 canvas->restore(); |
378 } | 379 } |
379 | 380 |
380 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const | 381 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const |
381 { | 382 { |
382 return "HeadsUpDisplayLayer"; | 383 return "HeadsUpDisplayLayer"; |
383 } | 384 } |
384 | 385 |
385 } // namespace cc | 386 } // namespace cc |
OLD | NEW |