зеркало из https://github.com/mozilla/gecko-dev.git
Bug 907745 - cleanup ImageClient::CreateImage. r=mattwoodrow
This commit is contained in:
Родитель
a9764d8417
Коммит
a117d896cc
|
@ -449,25 +449,17 @@ ImageClientBridge::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlag
|
|||
}
|
||||
|
||||
already_AddRefed<Image>
|
||||
ImageClient::CreateImage(const uint32_t *aFormats,
|
||||
uint32_t aNumFormats)
|
||||
ImageClientSingle::CreateImage(const uint32_t *aFormats,
|
||||
uint32_t aNumFormats)
|
||||
{
|
||||
nsRefPtr<Image> img;
|
||||
for (uint32_t i = 0; i < aNumFormats; i++) {
|
||||
switch (aFormats[i]) {
|
||||
case PLANAR_YCBCR:
|
||||
if (gfxPlatform::GetPlatform()->UseDeprecatedTextures()) {
|
||||
img = new DeprecatedSharedPlanarYCbCrImage(GetForwarder());
|
||||
} else {
|
||||
img = new SharedPlanarYCbCrImage(this);
|
||||
}
|
||||
img = new SharedPlanarYCbCrImage(this);
|
||||
return img.forget();
|
||||
case SHARED_RGB:
|
||||
if (gfxPlatform::GetPlatform()->UseDeprecatedTextures()) {
|
||||
img = new DeprecatedSharedRGBImage(GetForwarder());
|
||||
} else {
|
||||
img = new SharedRGBImage(this);
|
||||
}
|
||||
img = new SharedRGBImage(this);
|
||||
return img.forget();
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
case GRALLOC_PLANAR_YCBCR:
|
||||
|
@ -479,5 +471,29 @@ ImageClient::CreateImage(const uint32_t *aFormats,
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<Image>
|
||||
DeprecatedImageClientSingle::CreateImage(const uint32_t *aFormats,
|
||||
uint32_t aNumFormats)
|
||||
{
|
||||
nsRefPtr<Image> img;
|
||||
for (uint32_t i = 0; i < aNumFormats; i++) {
|
||||
switch (aFormats[i]) {
|
||||
case PLANAR_YCBCR:
|
||||
img = new DeprecatedSharedPlanarYCbCrImage(GetForwarder());
|
||||
return img.forget();
|
||||
case SHARED_RGB:
|
||||
img = new DeprecatedSharedRGBImage(GetForwarder());
|
||||
return img.forget();
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
case GRALLOC_PLANAR_YCBCR:
|
||||
img = new GrallocImage();
|
||||
return img.forget();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ public:
|
|||
virtual void UpdatePictureRect(nsIntRect aPictureRect);
|
||||
|
||||
virtual already_AddRefed<Image> CreateImage(const uint32_t *aFormats,
|
||||
uint32_t aNumFormats);
|
||||
uint32_t aNumFormats) = 0;
|
||||
|
||||
protected:
|
||||
ImageClient(CompositableForwarder* aFwd, CompositableType aType);
|
||||
|
@ -93,6 +93,9 @@ public:
|
|||
CreateBufferTextureClient(gfx::SurfaceFormat aFormat) MOZ_OVERRIDE;
|
||||
|
||||
virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE;
|
||||
|
||||
virtual already_AddRefed<Image> CreateImage(const uint32_t *aFormats,
|
||||
uint32_t aNumFormats) MOZ_OVERRIDE;
|
||||
protected:
|
||||
RefPtr<TextureClient> mFrontBuffer;
|
||||
// Some layers may want to enforce some flags to all their textures
|
||||
|
@ -155,6 +158,9 @@ public:
|
|||
return mTextureInfo;
|
||||
}
|
||||
|
||||
virtual already_AddRefed<Image> CreateImage(const uint32_t *aFormats,
|
||||
uint32_t aNumFormats) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
RefPtr<DeprecatedTextureClient> mDeprecatedTextureClient;
|
||||
TextureInfo mTextureInfo;
|
||||
|
@ -189,6 +195,13 @@ public:
|
|||
MOZ_ASSERT(!aChild, "ImageClientBridge should not have IPDL actor");
|
||||
}
|
||||
|
||||
virtual already_AddRefed<Image> CreateImage(const uint32_t *aFormats,
|
||||
uint32_t aNumFormats) MOZ_OVERRIDE
|
||||
{
|
||||
NS_WARNING("Should not create an image through an ImageClientBridge");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
protected:
|
||||
uint64_t mAsyncContainerID;
|
||||
ShadowableLayer* mLayer;
|
||||
|
|
Загрузка…
Ссылка в новой задаче