Bug 1245959 - Check plugin has non-zero dimensions before sending image to compositor. r=nical

MozReview-Commit-ID: KEd5IBUGlo6

--HG--
extra : rebase_source : b1719e8c1a5cbca40a3940cf9262a4bb28b93abe
This commit is contained in:
Jamie Nicol 2016-09-19 13:28:05 +01:00
Родитель c86b6515ad
Коммит dc6488e7d5
1 изменённых файлов: 14 добавлений и 10 удалений

Просмотреть файл

@ -222,12 +222,14 @@ nsPluginInstanceOwner::GetImageContainer()
container = LayerManager::CreateImageContainer();
// Try to get it as an EGLImage first.
RefPtr<Image> img;
AttachToContainerAsSurfaceTexture(container, mInstance, r, &img);
if (r.width && r.height) {
// Try to get it as an EGLImage first.
RefPtr<Image> img;
AttachToContainerAsSurfaceTexture(container, mInstance, r, &img);
if (img) {
container->SetCurrentImageInTransaction(img);
if (img) {
container->SetCurrentImageInTransaction(img);
}
}
#else
if (NeedsScrollImageLayer()) {
@ -1578,11 +1580,13 @@ nsPluginInstanceOwner::GetImageContainerForVideo(nsNPAPIPluginInstance::VideoInf
{
RefPtr<ImageContainer> container = LayerManager::CreateImageContainer();
RefPtr<Image> img = new SurfaceTextureImage(
aVideoInfo->mSurfaceTexture,
gfx::IntSize::Truncate(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height),
gl::OriginPos::BottomLeft);
container->SetCurrentImageInTransaction(img);
if (aVideoInfo->mDimensions.width && aVideoInfo->mDimensions.height) {
RefPtr<Image> img = new SurfaceTextureImage(
aVideoInfo->mSurfaceTexture,
gfx::IntSize::Truncate(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height),
gl::OriginPos::BottomLeft);
container->SetCurrentImageInTransaction(img);
}
return container.forget();
}