本文整理汇总了C++中SkImageInfo::minRowBytes64方法的典型用法代码示例。如果您正苦于以下问题:C++ SkImageInfo::minRowBytes64方法的具体用法?C++ SkImageInfo::minRowBytes64怎么用?C++ SkImageInfo::minRowBytes64使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SkImageInfo
的用法示例。
在下文中一共展示了SkImageInfo::minRowBytes64方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SkASSERT
sk_sp<SkPixelRef> SkMallocPixelRef::MakeUsing(void*(*alloc)(size_t),
const SkImageInfo& info,
size_t requestedRowBytes,
sk_sp<SkColorTable> ctable) {
if (!is_valid(info, ctable.get())) {
return nullptr;
}
// only want to permit 31bits of rowBytes
int64_t minRB = (int64_t)info.minRowBytes64();
if (minRB < 0 || !sk_64_isS32(minRB)) {
return nullptr; // allocation will be too large
}
if (requestedRowBytes > 0 && (int32_t)requestedRowBytes < minRB) {
return nullptr; // cannot meet requested rowbytes
}
int32_t rowBytes;
if (requestedRowBytes) {
rowBytes = SkToS32(requestedRowBytes);
} else {
rowBytes = minRB;
}
int64_t bigSize = (int64_t)info.height() * rowBytes;
if (!sk_64_isS32(bigSize)) {
return nullptr;
}
size_t size = sk_64_asS32(bigSize);
SkASSERT(size >= info.getSafeSize(rowBytes));
void* addr = alloc(size);
if (nullptr == addr) {
return nullptr;
}
return sk_sp<SkPixelRef>(new SkMallocPixelRef(info, addr, rowBytes, std::move(ctable),
sk_free_releaseproc, nullptr));
}