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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 // TODO(danakj): Scale the HUD by deviceScale to make it more friendly under
high DPI. | 74 // TODO(danakj): Scale the HUD by deviceScale to make it more friendly under
high DPI. |
75 | 75 |
76 // TODO(danakj): The HUD could swap between two textures instead of creating
a texture every frame in ubercompositor. | 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 if (m_hudTexture->size() != bounds() || resourceProvider->inUseByConsumer(m_
hudTexture->id())) |
78 m_hudTexture->Free(); | 78 m_hudTexture->Free(); |
79 | 79 |
80 if (!m_hudTexture->id()) | 80 if (!m_hudTexture->id()) { |
81 m_hudTexture->Allocate(bounds(), GL_RGBA, ResourceProvider::TextureUsage
Any); | 81 m_hudTexture->Allocate(bounds(), GL_RGBA, ResourceProvider::TextureUsage
Any); |
| 82 // TODO(epenner): This texture was being used before setPixels was calle
d, |
| 83 // which is now not allowed (it's an uninitialized read). This should be
fixed |
| 84 // and this allocateForTesting() removed. |
| 85 // http://crbug.com/166784 |
| 86 resourceProvider->allocateForTesting(m_hudTexture->id()); |
| 87 } |
82 } | 88 } |
83 | 89 |
84 void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a
ppendQuadsData) | 90 void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a
ppendQuadsData) |
85 { | 91 { |
86 if (!m_hudTexture->id()) | 92 if (!m_hudTexture->id()) |
87 return; | 93 return; |
88 | 94 |
89 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ
uadState()); | 95 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ
uadState()); |
90 | 96 |
91 gfx::Rect quadRect(gfx::Point(), bounds()); | 97 gfx::Rect quadRect(gfx::Point(), bounds()); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 383 |
378 canvas->restore(); | 384 canvas->restore(); |
379 } | 385 } |
380 | 386 |
381 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const | 387 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const |
382 { | 388 { |
383 return "HeadsUpDisplayLayer"; | 389 return "HeadsUpDisplayLayer"; |
384 } | 390 } |
385 | 391 |
386 } // namespace cc | 392 } // namespace cc |
OLD | NEW |