本文整理汇总了C++中PlanarYCbCrImage::AsDeprecatedSharedPlanarYCbCrImage方法的典型用法代码示例。如果您正苦于以下问题:C++ PlanarYCbCrImage::AsDeprecatedSharedPlanarYCbCrImage方法的具体用法?C++ PlanarYCbCrImage::AsDeprecatedSharedPlanarYCbCrImage怎么用?C++ PlanarYCbCrImage::AsDeprecatedSharedPlanarYCbCrImage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlanarYCbCrImage
的用法示例。
在下文中一共展示了PlanarYCbCrImage::AsDeprecatedSharedPlanarYCbCrImage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: autoLock
bool
DeprecatedImageClientSingle::UpdateImage(ImageContainer* aContainer,
uint32_t aContentFlags)
{
AutoLockImage autoLock(aContainer);
Image *image = autoLock.GetImage();
if (!image) {
return false;
}
if (mLastPaintedImageSerial == image->GetSerial()) {
return true;
}
if (image->GetFormat() == PLANAR_YCBCR &&
EnsureDeprecatedTextureClient(TEXTURE_YCBCR)) {
PlanarYCbCrImage* ycbcr = static_cast<PlanarYCbCrImage*>(image);
if (ycbcr->AsDeprecatedSharedPlanarYCbCrImage()) {
AutoLockDeprecatedTextureClient lock(mDeprecatedTextureClient);
SurfaceDescriptor sd;
if (!ycbcr->AsDeprecatedSharedPlanarYCbCrImage()->ToSurfaceDescriptor(sd)) {
return false;
}
if (IsSurfaceDescriptorValid(*lock.GetSurfaceDescriptor())) {
GetForwarder()->DestroySharedSurface(lock.GetSurfaceDescriptor());
}
*lock.GetSurfaceDescriptor() = sd;
} else {
AutoLockYCbCrClient clientLock(mDeprecatedTextureClient);
if (!clientLock.Update(ycbcr)) {
NS_WARNING("failed to update DeprecatedTextureClient (YCbCr)");
return false;
}
}
} else if (image->GetFormat() == SHARED_TEXTURE &&
EnsureDeprecatedTextureClient(TEXTURE_SHARED_GL_EXTERNAL)) {
SharedTextureImage* sharedImage = static_cast<SharedTextureImage*>(image);
const SharedTextureImage::Data *data = sharedImage->GetData();
SharedTextureDescriptor texture(data->mShareType,
data->mHandle,
data->mSize,
data->mInverted);
mDeprecatedTextureClient->SetDescriptor(SurfaceDescriptor(texture));
} else if (image->GetFormat() == SHARED_RGB &&
EnsureDeprecatedTextureClient(TEXTURE_SHMEM)) {
nsIntRect rect(0, 0,
image->GetSize().width,
image->GetSize().height);
UpdatePictureRect(rect);
AutoLockDeprecatedTextureClient lock(mDeprecatedTextureClient);
SurfaceDescriptor desc;
if (!static_cast<DeprecatedSharedRGBImage*>(image)->ToSurfaceDescriptor(desc)) {
return false;
}
mDeprecatedTextureClient->SetDescriptor(desc);
#ifdef MOZ_WIDGET_GONK
} else if (image->GetFormat() == GONK_IO_SURFACE &&
EnsureDeprecatedTextureClient(TEXTURE_SHARED_GL_EXTERNAL)) {
nsIntRect rect(0, 0,
image->GetSize().width,
image->GetSize().height);
UpdatePictureRect(rect);
AutoLockDeprecatedTextureClient lock(mDeprecatedTextureClient);
SurfaceDescriptor desc = static_cast<GonkIOSurfaceImage*>(image)->GetSurfaceDescriptor();
if (!IsSurfaceDescriptorValid(desc)) {
return false;
}
mDeprecatedTextureClient->SetDescriptor(desc);
} else if (image->GetFormat() == GRALLOC_PLANAR_YCBCR) {
EnsureDeprecatedTextureClient(TEXTURE_SHARED_GL_EXTERNAL);
nsIntRect rect(0, 0,
image->GetSize().width,
image->GetSize().height);
UpdatePictureRect(rect);
AutoLockDeprecatedTextureClient lock(mDeprecatedTextureClient);
SurfaceDescriptor desc = static_cast<GrallocPlanarYCbCrImage*>(image)->GetSurfaceDescriptor();
if (!IsSurfaceDescriptorValid(desc)) {
return false;
}
mDeprecatedTextureClient->SetDescriptor(desc);
#endif
} else {
nsRefPtr<gfxASurface> surface = image->GetAsSurface();
MOZ_ASSERT(surface);
EnsureDeprecatedTextureClient(TEXTURE_SHMEM);
//.........这里部分代码省略.........