本文整理汇总了C++中IDirectFB::CreateDataBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ IDirectFB::CreateDataBuffer方法的具体用法?C++ IDirectFB::CreateDataBuffer怎么用?C++ IDirectFB::CreateDataBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDirectFB
的用法示例。
在下文中一共展示了IDirectFB::CreateDataBuffer方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fromDataBufferDescription
bool QDirectFBPixmapData::fromDataBufferDescription(const DFBDataBufferDescription &dataBufferDescription)
{
IDirectFB *dfb = screen->dfb();
Q_ASSERT(dfb);
DFBResult result = DFB_OK;
IDirectFBDataBuffer *dataBufferPtr;
if ((result = dfb->CreateDataBuffer(dfb, &dataBufferDescription, &dataBufferPtr)) != DFB_OK) {
DirectFBError("QDirectFBPixmapData::fromDataBufferDescription()", result);
return false;
}
QDirectFBPointer<IDirectFBDataBuffer> dataBuffer(dataBufferPtr);
IDirectFBImageProvider *providerPtr;
if ((result = dataBuffer->CreateImageProvider(dataBuffer.data(), &providerPtr)) != DFB_OK)
return false;
QDirectFBPointer<IDirectFBImageProvider> provider(providerPtr);
DFBImageDescription imageDescription;
result = provider->GetImageDescription(provider.data(), &imageDescription);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't get image description", result);
return false;
}
if (imageDescription.caps & DICAPS_COLORKEY) {
return false;
}
DFBSurfaceDescription surfaceDescription;
if ((result = provider->GetSurfaceDescription(provider.data(), &surfaceDescription)) != DFB_OK) {
DirectFBError("QDirectFBPixmapData::fromDataBufferDescription(): Can't get surface description", result);
return false;
}
alpha = imageDescription.caps & DICAPS_ALPHACHANNEL;
imageFormat = alpha ? screen->alphaPixmapFormat() : screen->pixelFormat();
dfbSurface = screen->createDFBSurface(QSize(surfaceDescription.width, surfaceDescription.height),
imageFormat, QDirectFBScreen::TrackSurface);
result = provider->RenderTo(provider.data(), dfbSurface, 0);
if (result != DFB_OK) {
DirectFBError("QDirectFBPixmapData::fromSurfaceDescription(): Can't render to surface", result);
return false;
}
w = surfaceDescription.width;
h = surfaceDescription.height;
is_null = (w <= 0 || h <= 0);
d = QDirectFBScreen::depth(imageFormat);
setSerialNumber(++global_ser_no);
#if defined QT_DIRECTFB_IMAGEPROVIDER_KEEPALIVE
screen->setDirectFBImageProvider(providerPtr);
provider.take();
#endif
return true;
}
示例2: Thread
DFBDataBuffer::DFBDataBuffer(void* data, unsigned int dataSize) : Thread() {
IDirectFB* dfb = NULL;
deviceUri = NULL;
deviceFd = -1;
this->dataSize = dataSize;
this->data = new char[dataSize];
desc.file = NULL;
desc.memory.data = data;
desc.memory.length = dataSize;
desc.flags = (DFBDataBufferDescriptionFlags)DBDESC_MEMORY;
dfb = (IDirectFB*)(LocalDeviceManager::getInstance()->getGfxRoot());
dfb->CreateDataBuffer(dfb, &desc, &dataBuffer);
}