本文整理汇总了C++中Sk64::get32方法的典型用法代码示例。如果您正苦于以下问题:C++ Sk64::get32方法的具体用法?C++ Sk64::get32怎么用?C++ Sk64::get32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sk64
的用法示例。
在下文中一共展示了Sk64::get32方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/** returns the product if it is positive and fits in 31 bits. Otherwise this
returns 0.
*/
static int32_t safeMul32(int32_t a, int32_t b) {
Sk64 size;
size.setMul(a, b);
if (size.is32() && size.isPos()) {
return size.get32();
}
return 0;
}
示例2: GetMSecs
SkMSec SkTime::GetMSecs()
{
UnsignedWide wide;
Sk64 s;
::Microseconds(&wide);
s.set(wide.hi, wide.lo);
s.div(1000, Sk64::kRound_DivOption);
return s.get32();
}
示例3: Alloc
static MipMap* Alloc(int levelCount, size_t pixelSize) {
if (levelCount < 0) {
return NULL;
}
Sk64 size;
size.setMul(levelCount + 1, sizeof(MipLevel));
size.add(sizeof(MipMap));
size.add(pixelSize);
if (!isPos32Bits(size)) {
return NULL;
}
MipMap* mm = (MipMap*)sk_malloc_throw(size.get32());
mm->fRefCnt = 1;
mm->fLevelCount = levelCount;
return mm;
}
示例4: NewAllocate
SkMallocPixelRef* SkMallocPixelRef::NewAllocate(const SkImageInfo& info,
size_t requestedRowBytes,
SkColorTable* ctable) {
if (!is_valid(info, ctable)) {
return NULL;
}
int32_t minRB = info.minRowBytes();
if (minRB < 0) {
return NULL; // allocation will be too large
}
if (requestedRowBytes > 0 && (int32_t)requestedRowBytes < minRB) {
return NULL; // cannot meet requested rowbytes
}
int32_t rowBytes;
if (requestedRowBytes) {
rowBytes = requestedRowBytes;
} else {
rowBytes = minRB;
}
Sk64 bigSize;
bigSize.setMul(info.fHeight, rowBytes);
if (!bigSize.is32()) {
return NULL;
}
size_t size = bigSize.get32();
void* addr = sk_malloc_flags(size, 0);
if (NULL == addr) {
return NULL;
}
return SkNEW_ARGS(SkMallocPixelRef, (info, addr, rowBytes, ctable, true));
}