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 "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "skia/ext/platform_canvas.h" |
| 11 #include "third_party/khronos/GLES2/gl2.h" |
| 12 #include "third_party/khronos/GLES2/gl2ext.h" |
10 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
11 #include "CCDebugRectHistory.h" | 14 #include "CCDebugRectHistory.h" |
12 #include "CCFontAtlas.h" | 15 #include "CCFontAtlas.h" |
13 #include "CCFrameRateCounter.h" | 16 #include "CCFrameRateCounter.h" |
14 #include "CCLayerTreeHostImpl.h" | 17 #include "CCLayerTreeHostImpl.h" |
15 #include "CCQuadSink.h" | 18 #include "CCQuadSink.h" |
16 #include "CCTextureDrawQuad.h" | 19 #include "CCTextureDrawQuad.h" |
17 #include "Extensions3DChromium.h" | |
18 #include "GraphicsContext3D.h" | |
19 #include "SkBitmap.h" | 20 #include "SkBitmap.h" |
20 #include "SkColorMatrixFilter.h" | 21 #include "SkColorMatrixFilter.h" |
21 #include "SkPaint.h" | 22 #include "SkPaint.h" |
22 #include "skia/ext/platform_canvas.h" | |
23 | 23 |
24 namespace cc { | 24 namespace cc { |
25 | 25 |
26 static inline SkPaint createPaint() | 26 static inline SkPaint createPaint() |
27 { | 27 { |
28 // The SkCanvas is in RGBA but the shader is expecting BGRA, so we need to | 28 // The SkCanvas is in RGBA but the shader is expecting BGRA, so we need to |
29 // swizzle our colors when drawing to the SkCanvas. | 29 // swizzle our colors when drawing to the SkCanvas. |
30 SkColorMatrix swizzleMatrix; | 30 SkColorMatrix swizzleMatrix; |
31 for (int i = 0; i < 20; ++i) | 31 for (int i = 0; i < 20; ++i) |
32 swizzleMatrix.fMat[i] = 0; | 32 swizzleMatrix.fMat[i] = 0; |
(...skipping 27 matching lines...) Expand all Loading... |
60 | 60 |
61 if (!m_hudTexture) | 61 if (!m_hudTexture) |
62 m_hudTexture = CCScopedTexture::create(resourceProvider); | 62 m_hudTexture = CCScopedTexture::create(resourceProvider); |
63 | 63 |
64 // FIXME: Scale the HUD by deviceScale to make it more friendly under high D
PI. | 64 // FIXME: Scale the HUD by deviceScale to make it more friendly under high D
PI. |
65 | 65 |
66 if (m_hudTexture->size() != bounds()) | 66 if (m_hudTexture->size() != bounds()) |
67 m_hudTexture->free(); | 67 m_hudTexture->free(); |
68 | 68 |
69 if (!m_hudTexture->id()) | 69 if (!m_hudTexture->id()) |
70 m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GraphicsContext3D
::RGBA, CCResourceProvider::TextureUsageAny); | 70 m_hudTexture->allocate(CCRenderer::ImplPool, bounds(), GL_RGBA, CCResour
ceProvider::TextureUsageAny); |
71 } | 71 } |
72 | 72 |
73 void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsD
ata& appendQuadsData) | 73 void CCHeadsUpDisplayLayerImpl::appendQuads(CCQuadSink& quadSink, CCAppendQuadsD
ata& appendQuadsData) |
74 { | 74 { |
75 if (!m_hudTexture->id()) | 75 if (!m_hudTexture->id()) |
76 return; | 76 return; |
77 | 77 |
78 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createShare
dQuadState()); | 78 CCSharedQuadState* sharedQuadState = quadSink.useSharedQuadState(createShare
dQuadState()); |
79 | 79 |
80 IntRect quadRect(IntPoint(), bounds()); | 80 IntRect quadRect(IntPoint(), bounds()); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 canvas->drawRect(skRect, paint); | 287 canvas->drawRect(skRect, paint); |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 const char* CCHeadsUpDisplayLayerImpl::layerTypeAsString() const | 291 const char* CCHeadsUpDisplayLayerImpl::layerTypeAsString() const |
292 { | 292 { |
293 return "HeadsUpDisplayLayer"; | 293 return "HeadsUpDisplayLayer"; |
294 } | 294 } |
295 | 295 |
296 } | 296 } |
OLD | NEW |