GraphicsContext3D* WebGLLayerChromium::context() const { if (drawingBuffer()) return drawingBuffer()->graphicsContext3D().get(); return 0; }
void WebGLLayerChromium::updateCompositorResources(GraphicsContext3D* rendererContext, CCTextureUpdater&) { if (!drawsContent()) return; if (!m_needsDisplay) return; if (m_textureChanged) { rendererContext->bindTexture(GraphicsContext3D::TEXTURE_2D, m_textureId); // Set the min-mag filters to linear and wrap modes to GL_CLAMP_TO_EDGE // to get around NPOT texture limitations of GLES. rendererContext->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MIN_FILTER, GraphicsContext3D::LINEAR); rendererContext->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_MAG_FILTER, GraphicsContext3D::LINEAR); rendererContext->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_S, GraphicsContext3D::CLAMP_TO_EDGE); rendererContext->texParameteri(GraphicsContext3D::TEXTURE_2D, GraphicsContext3D::TEXTURE_WRAP_T, GraphicsContext3D::CLAMP_TO_EDGE); m_textureChanged = false; } // Update the contents of the texture used by the compositor. if (m_needsDisplay && m_textureUpdated) { // publishToPlatformLayer prepares the contents of the off-screen render target for use by the compositor. drawingBuffer()->publishToPlatformLayer(); context()->markLayerComposited(); m_updateRect = FloatRect(FloatPoint(), bounds()); m_needsDisplay = false; m_textureUpdated = false; } }
void WebGLLayerChromium::paintContentsIfDirty(const Region&) { if (!drawsContent() || !m_needsDisplay || !m_textureUpdated) return; drawingBuffer()->publishToPlatformLayer(); context()->markLayerComposited(); m_needsDisplay = false; m_textureUpdated = false; m_contextLost = context()->getExtensions()->getGraphicsResetStatusARB() != GraphicsContext3D::NO_ERROR; }