本文整理汇总了C++中AutoAlloc::GetError方法的典型用法代码示例。如果您正苦于以下问题:C++ AutoAlloc::GetError方法的具体用法?C++ AutoAlloc::GetError怎么用?C++ AutoAlloc::GetError使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AutoAlloc
的用法示例。
在下文中一共展示了AutoAlloc::GetError方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Save
IMAGERESULT BFFSaverData::Save(const Filename& name, BaseBitmap* bm, BaseContainer* data, SAVEBIT savebits)
{
Int32 y, bw, bh;
Bool ok = true;
UChar* line = nullptr;
AutoAlloc<BaseFile> file;
if (!file)
return IMAGERESULT_OUTOFMEMORY;
if (!file->Open(name, FILEOPEN_WRITE, FILEDIALOG_NONE, BYTEORDER_MOTOROLA))
return IMAGERESULT_FILEERROR;
bw = bm->GetBw();
bh = bm->GetBh();
file->WriteInt32(0x42464600);
file->WriteInt32(bw);
file->WriteInt32(bh);
if (bw > 0)
line = NewMemClear(UChar, 3 * bw);
if (!line)
{
DeleteMem(line);
return IMAGERESULT_OUTOFMEMORY;
}
for (y = 0; y < bh; y++)
{
bm->GetPixelCnt(0, y, bw, line, COLORBYTES_RGB, COLORMODE_RGB, PIXELCNT_0);
file->WriteBytes(line, bw * 3);
}
ok = file->GetError() == FILEERROR_NONE;
DeleteMem(line);
return ok ? IMAGERESULT_OK : IMAGERESULT_FILEERROR;
}
示例2: Load
IMAGERESULT BFFLoaderData::Load(const Filename& name, BaseBitmap* bm, Int32 frame)
{
Int32 y, bw, bh, header;
Bool ok = true;
UChar* line = nullptr;
AutoAlloc<BaseFile> file;
if (!file)
return IMAGERESULT_OUTOFMEMORY;
if (!file->Open(name, FILEOPEN_READ, FILEDIALOG_NONE, BYTEORDER_MOTOROLA))
return IMAGERESULT_FILEERROR;
file->ReadInt32(&header);
file->ReadInt32(&bw);
file->ReadInt32(&bh);
if (bw > 0)
line = NewMemClear(UChar, 3 * bw);
if (bm->Init(bw, bh, 24) != IMAGERESULT_OK || !line)
{
DeleteMem(line);
return IMAGERESULT_OUTOFMEMORY;
}
for (y = 0; y < bh && ok; y++)
{
// check if current thread is canceled and return IMAGERESULT_THREADCANCELED
file->ReadBytes(line, bw * 3);
ok = bm->SetPixelCnt(0, y, bw, line, COLORBYTES_RGB, COLORMODE_RGB, PIXELCNT_0);
}
ok = ok && file->GetError() == FILEERROR_NONE;
DeleteMem(line);
return ok ? IMAGERESULT_OK : IMAGERESULT_FILEERROR;
}