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