本文整理汇总了C++中ObjectBaseRef::set方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectBaseRef::set方法的具体用法?C++ ObjectBaseRef::set怎么用?C++ ObjectBaseRef::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectBaseRef
的用法示例。
在下文中一共展示了ObjectBaseRef::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Element
ObjectBaseRef<const Element> Element::createRef(Context *rsc, RsDataType dt, RsDataKind dk,
bool isNorm, uint32_t vecSize) {
ObjectBaseRef<const Element> returnRef;
// Look for an existing match.
ObjectBase::asyncLock();
for (uint32_t ct=0; ct < rsc->mStateElement.mElements.size(); ct++) {
const Element *ee = rsc->mStateElement.mElements[ct];
if (!ee->getFieldCount() &&
(ee->getComponent().getType() == dt) &&
(ee->getComponent().getKind() == dk) &&
(ee->getComponent().getIsNormalized() == isNorm) &&
(ee->getComponent().getVectorSize() == vecSize)) {
// Match
returnRef.set(ee);
ObjectBase::asyncUnlock();
return ee;
}
}
ObjectBase::asyncUnlock();
Element *e = new Element(rsc);
returnRef.set(e);
e->mComponent.set(dt, dk, isNorm, vecSize);
e->compute();
ObjectBase::asyncLock();
rsc->mStateElement.mElements.push(e);
ObjectBase::asyncUnlock();
return returnRef;
}
示例2: new
ObjectBaseRef<Sampler> Sampler::getSampler(Context *rsc,
RsSamplerValue magFilter,
RsSamplerValue minFilter,
RsSamplerValue wrapS,
RsSamplerValue wrapT,
RsSamplerValue wrapR,
float aniso) {
ObjectBaseRef<Sampler> returnRef;
ObjectBase::asyncLock();
for (uint32_t ct = 0; ct < rsc->mStateSampler.mAllSamplers.size(); ct++) {
Sampler *existing = rsc->mStateSampler.mAllSamplers[ct];
if (existing->mHal.state.magFilter != magFilter) continue;
if (existing->mHal.state.minFilter != minFilter ) continue;
if (existing->mHal.state.wrapS != wrapS) continue;
if (existing->mHal.state.wrapT != wrapT) continue;
if (existing->mHal.state.wrapR != wrapR) continue;
if (existing->mHal.state.aniso != aniso) continue;
returnRef.set(existing);
ObjectBase::asyncUnlock();
return returnRef;
}
ObjectBase::asyncUnlock();
void* allocMem = rsc->mHal.funcs.allocRuntimeMem(sizeof(Sampler), 0);
if (!allocMem) {
rsc->setError(RS_ERROR_FATAL_DRIVER, "Couldn't allocate memory for Allocation");
return NULL;
}
Sampler *s = new (allocMem) Sampler(rsc, magFilter, minFilter, wrapS, wrapT, wrapR, aniso);
returnRef.set(s);
#ifdef RS_FIND_OFFSETS
ALOGE("pointer for sampler: %p", s);
ALOGE("pointer for sampler.drv: %p", &s->mHal.drv);
#endif
ObjectBase::asyncLock();
rsc->mStateSampler.mAllSamplers.push(s);
ObjectBase::asyncUnlock();
return returnRef;
}
示例3: ProgramRaster
ObjectBaseRef<ProgramRaster> ProgramRaster::getProgramRaster(Context *rsc,
bool pointSprite,
RsCullMode cull) {
ObjectBaseRef<ProgramRaster> returnRef;
ObjectBase::asyncLock();
for (uint32_t ct = 0; ct < rsc->mStateRaster.mRasterPrograms.size(); ct++) {
ProgramRaster *existing = rsc->mStateRaster.mRasterPrograms[ct];
if (existing->mHal.state.pointSprite != pointSprite) continue;
if (existing->mHal.state.cull != cull) continue;
returnRef.set(existing);
ObjectBase::asyncUnlock();
return returnRef;
}
ObjectBase::asyncUnlock();
ProgramRaster *pr = new ProgramRaster(rsc, pointSprite, cull);
returnRef.set(pr);
ObjectBase::asyncLock();
rsc->mStateRaster.mRasterPrograms.push(pr);
ObjectBase::asyncUnlock();
return returnRef;
}