Parsing a png works now
This commit is contained in:
parent
7ca79b731d
commit
15dc5e7dbc
2 changed files with 5 additions and 5 deletions
|
@ -1 +1 @@
|
|||
Subproject commit 1b005488a2932156a5a5165820e93c04c39f6e55
|
||||
Subproject commit ff45377ffe6580049c1e125c478fe03d46cedec3
|
|
@ -39,6 +39,8 @@ char * read_png(const std::string &file_path)
|
|||
while (true)
|
||||
{
|
||||
buffer chunk_type{0};
|
||||
chunk_type.allocated = 0;
|
||||
chunk_type.data = nullptr;
|
||||
chunk_type.size = 4;
|
||||
auto chunk_head = std::make_tuple((unsigned int)0, chunk_type);
|
||||
auto ret = reader.read_from_tuple(chunk_head);
|
||||
|
@ -48,11 +50,9 @@ char * read_png(const std::string &file_path)
|
|||
buffer data_body{0};
|
||||
data_body.size = std::get<0>(chunk_head);
|
||||
auto data = std::make_tuple(data_body, chunk_type);
|
||||
ret = reader.read_from_tuple(data);
|
||||
if (ret.second == READ_INCOMPLETE || ret.second == READ_FILE_ENDED)
|
||||
throw std::runtime_error("Incomplete chunk");
|
||||
auto ree = reader.read_from_tuple(data);
|
||||
std::println("Size received {}", ree.first);
|
||||
if (strcmp("IHDR", std::get<1>(chunk_head).data) == 0)
|
||||
meta = parse_metadata(std::get<0>(data));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue