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 "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "CCHeadsUpDisplayLayerImpl.h" | 7 #include "CCHeadsUpDisplayLayerImpl.h" |
8 | 8 |
9 #include "CCDebugRectHistory.h" | 9 #include "CCDebugRectHistory.h" |
10 #include "CCFontAtlas.h" | 10 #include "CCFontAtlas.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // FIXME: Scale the HUD by deviceScale to make it more friendly under high D
PI. | 63 // FIXME: Scale the HUD by deviceScale to make it more friendly under high D
PI. |
64 | 64 |
65 if (m_hudTexture->size() != bounds()) | 65 if (m_hudTexture->size() != bounds()) |
66 m_hudTexture->free(); | 66 m_hudTexture->free(); |
67 | 67 |
68 if (!m_hudTexture->id()) | 68 if (!m_hudTexture->id()) |
69 m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GraphicsContext3D
::RGBA, CCResourceProvider::TextureUsageAny); | 69 m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GraphicsContext3D
::RGBA, CCResourceProvider::TextureUsageAny); |
70 } | 70 } |
71 | 71 |
72 void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadSink, bool&) | 72 void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsD
ata& appendQuadsData) |
73 { | 73 { |
74 if (!m_hudTexture->id()) | 74 if (!m_hudTexture->id()) |
75 return; | 75 return; |
76 | 76 |
77 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createShare
dQuadState()); | 77 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createShare
dQuadState()); |
78 | 78 |
79 IntRect quadRect(IntPoint(), bounds()); | 79 IntRect quadRect(IntPoint(), bounds()); |
80 bool premultipliedAlpha = true; | 80 bool premultipliedAlpha = true; |
81 FloatRect uvRect(0, 0, 1, 1); | 81 FloatRect uvRect(0, 0, 1, 1); |
82 bool flipped = false; | 82 bool flipped = false; |
83 quadSink.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_hudTe
xture->id(), premultipliedAlpha, uvRect, flipped)); | 83 quadSink.append(CCTextureDrawQuad::create(sharedQuadState, quadRect, m_hudTe
xture->id(), premultipliedAlpha, uvRect, flipped), appendQuadsData); |
84 } | 84 } |
85 | 85 |
86 void CCHeadsUpDisplayLayerImpl::updateHudTexture(CCResourceProvider* resourcePro
vider) | 86 void CCHeadsUpDisplayLayerImpl::updateHudTexture(CCResourceProvider* resourcePro
vider) |
87 { | 87 { |
88 if (!m_hudTexture->id()) | 88 if (!m_hudTexture->id()) |
89 return; | 89 return; |
90 | 90 |
91 SkISize canvasSize; | 91 SkISize canvasSize; |
92 if (m_hudCanvas) | 92 if (m_hudCanvas) |
93 canvasSize = m_hudCanvas->getDeviceSize(); | 93 canvasSize = m_hudCanvas->getDeviceSize(); |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 canvas->drawRect(skRect, paint); | 276 canvas->drawRect(skRect, paint); |
277 | 277 |
278 paint.setColor(strokeColor); | 278 paint.setColor(strokeColor); |
279 paint.setStyle(SkPaint::kStroke_Style); | 279 paint.setStyle(SkPaint::kStroke_Style); |
280 paint.setStrokeWidth(2); | 280 paint.setStrokeWidth(2); |
281 canvas->drawRect(skRect, paint); | 281 canvas->drawRect(skRect, paint); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 } | 285 } |
OLD | NEW |