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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 // FIXME: Scale the HUD by deviceScale to make it more friendly under high D PI. |
75 | 75 |
76 if (m_hudTexture->size() != bounds()) | 76 if (m_hudTexture->size() != bounds()) |
77 m_hudTexture->Free(); | 77 m_hudTexture->Free(); |
78 | 78 |
79 if (!m_hudTexture->id()) | 79 if (!m_hudTexture->id()) { |
80 m_hudTexture->Allocate(bounds(), GL_RGBA, ResourceProvider::TextureUsage Any); | 80 m_hudTexture->Allocate(bounds(), GL_RGBA, ResourceProvider::TextureUsage Any); |
81 // TODO(epenner): This texture was being used before setPixels was calle d, | |
piman
2012/12/19 00:45:49
nit: file a bug to clean up?
It sounds like the a
| |
82 // which is now not allowed (it's an uninitialized read). This should be fixed | |
83 // and this allocateForTesting() removed. | |
84 resourceProvider->allocateForTesting(m_hudTexture->id()); | |
85 } | |
81 } | 86 } |
82 | 87 |
83 void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a ppendQuadsData) | 88 void HeadsUpDisplayLayerImpl::appendQuads(QuadSink& quadSink, AppendQuadsData& a ppendQuadsData) |
84 { | 89 { |
85 if (!m_hudTexture->id()) | 90 if (!m_hudTexture->id()) |
86 return; | 91 return; |
87 | 92 |
88 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ uadState()); | 93 SharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createSharedQ uadState()); |
89 | 94 |
90 gfx::Rect quadRect(gfx::Point(), bounds()); | 95 gfx::Rect quadRect(gfx::Point(), bounds()); |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
376 | 381 |
377 canvas->restore(); | 382 canvas->restore(); |
378 } | 383 } |
379 | 384 |
380 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const | 385 const char* HeadsUpDisplayLayerImpl::layerTypeAsString() const |
381 { | 386 { |
382 return "HeadsUpDisplayLayer"; | 387 return "HeadsUpDisplayLayer"; |
383 } | 388 } |
384 | 389 |
385 } // namespace cc | 390 } // namespace cc |
OLD | NEW |