make popup ptr local on main menu

This commit is contained in:
2019-02-09 11:54:42 +01:00
parent 1876207afb
commit e629a2a7b5
5 changed files with 61 additions and 57 deletions

View File

@@ -25,6 +25,7 @@ bool ABR::section_samp()
{
auto samp_size = ru32();
auto uid = rpascal();
printf("sample brush %s\n", uid.c_str());
skip(4);
auto image = parse_vmem();
if (image->channels.size() >= 3)
@@ -67,6 +68,7 @@ bool ABR::section_patt()
auto image_mode = ru32();
if (!(image_mode == 1 || image_mode == 3))
{
printf("skip image mode %d\n", image_mode);
skip(patt_length - 8);
snap();
continue;
@@ -113,16 +115,16 @@ bool ABR::section_patt()
std::shared_ptr<ABR::Image> ABR::parse_vmem()
{
// Virtual Memory Array List
auto version = ru32(); // = 3
auto length = ru32();
auto rect = rrect();
auto channels = ru32();
auto vmem_version = ru32(); // = 3
auto vmem_length = ru32();
auto vmem_rect = rrect();
auto vmem_channels = ru32();
// The following is a virtual memory array,
// repeated for the number of channels
// + one for a user mask + one for a sheet mask.
channels += 2; // user and sheet mask
auto ret = std::make_shared<Image>(version, rect);
for (int ch = 0; ch < channels; ch++)
vmem_channels += 2; // user and sheet mask
auto ret = std::make_shared<Image>(vmem_version, vmem_rect);
for (int ch = 0; ch < vmem_channels; ch++)
{
auto array_written = ru32(); // skip if 0
if (array_written == 0)
@@ -147,6 +149,7 @@ std::shared_ptr<ABR::Image> ABR::parse_vmem()
}
else if (compression == 1)
{
auto start = pos();
auto height = rect.height();
// contain the compressed length of each scanline
std::vector<uint16_t> scanlines;
@@ -160,6 +163,7 @@ std::shared_ptr<ABR::Image> ABR::parse_vmem()
raw.insert(raw.end(), decoded.begin(), decoded.end());
}
ret->channels.emplace_back(depth, rect, compression, raw);
auto len = pos() - start;
}
else
{
@@ -300,6 +304,7 @@ bool ABR::open(const std::string& path)
init(asset.read_all(), asset.m_len, BinaryStream::ByteOrder::BigEndian);
auto version_major = ru16();
auto version_minor = ru16();
printf("ABR %d.%d\n", version_major, version_minor);
while (!eof())
{
if (rstring(4) != "8BIM")