MCPcopy Create free account
hub / github.com/Tencent/tgfx / checkTileCount

Method checkTileCount

src/layers/DisplayList.cpp:363–387  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363void 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
389std::vector<DrawTask> DisplayList::invalidateTileCaches(const std::vector<Rect>& dirtyRegions) {
390 if (dirtyRegions.empty()) {

Callers

nothing calls this directly

Calls 3

widthMethod · 0.45
heightMethod · 0.45
getContextMethod · 0.45

Tested by

no test coverage detected