本文整理汇总了C++中Image::DeprecatedGetAsSurface方法的典型用法代码示例。如果您正苦于以下问题:C++ Image::DeprecatedGetAsSurface方法的具体用法?C++ Image::DeprecatedGetAsSurface怎么用?C++ Image::DeprecatedGetAsSurface使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Image
的用法示例。
在下文中一共展示了Image::DeprecatedGetAsSurface方法的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() == ImageFormat::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() == ImageFormat::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() == ImageFormat::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() == ImageFormat::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<GrallocImage*>(image)->GetSurfaceDescriptor();
if (!IsSurfaceDescriptorValid(desc)) {
return false;
}
mDeprecatedTextureClient->SetDescriptor(desc);
#endif
} else {
nsRefPtr<gfxASurface> surface = image->DeprecatedGetAsSurface();
MOZ_ASSERT(surface);
EnsureDeprecatedTextureClient(TEXTURE_SHMEM);
MOZ_ASSERT(mDeprecatedTextureClient, "Failed to create texture client");
AutoLockShmemClient clientLock(mDeprecatedTextureClient);
if (!clientLock.Update(image, aContentFlags, surface)) {
NS_WARNING("failed to update DeprecatedTextureClient");
return false;
}
}
Updated();
if (image->GetFormat() == ImageFormat::PLANAR_YCBCR) {
PlanarYCbCrImage* ycbcr = static_cast<PlanarYCbCrImage*>(image);
UpdatePictureRect(ycbcr->GetData()->GetPictureRect());
//.........这里部分代码省略.........