refactoring

This commit is contained in:
Nick Fisher
2025-03-19 16:02:43 +08:00
parent e73cb9c7d6
commit ac86dc7ad7
20 changed files with 290 additions and 601 deletions

View File

@@ -49,21 +49,17 @@ namespace thermion
void RenderTicker::setRenderable(SwapChain *swapChain, View **views, uint8_t numViews) {
std::lock_guard lock(mMutex);
// Find if this swapChain already exists in our collection
auto it = std::find_if(mRenderable.begin(), mRenderable.end(),
[swapChain](const auto& pair) { return pair.first == swapChain; });
// Prepare the vector of views
std::vector<View*> swapChainViews;
for(int i = 0; i < numViews; i++) {
swapChainViews.push_back(views[i]);
}
if (it != mRenderable.end()) {
// Update existing entry
it->second = swapChainViews;
} else {
// Add new entry
mRenderable.emplace_back(swapChain, swapChainViews);
}
}