| 361 | } |
| 362 | |
| 363 | void DisplayList::checkTileCount(Surface* renderSurface) { |
| 364 | DEBUG_ASSERT(renderSurface != nullptr); |
| 365 | auto tileCountX = |
| 366 | ceilf(static_cast<float>(renderSurface->width()) / static_cast<float>(_tileSize)); |
| 367 | auto tileCountY = |
| 368 | ceilf(static_cast<float>(renderSurface->height()) / static_cast<float>(_tileSize)); |
| 369 | auto minTileCount = static_cast<int>(tileCountX + 1) * static_cast<int>(tileCountY + 1); |
| 370 | if (totalTileCount > 0) { |
| 371 | if (totalTileCount >= minTileCount) { |
| 372 | return; |
| 373 | } |
| 374 | resetCaches(); |
| 375 | } |
| 376 | totalTileCount = std::max(minTileCount, _maxTileCount); |
| 377 | auto maxTileCountPerAtlas = getMaxTileCountPerAtlas(renderSurface->getContext()); |
| 378 | if (maxTileCountPerAtlas <= 0) { |
| 379 | return; |
| 380 | } |
| 381 | auto remainingTileCount = totalTileCount % maxTileCountPerAtlas; |
| 382 | totalTileCount -= remainingTileCount; |
| 383 | int width = static_cast<int>(sqrtf(static_cast<float>(remainingTileCount))); |
| 384 | int height = |
| 385 | static_cast<int>(ceilf(static_cast<float>(remainingTileCount) / static_cast<float>(width))); |
| 386 | totalTileCount += width * height; |
| 387 | } |
| 388 | |
| 389 | std::vector<DrawTask> DisplayList::invalidateTileCaches(const std::vector<Rect>& dirtyRegions) { |
| 390 | if (dirtyRegions.empty()) { |
nothing calls this directly
no test coverage detected