neteja cppcheck (44 → 0) i aïllar impls de tercers
This commit is contained in:
@@ -8,9 +8,8 @@
|
||||
#include <string> // Para string
|
||||
#include <vector> // Para vector
|
||||
|
||||
#define STB_IMAGE_WRITE_IMPLEMENTATION
|
||||
#include "core/rendering/surface.hpp" // Para Surface
|
||||
#include "external/stb_image_write.h" // Para stbi_write_png
|
||||
#include "external/stb_image_write.h" // Para stbi_write_png (impl en source/external/stb_image_write_impl.cpp)
|
||||
|
||||
namespace Screenshot {
|
||||
|
||||
@@ -21,7 +20,7 @@ namespace Screenshot {
|
||||
|
||||
auto now = std::chrono::system_clock::now();
|
||||
std::time_t time = std::chrono::system_clock::to_time_t(now);
|
||||
std::tm* tm = std::localtime(&time);
|
||||
const std::tm* tm = std::localtime(&time);
|
||||
|
||||
char timestamp[20];
|
||||
std::strftime(timestamp, sizeof(timestamp), "%Y%m%d_%H%M%S", tm);
|
||||
@@ -45,15 +44,15 @@ namespace Screenshot {
|
||||
} // namespace
|
||||
|
||||
auto save(const Surface& surface) -> std::string {
|
||||
int width = static_cast<int>(surface.getWidth());
|
||||
int height = static_cast<int>(surface.getHeight());
|
||||
std::vector<Uint32> buffer(static_cast<size_t>(width * height));
|
||||
const int WIDTH = surface.getWidth();
|
||||
const int HEIGHT = surface.getHeight();
|
||||
std::vector<Uint32> buffer(static_cast<size_t>(WIDTH * HEIGHT));
|
||||
surface.toARGBBuffer(buffer.data());
|
||||
|
||||
std::string filename;
|
||||
std::string filepath = generateFilePath(filename);
|
||||
|
||||
return writePng(buffer.data(), width, height, filepath) ? filename : "";
|
||||
return writePng(buffer.data(), WIDTH, HEIGHT, filepath) ? filename : "";
|
||||
}
|
||||
|
||||
auto save(const Uint32* buffer, int width, int height) -> std::string {
|
||||
|
||||
Reference in New Issue
Block a user