Exemplo n.º 1
0
void PaintedSurface::computeTexturesAmount(TexturesResult* result)
{
    if (!m_tiledTexture)
        return;

    // for now, always done on drawinglayer
    LayerAndroid* layer = m_drawingLayer;

    if (!layer)
        return;

    IntRect unclippedArea = layer->unclippedArea();
    IntRect clippedVisibleArea = layer->visibleArea();
    // get two numbers here:
    // - textures needed for a clipped area
    // - textures needed for an un-clipped area
    int nbTexturesUnclipped = m_tiledTexture->nbTextures(unclippedArea, m_scale);
    int nbTexturesClipped = m_tiledTexture->nbTextures(clippedVisibleArea, m_scale);

    // Set kFixedLayers level
    if (layer->isFixed())
        result->fixed += nbTexturesClipped;

    // Set kScrollableAndFixedLayers level
    if (layer->contentIsScrollable()
        || layer->isFixed())
        result->scrollable += nbTexturesClipped;

    // Set kClippedTextures level
    result->clipped += nbTexturesClipped;

    // Set kAllTextures level
    if (layer->contentIsScrollable())
        result->full += nbTexturesClipped;
    else
        result->full += nbTexturesUnclipped;
}