| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #include "config.h" | 25 #include "config.h" |
| 26 | 26 |
| 27 #if USE(ACCELERATED_COMPOSITING) | 27 #if USE(ACCELERATED_COMPOSITING) |
| 28 #include "CCHeadsUpDisplay.h" | 28 #include "CCHeadsUpDisplay.h" |
| 29 | 29 |
| 30 #include "CurrentTime.h" | 30 #include "CurrentTime.h" |
| 31 #include "Font.h" | 31 #include "Font.h" |
| 32 #include "FontDescription.h" | 32 #include "FontDescription.h" |
| 33 #include "GraphicsContext3D.h" | 33 #include "GraphicsContext3D.h" |
| 34 #include "LayerChromium.h" | 34 #include "LayerChromium.h" |
| 35 #include "LayerRendererChromium.h" |
| 35 #include "LayerTexture.h" | 36 #include "LayerTexture.h" |
| 36 #include "TextRun.h" | 37 #include "TextRun.h" |
| 37 #include "TextStream.h" | 38 #include "TextStream.h" |
| 38 #include "TextureManager.h" | 39 #include "TextureManager.h" |
| 39 #include <wtf/text/CString.h> | 40 #include <wtf/text/CString.h> |
| 40 #include <wtf/text/WTFString.h> | 41 #include <wtf/text/WTFString.h> |
| 41 | 42 |
| 42 namespace WebCore { | 43 namespace WebCore { |
| 43 | 44 |
| 44 using namespace std; | 45 using namespace std; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 | 103 |
| 103 // Upload to GL. | 104 // Upload to GL. |
| 104 { | 105 { |
| 105 PlatformCanvas::AutoLocker locker(&canvas); | 106 PlatformCanvas::AutoLocker locker(&canvas); |
| 106 | 107 |
| 107 m_hudTexture->bindTexture(); | 108 m_hudTexture->bindTexture(); |
| 108 GLC(context.get(), context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0,
GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, Grap
hicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels())); | 109 GLC(context.get(), context->texImage2D(GraphicsContext3D::TEXTURE_2D, 0,
GraphicsContext3D::RGBA, canvas.size().width(), canvas.size().height(), 0, Grap
hicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, locker.pixels())); |
| 109 } | 110 } |
| 110 | 111 |
| 111 // Draw the HUD onto the default render surface. | 112 // Draw the HUD onto the default render surface. |
| 112 const LayerTilerChromium::Program* program = m_layerRenderer->tilerProgram()
; | 113 const Program* program = m_layerRenderer->headsUpDisplayProgram(); |
| 113 ASSERT(program && program->initialized()); | 114 ASSERT(program && program->initialized()); |
| 114 GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); | 115 GLC(context, context->activeTexture(GraphicsContext3D::TEXTURE0)); |
| 115 m_hudTexture->bindTexture(); | 116 m_hudTexture->bindTexture(); |
| 116 m_layerRenderer->useShader(program->program()); | 117 m_layerRenderer->useShader(program->program()); |
| 117 GLC(context, context->uniform1i(program->fragmentShader().samplerLocation(),
0)); | 118 GLC(context, context->uniform1i(program->fragmentShader().samplerLocation(),
0)); |
| 118 | 119 |
| 119 TransformationMatrix matrix; | 120 TransformationMatrix matrix; |
| 120 matrix.translate3d(hudSize.width() * 0.5, hudSize.height() * 0.5, 0); | 121 matrix.translate3d(hudSize.width() * 0.5, hudSize.height() * 0.5, 0); |
| 121 LayerChromium::drawTexturedQuad(context, m_layerRenderer->projectionMatrix()
, | 122 LayerChromium::drawTexturedQuad(context, m_layerRenderer->projectionMatrix()
, |
| 122 matrix, hudSize.width(), hudSize.height(), | 123 matrix, hudSize.width(), hudSize.height(), |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 218 |
| 218 void CCHeadsUpDisplay::onPresent() | 219 void CCHeadsUpDisplay::onPresent() |
| 219 { | 220 { |
| 220 m_presentTimeHistoryInSec[m_currentFrameNumber % kPresentHistorySize] = curr
entTime(); | 221 m_presentTimeHistoryInSec[m_currentFrameNumber % kPresentHistorySize] = curr
entTime(); |
| 221 m_currentFrameNumber += 1; | 222 m_currentFrameNumber += 1; |
| 222 } | 223 } |
| 223 | 224 |
| 224 } | 225 } |
| 225 | 226 |
| 226 #endif // USE(ACCELERATED_COMPOSITING) | 227 #endif // USE(ACCELERATED_COMPOSITING) |
| OLD | NEW |