mirror of
https://github.com/hyprwm/hyprgraphics.git
synced 2026-05-06 03:28:05 +02:00
change buffer initialization from constructor to resizing
This commit is contained in:
parent
ddfd74ad4a
commit
efbb09f5d4
1 changed files with 5 additions and 3 deletions
|
|
@ -56,11 +56,13 @@ static bool tryLoadImageFromBuffer(const std::span<uint8_t>& data) {
|
|||
}
|
||||
|
||||
std::vector<uint8_t> getImageBuffer(const std::string& path) {
|
||||
std::ifstream file("./resource/images/hyprland.png", std::ios::binary | std::ios::ate);
|
||||
std::streamsize size = file.tellg();
|
||||
std::vector<uint8_t> buffer;
|
||||
|
||||
std::ifstream file("./resource/images/hyprland.png", std::ios::binary | std::ios::ate);
|
||||
std::streamsize size = file.tellg();
|
||||
file.seekg(0, std::ios::beg);
|
||||
|
||||
std::vector<uint8_t> buffer(size);
|
||||
buffer.resize(size);
|
||||
|
||||
file.read(reinterpret_cast<char*>(buffer.data()), size);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue