本文整理汇总了C++中DataBuffer::getKey方法的典型用法代码示例。如果您正苦于以下问题:C++ DataBuffer::getKey方法的具体用法?C++ DataBuffer::getKey怎么用?C++ DataBuffer::getKey使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBuffer
的用法示例。
在下文中一共展示了DataBuffer::getKey方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setDataBuffer
bool DisplayPlane::setDataBuffer(uint32_t handle)
{
DataBuffer *buffer;
BufferMapper *mapper;
ssize_t index;
bool ret;
bool isCompression;
BufferManager *bm = Hwcomposer::getInstance().getBufferManager();
RETURN_FALSE_IF_NOT_INIT();
ALOGTRACE("handle = %#x", handle);
if (!handle) {
WLOGTRACE("invalid buffer handle");
return false;
}
// do not need to update the buffer handle
if (mCurrentDataBuffer != handle)
mUpdateMasks |= PLANE_BUFFER_CHANGED;
// if no update then do Not need set data buffer
if (!mUpdateMasks)
return true;
buffer = bm->lockDataBuffer(handle);
if (!buffer) {
ELOGTRACE("failed to get buffer");
return false;
}
mIsProtectedBuffer = GraphicBuffer::isProtectedBuffer((GraphicBuffer*)buffer);
isCompression = GraphicBuffer::isCompressionBuffer((GraphicBuffer*)buffer);
// map buffer if it's not in cache
index = mDataBuffers.indexOfKey(buffer->getKey());
if (index < 0) {
VLOGTRACE("unmapped buffer, mapping...");
mapper = mapBuffer(buffer);
if (!mapper) {
ELOGTRACE("failed to map buffer %#x", handle);
bm->unlockDataBuffer(buffer);
return false;
}
} else {
VLOGTRACE("got mapper in saved data buffers and update source Crop");
mapper = mDataBuffers.valueAt(index);
}
// always update source crop to mapper
mapper->setCrop(mSrcCrop.x, mSrcCrop.y, mSrcCrop.w, mSrcCrop.h);
mapper->setIsCompression(isCompression);
// unlock buffer after getting mapper
bm->unlockDataBuffer(buffer);
buffer = NULL;
ret = setDataBuffer(*mapper);
if (ret) {
mCurrentDataBuffer = handle;
// update active buffers
updateActiveBuffers(mapper);
}
return ret;
}