diff --git a/source/core/rendering/texture.cpp b/source/core/rendering/texture.cpp index e084bbd..0717c89 100644 --- a/source/core/rendering/texture.cpp +++ b/source/core/rendering/texture.cpp @@ -4,7 +4,6 @@ #include // Para SDL_LogError, SDL_LogCategory, Uint8, SDL_... #include // Para uint32_t -#include // Para memcpy #include // Para basic_ifstream, basic_istream, basic_ios #include // Para std::cout #include // Para basic_istringstream @@ -259,12 +258,7 @@ auto Texture::loadSurface(const std::string& file_path) -> std::shared_ptr: - size_t pixel_count = raw_pixels.size(); - auto pixels = std::shared_ptr(new Uint8[pixel_count], std::default_delete()); // NOLINT(modernize-avoid-c-arrays) - std::memcpy(pixels.get(), raw_pixels.data(), pixel_count); - - auto surface = std::make_shared(w, h, pixels); + auto surface = std::make_shared(w, h, std::move(raw_pixels)); // Actualizar las dimensiones width_ = w; diff --git a/source/core/rendering/texture.hpp b/source/core/rendering/texture.hpp index 75b8305..69bf857 100644 --- a/source/core/rendering/texture.hpp +++ b/source/core/rendering/texture.hpp @@ -16,11 +16,11 @@ using Palette = std::array; // Definición de Surface para imágenes con paleta struct Surface { - std::shared_ptr data; // NOLINT(modernize-avoid-c-arrays) + std::vector data; Uint16 w, h; // Constructor - Surface(Uint16 width, Uint16 height, std::shared_ptr pixels) // NOLINT(modernize-avoid-c-arrays) + Surface(Uint16 width, Uint16 height, std::vector pixels) : data(std::move(pixels)), w(width), h(height) {}