зеркало из https://github.com/mozilla/gecko-dev.git
Bug 860615 - Remove MacIOSurfaceImage. r=BenWa
This commit is contained in:
Родитель
a8572d46e2
Коммит
7702f1de96
|
@ -70,12 +70,6 @@ ImageFactory::CreateImage(const ImageFormat *aFormats,
|
|||
img = new SharedTextureImage();
|
||||
return img.forget();
|
||||
}
|
||||
#ifdef XP_MACOSX
|
||||
if (FormatInList(aFormats, aNumFormats, MAC_IO_SURFACE)) {
|
||||
img = new MacIOSurfaceImage();
|
||||
return img.forget();
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
if (FormatInList(aFormats, aNumFormats, GONK_IO_SURFACE)) {
|
||||
img = new GonkIOSurfaceImage();
|
||||
|
@ -539,38 +533,6 @@ PlanarYCbCrImage::GetAsSurface()
|
|||
return imageSurface.forget().get();
|
||||
}
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
void
|
||||
MacIOSurfaceImage::SetData(const Data& aData)
|
||||
{
|
||||
mIOSurface = MacIOSurface::LookupSurface(aData.mIOSurface->GetIOSurfaceID());
|
||||
mSize = gfxIntSize(mIOSurface->GetWidth(), mIOSurface->GetHeight());
|
||||
}
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
MacIOSurfaceImage::GetAsSurface()
|
||||
{
|
||||
mIOSurface->Lock();
|
||||
size_t bytesPerRow = mIOSurface->GetBytesPerRow();
|
||||
size_t ioWidth = mIOSurface->GetWidth();
|
||||
size_t ioHeight = mIOSurface->GetHeight();
|
||||
|
||||
unsigned char* ioData = (unsigned char*)mIOSurface->GetBaseAddress();
|
||||
|
||||
nsRefPtr<gfxImageSurface> imgSurface =
|
||||
new gfxImageSurface(gfxIntSize(ioWidth, ioHeight), gfxASurface::ImageFormatARGB32);
|
||||
|
||||
for (int i = 0; i < ioHeight; i++) {
|
||||
memcpy(imgSurface->Data() + i * imgSurface->Stride(),
|
||||
ioData + i * bytesPerRow, ioWidth * 4);
|
||||
}
|
||||
|
||||
mIOSurface->Unlock();
|
||||
|
||||
return imgSurface.forget();
|
||||
}
|
||||
#endif
|
||||
|
||||
already_AddRefed<gfxASurface>
|
||||
RemoteBitmapImage::GetAsSurface()
|
||||
{
|
||||
|
|
|
@ -20,10 +20,6 @@ struct ID3D10Device;
|
|||
struct ID3D10ShaderResourceView;
|
||||
#endif
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
#include "mozilla/gfx/MacIOSurface.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
# include <ui/GraphicBuffer.h>
|
||||
#endif
|
||||
|
@ -796,46 +792,6 @@ public:
|
|||
gfxIntSize mSize;
|
||||
};
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
class THEBES_API MacIOSurfaceImage : public Image {
|
||||
public:
|
||||
struct Data {
|
||||
MacIOSurface* mIOSurface;
|
||||
};
|
||||
|
||||
MacIOSurfaceImage()
|
||||
: Image(NULL, MAC_IO_SURFACE)
|
||||
, mSize(0, 0)
|
||||
{}
|
||||
|
||||
virtual ~MacIOSurfaceImage()
|
||||
{ }
|
||||
|
||||
/**
|
||||
* This can only be called on the main thread. It may add a reference
|
||||
* to the surface (which will eventually be released on the main thread).
|
||||
* The surface must not be modified after this call!!!
|
||||
*/
|
||||
virtual void SetData(const Data& aData);
|
||||
|
||||
virtual gfxIntSize GetSize()
|
||||
{
|
||||
return mSize;
|
||||
}
|
||||
|
||||
MacIOSurface* GetIOSurface()
|
||||
{
|
||||
return mIOSurface;
|
||||
}
|
||||
|
||||
virtual already_AddRefed<gfxASurface> GetAsSurface();
|
||||
|
||||
private:
|
||||
gfxIntSize mSize;
|
||||
RefPtr<MacIOSurface> mIOSurface;
|
||||
};
|
||||
#endif
|
||||
|
||||
class RemoteBitmapImage : public Image {
|
||||
public:
|
||||
RemoteBitmapImage() : Image(NULL, REMOTE_IMAGE_BITMAP) {}
|
||||
|
|
|
@ -45,13 +45,6 @@ enum ImageFormat {
|
|||
*/
|
||||
CAIRO_SURFACE,
|
||||
|
||||
/**
|
||||
* The MAC_IO_SURFACE format creates a MacIOSurfaceImage.
|
||||
*
|
||||
* It wraps an IOSurface object and binds it directly to a GL texture.
|
||||
*/
|
||||
MAC_IO_SURFACE,
|
||||
|
||||
/**
|
||||
* The GONK_IO_SURFACE format creates a GonkIOSurfaceImage.
|
||||
*
|
||||
|
|
|
@ -160,34 +160,6 @@ struct THEBES_API ImageOGLBackendData : public ImageBackendData
|
|||
GLTexture mTexture;
|
||||
};
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
void
|
||||
AllocateTextureIOSurface(MacIOSurfaceImage *aIOImage, mozilla::gl::GLContext* aGL)
|
||||
{
|
||||
nsAutoPtr<ImageOGLBackendData> backendData(
|
||||
new ImageOGLBackendData);
|
||||
|
||||
backendData->mTexture.Allocate(aGL);
|
||||
aGL->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, backendData->mTexture.GetTextureID());
|
||||
aGL->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB,
|
||||
LOCAL_GL_TEXTURE_MIN_FILTER,
|
||||
LOCAL_GL_NEAREST);
|
||||
aGL->fTexParameteri(LOCAL_GL_TEXTURE_RECTANGLE_ARB,
|
||||
LOCAL_GL_TEXTURE_MAG_FILTER,
|
||||
LOCAL_GL_NEAREST);
|
||||
|
||||
void *nativeCtx = aGL->GetNativeData(GLContext::NativeGLContext);
|
||||
|
||||
aIOImage->GetIOSurface()->CGLTexImageIOSurface2D(nativeCtx,
|
||||
LOCAL_GL_RGBA, LOCAL_GL_BGRA,
|
||||
LOCAL_GL_UNSIGNED_INT_8_8_8_8_REV, 0);
|
||||
|
||||
aGL->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
|
||||
aIOImage->SetBackendData(LAYERS_OPENGL, backendData.forget());
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
AllocateTextureSharedTexture(SharedTextureImage *aTexImage, mozilla::gl::GLContext* aGL, GLenum aTarget)
|
||||
{
|
||||
|
@ -361,46 +333,6 @@ ImageLayerOGL::RenderLayer(int,
|
|||
program->LoadMask(GetMaskLayer());
|
||||
|
||||
mOGLManager->BindAndDrawQuad(program);
|
||||
#ifdef XP_MACOSX
|
||||
} else if (image->GetFormat() == MAC_IO_SURFACE) {
|
||||
MacIOSurfaceImage *ioImage =
|
||||
static_cast<MacIOSurfaceImage*>(image);
|
||||
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
|
||||
if (!ioImage->GetBackendData(LAYERS_OPENGL)) {
|
||||
AllocateTextureIOSurface(ioImage, gl());
|
||||
}
|
||||
|
||||
ImageOGLBackendData *data =
|
||||
static_cast<ImageOGLBackendData*>(ioImage->GetBackendData(LAYERS_OPENGL));
|
||||
|
||||
gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
|
||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, data->mTexture.GetTextureID());
|
||||
|
||||
ShaderProgramOGL *program =
|
||||
mOGLManager->GetProgram(gl::RGBARectLayerProgramType, GetMaskLayer());
|
||||
|
||||
program->Activate();
|
||||
if (program->GetTexCoordMultiplierUniformLocation() != -1) {
|
||||
// 2DRect case, get the multiplier right for a sampler2DRect
|
||||
program->SetTexCoordMultiplier(ioImage->GetSize().width, ioImage->GetSize().height);
|
||||
} else {
|
||||
NS_ASSERTION(0, "no rects?");
|
||||
}
|
||||
|
||||
program->SetLayerQuadRect(nsIntRect(0, 0,
|
||||
ioImage->GetSize().width,
|
||||
ioImage->GetSize().height));
|
||||
program->SetLayerTransform(GetEffectiveTransform());
|
||||
program->SetLayerOpacity(GetEffectiveOpacity());
|
||||
program->SetRenderOffset(aOffset);
|
||||
program->SetTextureUnit(0);
|
||||
program->LoadMask(GetMaskLayer());
|
||||
|
||||
mOGLManager->BindAndDrawQuad(program);
|
||||
gl()->fBindTexture(LOCAL_GL_TEXTURE_RECTANGLE_ARB, 0);
|
||||
#endif
|
||||
} else if (image->GetFormat() == SHARED_TEXTURE) {
|
||||
SharedTextureImage* texImage =
|
||||
static_cast<SharedTextureImage*>(image);
|
||||
|
|
Загрузка…
Ссылка в новой задаче