本文整理汇总了C++中PlatformCALayer::setContents方法的典型用法代码示例。如果您正苦于以下问题:C++ PlatformCALayer::setContents方法的具体用法?C++ PlatformCALayer::setContents怎么用?C++ PlatformCALayer::setContents使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlatformCALayer
的用法示例。
在下文中一共展示了PlatformCALayer::setContents方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: retrieveCurrentImage
void MediaPlayerPrivateQuickTimeVisualContext::retrieveCurrentImage()
{
if (!m_visualContext)
return;
#if USE(ACCELERATED_COMPOSITING)
if (m_qtVideoLayer) {
QTPixelBuffer buffer = m_visualContext->imageForTime(0);
if (!buffer.pixelBufferRef())
return;
PlatformCALayer* layer = m_qtVideoLayer.get();
if (!buffer.lockBaseAddress()) {
if (requiredDllsAvailable()) {
if (!m_imageQueue) {
m_imageQueue = adoptPtr(new WKCAImageQueue(buffer.width(), buffer.height(), 30));
m_imageQueue->setFlags(WKCAImageQueue::Fill, WKCAImageQueue::Fill);
layer->setContents(m_imageQueue->get());
}
// Debug QuickTime links against a non-Debug version of CoreFoundation, so the
// CFDictionary attached to the CVPixelBuffer cannot be directly passed on into the
// CAImageQueue without being converted to a non-Debug CFDictionary. Additionally,
// old versions of QuickTime used a non-AAS CoreFoundation, so the types are not
// interchangable even in the release case.
RetainPtr<CFDictionaryRef> attachments = adoptCF(QTCFDictionaryCreateCopyWithDataCallback(kCFAllocatorDefault, buffer.attachments(), &QTCFDictionaryCreateWithDataCallback));
CFTimeInterval imageTime = QTMovieVisualContext::currentHostTime();
m_imageQueue->collect();
uint64_t imageId = m_imageQueue->registerPixelBuffer(buffer.baseAddress(), buffer.dataSize(), buffer.bytesPerRow(), buffer.width(), buffer.height(), buffer.pixelFormatType(), attachments.get(), 0);
if (m_imageQueue->insertImage(imageTime, WKCAImageQueue::Buffer, imageId, WKCAImageQueue::Opaque | WKCAImageQueue::Flush, &QTPixelBuffer::imageQueueReleaseCallback, buffer.pixelBufferRef())) {
// Retain the buffer one extra time so it doesn't dissappear before CAImageQueue decides to release it:
QTPixelBuffer::retainCallback(buffer.pixelBufferRef());
}
} else {
CGImageRef image = CreateCGImageFromPixelBuffer(buffer);
layer->setContents(image);
CGImageRelease(image);
}
buffer.unlockBaseAddress();
layer->setNeedsCommit();
}
} else
#endif
m_player->repaint();
m_visualContext->task();
}