Refactor SaveScreenshot into a more useful RenderToTexture function.

Removes a few unused functions from helpers library.

PiperOrigin-RevId: 846661437
Change-Id: I815ffe1990098dedb71f694af088d85294f9c7de
This commit is contained in:
Haroon Qureshi
2025-12-19 03:33:07 -08:00
committed by Copybara-Service
parent 522ff1cd80
commit d1fd11bccd
5 changed files with 40 additions and 64 deletions
+6 -2
View File
@@ -1678,8 +1678,12 @@ void App::FileDialogGui() {
if (ImGui::BeginPopupModal("SaveWebp", NULL,
ImGuiWindowFlags_AlwaysAutoResize)) {
if (platform::ImGui_FileDialog(tmp_.filename, sizeof(tmp_.filename))) {
renderer_->SaveScreenshot(tmp_.filename, window_->GetWidth(),
window_->GetHeight());
const int width = window_->GetWidth();
const int height = window_->GetHeight();
std::vector<std::byte> buffer(width * height * 3);
renderer_->RenderToTexture(model_, data_, &camera_, width, height,
buffer.data());
platform::SaveToWebp(width, height, buffer.data(), tmp_.filename);
tmp_.last_save_screenshot_file = tmp_.filename;
}
ImGui::EndPopup();