Beispiel #1
0
void PaintedSurface::prepare(GLWebViewState* state)
{
    XLOG("PS %p has PL %p, DL %p", this, m_paintingLayer, m_drawingLayer);
    LayerAndroid* paintingLayer = m_paintingLayer;
    if (!paintingLayer)
        paintingLayer = m_drawingLayer;

    if (!paintingLayer)
        return;

    bool startFastSwap = false;
    if (state->isScrolling()) {
        // when scrolling, block updates and swap tiles as soon as they're ready
        startFastSwap = true;
    }

    XLOG("prepare layer %d %x at scale %.2f",
         paintingLayer->uniqueId(), paintingLayer,
         paintingLayer->getScale());

    IntRect visibleArea = computeVisibleArea(paintingLayer);
    IntRect prepareArea = computePrepareArea(paintingLayer); // SAMSUNG CHANGE

    m_scale = state->scale();

    // If we do not have text, we may as well limit ourselves to
    // a scale factor of one... this saves up textures.
    if (m_scale > 1 && !paintingLayer->hasText())
        m_scale = 1;

    m_tiledTexture->prepare(state, m_scale, m_pictureUsed != paintingLayer->pictureUsed(),
                            startFastSwap, visibleArea, prepareArea); // SAMSUNG CHANGE
}
Beispiel #2
0
void Surface::prepareGL(bool layerTilesDisabled, bool updateWithBlit)
{
    bool tilesDisabled = layerTilesDisabled && !isBase();
    if (!m_surfaceBacking) {
        ALOGV("prepareGL on Surf %p, no SurfBack, needsTexture? %d",
              this, m_surfaceBacking, needsTexture());

        if (needsTexture() || (isBase() && layerTilesDisabled))
            m_surfaceBacking = new SurfaceBacking(isBase());
        else
            return;
    }

    if (tilesDisabled) {
        m_surfaceBacking->discardTextures();
    } else {
        bool allowZoom = hasText(); // only allow for scale > 1 if painting vectors
        IntRect prepareArea = computePrepareArea();
        IntRect fullArea = fullContentArea();

        ALOGV("prepareGL on Surf %p with SurfBack %p, %d layers, first layer %s (%d) "
              "prepareArea(%d, %d - %d x %d) fullArea(%d, %d - %d x %d)",
              this, m_surfaceBacking, m_layers.size(),
              getFirstLayer()->subclassName().ascii().data(),
              getFirstLayer()->uniqueId(),
              prepareArea.x(), prepareArea.y(), prepareArea.width(), prepareArea.height(),
              fullArea.x(), fullArea.y(), fullArea.width(), fullArea.height());

        m_surfaceBacking->prepareGL(getFirstLayer()->state(), allowZoom,
                                    prepareArea, fullArea,
                                    this, useAggressiveRendering(), updateWithBlit);
    }
    for (size_t i = 0; i < m_layers.size(); i++) {
        LayerContent* content = m_layers[i]->content();
        if (content)
            content->clearPrerenders();
    }
}