本文整理汇总了C++中ImageDecoder::init方法的典型用法代码示例。如果您正苦于以下问题:C++ ImageDecoder::init方法的具体用法?C++ ImageDecoder::init怎么用?C++ ImageDecoder::init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ImageDecoder
的用法示例。
在下文中一共展示了ImageDecoder::init方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _SYS_image_memDrawRect
void _SYS_image_memDrawRect(uint16_t *dest, _SYSCubeID destCID,
const _SYSAssetImage *im, unsigned dest_stride, unsigned frame,
struct _SYSInt2 *srcXY, struct _SYSInt2 *size)
{
if (!isAligned(dest, 2) || !isAligned(im) || !isAligned(srcXY) || !isAligned(size))
return SvmRuntime::fault(F_SYSCALL_ADDR_ALIGN);
struct _SYSInt2 lSrcXY, lSize;
if (!SvmMemory::copyROData(lSrcXY, srcXY))
return SvmRuntime::fault(F_SYSCALL_ADDRESS);
if (!SvmMemory::copyROData(lSize, size))
return SvmRuntime::fault(F_SYSCALL_ADDRESS);
ImageDecoder decoder;
if (destCID == _SYS_CUBE_ID_INVALID) {
// Relocation disabled
if (!decoder.init(im))
return SvmRuntime::fault(F_BAD_ASSET_IMAGE);
} else {
// Relocate to a specific cube (validated by decoder.init)
if (!decoder.init(im, destCID))
return SvmRuntime::fault(F_BAD_ASSET_IMAGE);
}
ImageIter iter(decoder, frame, lSrcXY.x, lSrcXY.y, lSize.x, lSize.y);
if (!SvmMemory::mapRAM(dest, iter.getDestBytes(dest_stride)))
return SvmRuntime::fault(F_SYSCALL_ADDRESS);
iter.copyToMem(dest, dest_stride);
}
示例2: _SYS_image_BG1DrawRect
void _SYS_image_BG1DrawRect(struct _SYSAttachedVideoBuffer *vbuf,
const _SYSAssetImage *im, struct _SYSInt2 *destXY, unsigned frame,
struct _SYSInt2 *srcXY, struct _SYSInt2 *size)
{
if (!isAligned(vbuf) || !isAligned(im) ||
!isAligned(destXY) || !isAligned(srcXY) || !isAligned(size))
return SvmRuntime::fault(F_SYSCALL_ADDR_ALIGN);
if (!SvmMemory::mapRAM(vbuf))
return SvmRuntime::fault(F_SYSCALL_ADDRESS);
struct _SYSInt2 lDestXY, lSrcXY, lSize;
if (!SvmMemory::copyROData(lDestXY, destXY))
return SvmRuntime::fault(F_SYSCALL_ADDRESS);
if (!SvmMemory::copyROData(lSrcXY, srcXY))
return SvmRuntime::fault(F_SYSCALL_ADDRESS);
if (!SvmMemory::copyROData(lSize, size))
return SvmRuntime::fault(F_SYSCALL_ADDRESS);
ImageDecoder decoder;
if (!decoder.init(im, vbuf->cube))
return SvmRuntime::fault(F_BAD_ASSET_IMAGE);
ImageIter iter(decoder, frame, lSrcXY.x, lSrcXY.y, lSize.x, lSize.y);
iter.copyToBG1(vbuf->vbuf, lDestXY.x, lDestXY.y);
}
示例3: _SYS_image_BG0Draw
void _SYS_image_BG0Draw(struct _SYSAttachedVideoBuffer *vbuf,
const _SYSAssetImage *im, uint16_t addr, unsigned frame)
{
if (!isAligned(vbuf) || !isAligned(im))
return SvmRuntime::fault(F_SYSCALL_ADDR_ALIGN);
if (!SvmMemory::mapRAM(vbuf))
return SvmRuntime::fault(F_SYSCALL_ADDRESS);
ImageDecoder decoder;
if (!decoder.init(im, vbuf->cube))
return SvmRuntime::fault(F_BAD_ASSET_IMAGE);
ImageIter iter(decoder, frame);
iter.copyToVRAM(vbuf->vbuf, addr, _SYS_VRAM_BG0_WIDTH);
}