Пример #1
0
bool LayerRendererChromium::initialize()
{
    m_context->makeContextCurrent();
    if (settings().acceleratePainting)
        m_capabilities.usingAcceleratedPainting = true;

    WebCore::Extensions3D* extensions = m_context->getExtensions();
    m_capabilities.usingMapSub = extensions->supports("GL_CHROMIUM_map_sub");
    if (m_capabilities.usingMapSub)
        extensions->ensureEnabled("GL_CHROMIUM_map_sub");

    // Use the swapBuffers callback only with the threaded proxy.
    if (settings().enableCompositorThread)
        m_capabilities.usingSwapCompleteCallback = extensions->supports("GL_CHROMIUM_swapbuffers_complete_callback");
    if (m_capabilities.usingSwapCompleteCallback) {
        extensions->ensureEnabled("GL_CHROMIUM_swapbuffers_complete_callback");
        Extensions3DChromium* extensions3DChromium = static_cast<Extensions3DChromium*>(extensions);
        extensions3DChromium->setSwapBuffersCompleteCallbackCHROMIUM(LayerRendererSwapBuffersCompleteCallbackAdapter::create(this));
    }

    if (extensions->supports("GL_EXT_texture_format_BGRA8888"))
        extensions->ensureEnabled("GL_EXT_texture_format_BGRA8888");

    GLC(m_context.get(), m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_capabilities.maxTextureSize));
    m_capabilities.bestTextureFormat = PlatformColor::bestTextureFormat(m_context.get());

    if (!initializeSharedObjects())
        return false;

    m_headsUpDisplay = CCHeadsUpDisplay::create(this);

    // Make sure the viewport and context gets initialized, even if it is to zero.
    viewportChanged();
    return true;
}
LayerRendererChromium::LayerRendererChromium(PassRefPtr<GraphicsContext3D> context,
                                             PassOwnPtr<TilePaintInterface> contentPaint)
    : m_viewportScrollPosition(IntPoint(-1, -1))
    , m_rootLayer(0)
    , m_rootLayerContentPaint(contentPaint)
    , m_currentShader(0)
    , m_currentRenderSurface(0)
    , m_offscreenFramebufferId(0)
    , m_compositeOffscreen(false)
    , m_context(context)
    , m_childContextsWereCopied(false)
    , m_contextSupportsLatch(false)
    , m_animating(false)
    , m_defaultRenderSurface(0)
{
    m_contextSupportsLatch = m_context->getExtensions()->supports("GL_CHROMIUM_latch");
    m_contextSupportsMapSub = m_context->getExtensions()->supports("GL_CHROMIUM_map_sub");
    if (m_contextSupportsMapSub)
        m_context->getExtensions()->ensureEnabled("GL_CHROMIUM_map_sub");
    m_hardwareCompositing = initializeSharedObjects();
    m_rootLayerContentTiler = LayerTilerChromium::create(this, IntSize(256, 256), LayerTilerChromium::NoBorderTexels);
    ASSERT(m_rootLayerContentTiler);

    m_headsUpDisplay = CCHeadsUpDisplay::create(this);
}
Пример #3
0
LayerRendererChromium::LayerRendererChromium(PassOwnPtr<GLES2Context> gles2Context)
    : m_rootLayerTextureId(0)
    , m_rootLayerTextureWidth(0)
    , m_rootLayerTextureHeight(0)
    , m_scrollShaderProgram(0)
    , m_rootLayer(0)
    , m_needsDisplay(false)
    , m_scrollPosition(IntPoint(-1, -1))
    , m_currentShader(0)
    , m_gles2Context(gles2Context)
{
    m_hardwareCompositing = (m_gles2Context && initializeSharedObjects());
}