int PaintTileOperation::priority() { if (!m_tile) return -1; int priority = 200000; // if scrolling, prioritize the prefetch page, otherwise deprioritize TiledPage* page = m_tile->page(); if (page && page->isPrefetchPage()) { if (page->glWebViewState()->isScrolling()) priority = 0; else priority = 400000; } // prioritize higher draw count unsigned long long currentDraw = TilesManager::instance()->getDrawGLCount(); unsigned long long drawDelta = currentDraw - m_tile->drawCount(); priority += 100000 * (int)std::min(drawDelta, (unsigned long long)1000); // prioritize unpainted tiles, within the same drawCount if (m_tile->frontTexture()) priority += 50000; // for base tiles, prioritize based on position if (!m_tile->isLayerTile()) { bool goingDown = m_tile->page()->scrollingDown(); priority += m_tile->x(); if (goingDown) priority += 100000 - (1 + m_tile->y()) * 1000; else priority += m_tile->y() * 1000; } return priority; }