Decouple MacIOSurfaceImage from ImageContainer. (bug 1222910, r=mstange)

This commit is contained in:
David Anderson 2015-11-17 00:09:00 -08:00
parent ec187774dc
commit 7970ac45fd
6 changed files with 18 additions and 26 deletions

View File

@ -397,11 +397,7 @@ AppleVDADecoder::OutputFrame(CVPixelBufferRef aImage,
RefPtr<MacIOSurface> macSurface = new MacIOSurface(surface);
RefPtr<layers::Image> image =
mImageContainer->CreateImage(ImageFormat::MAC_IOSURFACE);
layers::MacIOSurfaceImage* videoImage =
static_cast<layers::MacIOSurfaceImage*>(image.get());
videoImage->SetSurface(macSurface);
RefPtr<layers::Image> image = new MacIOSurfaceImage(macSurface);
data =
VideoData::CreateFromImage(info,

View File

@ -694,17 +694,8 @@ PluginInstanceParent::GetImageContainer(ImageContainer** aContainer)
#ifdef XP_MACOSX
if (ioSurface) {
RefPtr<Image> image = container->CreateImage(ImageFormat::MAC_IOSURFACE);
if (!image) {
return NS_ERROR_FAILURE;
}
NS_ASSERTION(image->GetFormat() == ImageFormat::MAC_IOSURFACE, "Wrong format?");
MacIOSurfaceImage* pluginImage = static_cast<MacIOSurfaceImage*>(image.get());
pluginImage->SetSurface(ioSurface);
container->SetCurrentImageInTransaction(pluginImage);
RefPtr<Image> image = new MacIOSurfaceImage(ioSurface);
container->SetCurrentImageInTransaction(image);
NS_IF_ADDREF(container);
*aContainer = container;

View File

@ -892,7 +892,7 @@ GLBlitHelper::BlitImageToFramebuffer(layers::Image* srcImage,
#ifdef XP_MACOSX
case ConvertMacIOSurfaceImage:
return BlitMacIOSurfaceImage(static_cast<layers::MacIOSurfaceImage*>(srcImage));
return BlitMacIOSurfaceImage(srcImage->AsMacIOSurfaceImage());
#endif
default:

View File

@ -30,7 +30,6 @@
#ifdef XP_MACOSX
#include "mozilla/gfx/QuartzSupport.h"
#include "MacIOSurfaceImage.h"
#endif
#ifdef XP_WIN
@ -75,12 +74,6 @@ ImageFactory::CreateImage(ImageFormat aFormat,
img = new RecyclingPlanarYCbCrImage(aRecycleBin);
return img.forget();
}
#ifdef XP_MACOSX
if (aFormat == ImageFormat::MAC_IOSURFACE) {
img = new MacIOSurfaceImage();
return img.forget();
}
#endif
return nullptr;
}

View File

@ -120,6 +120,9 @@ class EGLImageImage;
#ifdef MOZ_WIDGET_ANDROID
class SurfaceTextureImage;
#endif
#ifdef XP_MACOSX
class MacIOSurfaceImage;
#endif
/**
* A class representing a buffer of pixel data. The data can be in one
@ -177,6 +180,9 @@ public:
#ifdef MOZ_WIDGET_ANDROID
virtual SurfaceTextureImage* AsSurfaceTextureImage() { return nullptr; }
#endif
#ifdef XP_MACOSX
virtual MacIOSurfaceImage* AsMacIOSurfaceImage() { return nullptr; }
#endif
protected:
Image(void* aImplData, ImageFormat aFormat) :

View File

@ -17,7 +17,11 @@ namespace layers {
class MacIOSurfaceImage : public Image {
public:
void SetSurface(MacIOSurface* aSurface) { mSurface = aSurface; }
explicit MacIOSurfaceImage(MacIOSurface* aSurface)
: Image(nullptr, ImageFormat::MAC_IOSURFACE),
mSurface(aSurface)
{}
MacIOSurface* GetSurface() { return mSurface; }
gfx::IntSize GetSize() override {
@ -28,7 +32,9 @@ public:
virtual TextureClient* GetTextureClient(CompositableClient* aClient) override;
MacIOSurfaceImage() : Image(nullptr, ImageFormat::MAC_IOSURFACE) {}
virtual MacIOSurfaceImage* AsMacIOSurfaceImage() override {
return this;
}
private:
RefPtr<MacIOSurface> mSurface;