Bug 929513 Part 1: Use gfx::IntSize for image layer sizes r=nical

This commit is contained in:
David Zbarsky 2013-10-27 17:53:26 -04:00
parent acca6b81bb
commit b28c18df90
31 changed files with 110 additions and 100 deletions

View File

@ -40,7 +40,7 @@ void VideoFrameContainer::SetCurrentFrame(const gfxIntSize& aIntrinsicSize,
mIntrinsicSizeChanged = true;
}
gfxIntSize oldFrameSize = mImageContainer->GetCurrentSize();
gfx::IntSize oldFrameSize = mImageContainer->GetCurrentSize();
TimeStamp lastPaintTime = mImageContainer->GetPaintTime();
if (!lastPaintTime.IsNull() && !mPaintTarget.IsNull()) {
mPaintDelay = lastPaintTime - mPaintTarget;
@ -57,7 +57,7 @@ void VideoFrameContainer::SetCurrentFrame(const gfxIntSize& aIntrinsicSize,
mImageContainer->UnlockCurrentImage();
mImageContainer->SetCurrentImage(aImage);
gfxIntSize newFrameSize = mImageContainer->GetCurrentSize();
gfx::IntSize newFrameSize = mImageContainer->GetCurrentSize();
if (oldFrameSize != newFrameSize) {
mImageSizeChanged = true;
}

View File

@ -13,6 +13,7 @@
#include "MediaDecoderStateMachine.h"
#include "ImageContainer.h"
#include "AbstractMediaDecoder.h"
#include "mozilla/gfx/Point.h"
namespace mozilla {
@ -169,10 +170,10 @@ bool MediaPluginReader::DecodeVideoFrame(bool &aKeyframeSkip,
currentImage = bufferCallback.GetImage();
int64_t pos = mDecoder->GetResource()->Tell();
nsIntRect picture = mPicture;
nsAutoPtr<VideoData> v;
if (currentImage) {
gfxIntSize frameSize = currentImage->GetSize();
gfx::IntSize frameSize = currentImage->GetSize();
if (frameSize.width != mInitialFrame.width ||
frameSize.height != mInitialFrame.height) {
// Frame size is different from what the container reports. This is legal,

View File

@ -15,6 +15,8 @@
#include "VideoUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsIPrefService.h"
#include "gfx2DGlue.h"
namespace mozilla {
NS_IMPL_ISUPPORTS1(MediaEngineTabVideoSource, MediaEngineVideoSource)
@ -154,7 +156,7 @@ NotifyPull(MediaStreamGraph*, SourceMediaStream* aSource, mozilla::TrackID aID,
if (delta > 0) {
// nullptr images are allowed
if (image) {
gfxIntSize size = image->GetSize();
gfxIntSize size = ThebesIntSize(image->GetSize());
segment.AppendFrame(image.forget(), delta, size);
} else {
segment.AppendFrame(nullptr, delta, gfxIntSize(0,0));

View File

@ -5,6 +5,7 @@
#include "D3D9SurfaceImage.h"
#include "gfxImageSurface.h"
#include "gfx2DGlue.h"
namespace mozilla {
namespace layers {
@ -109,7 +110,7 @@ D3D9SurfaceImage::GetDesc() const
return mDesc;
}
gfxIntSize
gfx::IntSize
D3D9SurfaceImage::GetSize()
{
return mSize;
@ -122,7 +123,7 @@ D3D9SurfaceImage::GetAsSurface()
HRESULT hr;
nsRefPtr<gfxImageSurface> surface =
new gfxImageSurface(mSize, gfxImageFormatRGB24);
new gfxImageSurface(ThebesIntSize(mSize), gfxImageFormatRGB24);
if (!surface->CairoSurface() || surface->CairoStatus()) {
NS_WARNING("Failed to created Cairo image surface for D3D9SurfaceImage.");

View File

@ -10,6 +10,7 @@
#include "ImageContainer.h"
#include "nsAutoPtr.h"
#include "d3d9.h"
#include "mozilla/gfx/Point.h"
namespace mozilla {
namespace layers {
@ -44,7 +45,7 @@ public:
// complete.
HANDLE GetShareHandle();
gfxIntSize GetSize() MOZ_OVERRIDE;
gfx::IntSize GetSize() MOZ_OVERRIDE;
already_AddRefed<gfxASurface> GetAsSurface() MOZ_OVERRIDE;
@ -54,7 +55,7 @@ private:
// is complete, whereupon the texture is safe to use.
void EnsureSynchronized();
gfxIntSize mSize;
gfx::IntSize mSize;
RefPtr<IDirect3DTexture9> mTexture;
RefPtr<IDirect3DQuery9> mQuery;
HANDLE mShareHandle;

View File

@ -229,12 +229,12 @@ GrallocImage::GetAsSurface()
return nullptr;
}
nsRefPtr<gfxImageSurface> imageSurface =
new gfxImageSurface(GetSize(), gfxImageFormatRGB16_565);
uint32_t width = GetSize().width;
uint32_t height = GetSize().height;
nsRefPtr<gfxImageSurface> imageSurface =
new gfxImageSurface(gfxIntSize(width, height), gfxImageFormatRGB16_565);
if (format == HAL_PIXEL_FORMAT_YCrCb_420_SP_ADRENO) {
// The Adreno hardware decoder aligns image dimensions to a multiple of 32,
// so we have to account for that here
@ -295,9 +295,7 @@ GrallocImage::GetTextureClient()
flags |= TEXTURE_RB_SWAPPED;
}
GrallocBufferActor* actor = static_cast<GrallocBufferActor*>(desc.bufferChild());
mTextureClient = new GrallocTextureClientOGL(actor,
gfx::ToIntSize(mSize),
flags);
mTextureClient = new GrallocTextureClientOGL(actor, mSize, flags);
mTextureClient->SetGraphicBufferLocked(mGraphicBuffer);
}
return mTextureClient;

View File

@ -16,6 +16,7 @@
#include "mozilla/layers/ImageBridgeChild.h" // for ImageBridgeChild
#include "mozilla/layers/ImageClient.h" // for ImageClient
#include "nsISupportsUtils.h" // for NS_IF_ADDREF
#include "gfx2DGlue.h"
#ifdef MOZ_WIDGET_GONK
#include "GrallocImages.h"
#endif
@ -49,7 +50,7 @@ Atomic<int32_t> Image::sSerialCounter(0);
already_AddRefed<Image>
ImageFactory::CreateImage(const ImageFormat *aFormats,
uint32_t aNumFormats,
const gfxIntSize &,
const gfx::IntSize &,
BufferRecycleBin *aRecycleBin)
{
if (!aNumFormats) {
@ -275,7 +276,7 @@ ImageContainer::LockCurrentImage()
}
already_AddRefed<gfxASurface>
ImageContainer::LockCurrentAsSurface(gfxIntSize *aSize, Image** aCurrentImage)
ImageContainer::LockCurrentAsSurface(gfx::IntSize *aSize, Image** aCurrentImage)
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
@ -333,7 +334,7 @@ ImageContainer::UnlockCurrentImage()
}
already_AddRefed<gfxASurface>
ImageContainer::GetCurrentAsSurface(gfxIntSize *aSize)
ImageContainer::GetCurrentAsSurface(gfx::IntSize *aSize)
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
@ -352,7 +353,7 @@ ImageContainer::GetCurrentAsSurface(gfxIntSize *aSize)
return mActiveImage->GetAsSurface();
}
gfxIntSize
gfx::IntSize
ImageContainer::GetCurrentSize()
{
ReentrantMonitorAutoEnter mon(mReentrantMonitor);
@ -366,7 +367,7 @@ ImageContainer::GetCurrentSize()
}
if (!mActiveImage) {
return gfxIntSize(0,0);
return gfx::IntSize(0,0);
}
return mActiveImage->GetSize();
@ -541,7 +542,7 @@ PlanarYCbCrImage::GetAsSurface()
}
gfxImageFormat format = GetOffscreenFormat();
gfxIntSize size(mSize);
gfx::IntSize size(mSize);
gfxUtils::GetYCbCrToRGBDestFormatAndSize(mData, format, size);
if (size.width > PlanarYCbCrImage::MAX_DIMENSION ||
size.height > PlanarYCbCrImage::MAX_DIMENSION) {
@ -550,7 +551,7 @@ PlanarYCbCrImage::GetAsSurface()
}
nsRefPtr<gfxImageSurface> imageSurface =
new gfxImageSurface(mSize, format);
new gfxImageSurface(ThebesIntSize(mSize), format);
gfxUtils::ConvertYCbCrToRGB(mData, format, mSize,
imageSurface->Data(),
@ -565,7 +566,7 @@ already_AddRefed<gfxASurface>
RemoteBitmapImage::GetAsSurface()
{
nsRefPtr<gfxImageSurface> newSurf =
new gfxImageSurface(mSize,
new gfxImageSurface(ThebesIntSize(mSize),
mFormat == RemoteImageData::BGRX32 ? gfxImageFormatRGB24 : gfxImageFormatARGB32);
for (int y = 0; y < mSize.height; y++) {

View File

@ -147,7 +147,7 @@ public:
void* GetImplData() { return mImplData; }
virtual already_AddRefed<gfxASurface> GetAsSurface() = 0;
virtual gfxIntSize GetSize() = 0;
virtual gfx::IntSize GetSize() = 0;
virtual nsIntRect GetPictureRect()
{
return nsIntRect(0, 0, GetSize().width, GetSize().height);
@ -262,7 +262,7 @@ protected:
virtual already_AddRefed<Image> CreateImage(const ImageFormat* aFormats,
uint32_t aNumFormats,
const gfxIntSize &aScaleHint,
const gfx::IntSize &aScaleHint,
BufferRecycleBin *aRecycleBin);
};
@ -483,7 +483,7 @@ public:
* the lock methods should be used to avoid the copy, however this should be
* avoided if the surface is required for a long period of time.
*/
already_AddRefed<gfxASurface> GetCurrentAsSurface(gfxIntSize* aSizeResult);
already_AddRefed<gfxASurface> GetCurrentAsSurface(gfx::IntSize* aSizeResult);
/**
* This is similar to GetCurrentAsSurface, however this does not make a copy
@ -493,7 +493,7 @@ public:
* type of image. Optionally a pointer can be passed to receive the current
* image.
*/
already_AddRefed<gfxASurface> LockCurrentAsSurface(gfxIntSize* aSizeResult,
already_AddRefed<gfxASurface> LockCurrentAsSurface(gfx::IntSize* aSizeResult,
Image** aCurrentImage = nullptr);
/**
@ -501,7 +501,7 @@ public:
* Can be called on any thread. This method takes mReentrantMonitor when accessing
* thread-shared state.
*/
gfxIntSize GetCurrentSize();
gfx::IntSize GetCurrentSize();
/**
* Sets a size that the image is expected to be rendered at.
@ -673,7 +673,7 @@ public:
~AutoLockImage() { if (mContainer) { mContainer->UnlockCurrentImage(); } }
Image* GetImage() { return mImage; }
const gfxIntSize &GetSize() { return mSize; }
const gfx::IntSize &GetSize() { return mSize; }
void Unlock() {
if (mContainer) {
@ -698,7 +698,7 @@ public:
private:
ImageContainer *mContainer;
nsRefPtr<Image> mImage;
gfxIntSize mSize;
gfx::IntSize mSize;
};
struct PlanarYCbCrData {
@ -819,7 +819,7 @@ public:
virtual bool IsValid() { return !!mBufferSize; }
virtual gfxIntSize GetSize() { return mSize; }
virtual gfx::IntSize GetSize() { return mSize; }
PlanarYCbCrImage(BufferRecycleBin *aRecycleBin);
@ -849,7 +849,7 @@ protected:
nsAutoArrayPtr<uint8_t> mBuffer;
uint32_t mBufferSize;
Data mData;
gfxIntSize mSize;
gfx::IntSize mSize;
gfxImageFormat mOffscreenFormat;
nsCountedRef<nsMainThreadSurfaceRef> mSurface;
nsRefPtr<BufferRecycleBin> mRecycleBin;
@ -885,12 +885,12 @@ public:
return surface.forget();
}
gfxIntSize GetSize() { return mSize; }
gfx::IntSize GetSize() { return mSize; }
CairoImage() : Image(nullptr, CAIRO_SURFACE) {}
nsCountedRef<nsMainThreadSurfaceRef> mSurface;
gfxIntSize mSize;
gfx::IntSize mSize;
};
class RemoteBitmapImage : public Image {
@ -899,11 +899,11 @@ public:
already_AddRefed<gfxASurface> GetAsSurface();
gfxIntSize GetSize() { return mSize; }
gfx::IntSize GetSize() { return mSize; }
unsigned char *mData;
int mStride;
gfxIntSize mSize;
gfx::IntSize mSize;
RemoteImageData::Format mFormat;
};

View File

@ -9,6 +9,7 @@
#include "gfxRect.h" // for gfxRect
#include "nsDebug.h" // for NS_ASSERTION
#include "nsISupportsImpl.h" // for ImageContainer::Release, etc
#include "gfx2DGlue.h"
namespace mozilla {
namespace layers {
@ -33,7 +34,7 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx3DMatrix& aTransformToSurfa
// Snap image edges to pixel boundaries
gfxRect sourceRect(0, 0, 0, 0);
if (mContainer) {
sourceRect.SizeTo(mContainer->GetCurrentSize());
sourceRect.SizeTo(ThebesIntSize(mContainer->GetCurrentSize()));
if (mScaleMode != SCALE_NONE &&
sourceRect.width != 0.0 && sourceRect.height != 0.0) {
NS_ASSERTION(mScaleMode == SCALE_STRETCH,

View File

@ -27,14 +27,14 @@ public:
struct Data {
gl::SharedTextureHandle mHandle;
gl::SharedTextureShareType mShareType;
gfxIntSize mSize;
gfx::IntSize mSize;
bool mInverted;
};
void SetData(const Data& aData) { mData = aData; }
const Data* GetData() { return &mData; }
gfxIntSize GetSize() { return mData.mSize; }
gfx::IntSize GetSize() { return mData.mSize; }
virtual already_AddRefed<gfxASurface> GetAsSurface() {
return gl::GLContextProvider::GetSharedHandleAsSurface(mData.mShareType, mData.mHandle);

View File

@ -186,7 +186,7 @@ public:
DeserializerToPlanarYCbCrImageData(deserializer, data);
gfxImageFormat format = gfxImageFormatRGB24;
gfxIntSize size;
gfx::IntSize size;
gfxUtils::GetYCbCrToRGBDestFormatAndSize(data, format, size);
if (size.width > PlanarYCbCrImage::MAX_DIMENSION ||
size.height > PlanarYCbCrImage::MAX_DIMENSION) {
@ -195,7 +195,7 @@ public:
}
mThebesSurface = mThebesImage =
new gfxImageSurface(size, format);
new gfxImageSurface(ThebesIntSize(size), format);
gfxUtils::ConvertYCbCrToRGB(data, format, size,
mThebesImage->Data(),

View File

@ -69,7 +69,7 @@ protected:
float aOpacity,
Layer* aMaskLayer);
gfxIntSize mSize;
gfx::IntSize mSize;
};
void
@ -94,7 +94,7 @@ BasicImageLayer::GetAndPaintCurrentImage(gfxContext* aContext,
nsRefPtr<gfxASurface> surface;
AutoLockImage autoLock(mContainer, getter_AddRefs(surface));
Image *image = autoLock.GetImage();
gfxIntSize size = mSize = autoLock.GetSize();
gfx::IntSize size = mSize = autoLock.GetSize();
if (!surface || surface->CairoStatus()) {
return nullptr;
@ -166,7 +166,7 @@ BasicImageLayer::GetAsSurface(gfxASurface** aSurface,
return false;
}
gfxIntSize dontCare;
gfx::IntSize dontCare;
nsRefPtr<gfxASurface> surface = mContainer->GetCurrentAsSurface(&dontCare);
*aSurface = surface.forget().get();
return true;

View File

@ -11,7 +11,6 @@
#include "gfxASurface.h" // for gfxASurface, etc
#include "gfxImageSurface.h" // for gfxImageSurface
#include "gfxPlatform.h" // for gfxPlatform, gfxImageFormat
#include "gfxPoint.h" // for gfxIntSize
#include "gfxUtils.h" // for gfxUtils
#include "mozilla/mozalloc.h" // for operator delete[], etc
#include "nsAutoPtr.h" // for nsRefPtr, nsAutoArrayPtr
@ -23,6 +22,7 @@
#ifdef XP_MACOSX
#include "gfxQuartzImageSurface.h"
#endif
#include "gfx2DGlue.h"
namespace mozilla {
namespace layers {
@ -30,7 +30,7 @@ namespace layers {
class BasicPlanarYCbCrImage : public PlanarYCbCrImage
{
public:
BasicPlanarYCbCrImage(const gfxIntSize& aScaleHint, gfxImageFormat aOffscreenFormat, BufferRecycleBin *aRecycleBin)
BasicPlanarYCbCrImage(const gfx::IntSize& aScaleHint, gfxImageFormat aOffscreenFormat, BufferRecycleBin *aRecycleBin)
: PlanarYCbCrImage(aRecycleBin)
, mScaleHint(aScaleHint)
, mDelayedConversion(false)
@ -54,7 +54,7 @@ public:
private:
nsAutoArrayPtr<uint8_t> mDecodedBuffer;
gfxIntSize mScaleHint;
gfx::IntSize mScaleHint;
int mStride;
bool mDelayedConversion;
};
@ -66,7 +66,7 @@ public:
virtual already_AddRefed<Image> CreateImage(const ImageFormat* aFormats,
uint32_t aNumFormats,
const gfxIntSize &aScaleHint,
const gfx::IntSize &aScaleHint,
BufferRecycleBin *aRecycleBin)
{
if (!aNumFormats) {
@ -101,7 +101,7 @@ BasicPlanarYCbCrImage::SetData(const Data& aData)
gfxImageFormat format = GetOffscreenFormat();
gfxIntSize size(mScaleHint);
gfx::IntSize size(mScaleHint);
gfxUtils::GetYCbCrToRGBDestFormatAndSize(aData, format, size);
if (size.width > PlanarYCbCrImage::MAX_DIMENSION ||
size.height > PlanarYCbCrImage::MAX_DIMENSION) {
@ -146,7 +146,7 @@ BasicPlanarYCbCrImage::GetAsSurface()
gfxImageFormat format = GetOffscreenFormat();
nsRefPtr<gfxImageSurface> imgSurface =
new gfxImageSurface(mDecodedBuffer, mSize, mStride, format);
new gfxImageSurface(mDecodedBuffer, ThebesIntSize(mSize), mStride, format);
if (!imgSurface || imgSurface->CairoStatus() != 0) {
return nullptr;
}

View File

@ -635,7 +635,7 @@ bool AutoLockShmemClient::Update(Image* aImage,
return false;
}
gfxIntSize size = aImage->GetSize();
gfx::IntSize size = aImage->GetSize();
gfxContentType contentType = aSurface->GetContentType();
bool isOpaque = (aContentFlags & Layer::CONTENT_OPAQUE);
@ -643,7 +643,7 @@ bool AutoLockShmemClient::Update(Image* aImage,
isOpaque) {
contentType = GFX_CONTENT_COLOR;
}
mDeprecatedTextureClient->EnsureAllocated(gfx::IntSize(size.width, size.height), contentType);
mDeprecatedTextureClient->EnsureAllocated(size, contentType);
OpenMode mode = mDeprecatedTextureClient->GetAccessMode() == DeprecatedTextureClient::ACCESS_READ_WRITE
? OPEN_READ_WRITE

View File

@ -12,6 +12,7 @@
#include "D3D9SurfaceImage.h"
#include "gfxWindowsPlatform.h"
#include "gfx2DGlue.h"
namespace mozilla {
namespace layers {
@ -20,7 +21,7 @@ static already_AddRefed<ID3D10Texture2D>
DataToTexture(ID3D10Device *aDevice,
unsigned char *data,
int stride,
const gfxIntSize &aSize)
const gfx::IntSize &aSize)
{
D3D10_SUBRESOURCE_DATA srdata;
@ -47,7 +48,7 @@ DataToTexture(ID3D10Device *aDevice,
static already_AddRefed<ID3D10Texture2D>
SurfaceToTexture(ID3D10Device *aDevice,
gfxASurface *aSurface,
const gfxIntSize &aSize)
const gfx::IntSize &aSize)
{
if (!aSurface) {
return nullptr;
@ -68,7 +69,7 @@ SurfaceToTexture(ID3D10Device *aDevice,
nsRefPtr<gfxImageSurface> imageSurface = aSurface->GetAsImageSurface();
if (!imageSurface) {
imageSurface = new gfxImageSurface(aSize,
imageSurface = new gfxImageSurface(ThebesIntSize(aSize),
gfxImageFormatARGB32);
nsRefPtr<gfxContext> context = new gfxContext(imageSurface);
@ -202,7 +203,7 @@ ImageLayerD3D10::RenderLayer()
return;
}
gfxIntSize size = image->GetSize();
gfx::IntSize size = image->GetSize();
SetEffectTransformAndOpacity();
@ -410,7 +411,7 @@ ImageLayerD3D10::GetAsTexture(gfxIntSize* aSize)
return nullptr;
}
*aSize = image->GetSize();
*aSize = ThebesIntSize(image->GetSize());
bool dontCare;
nsRefPtr<ID3D10ShaderResourceView> result = GetImageSRView(image, dontCare);
return result.forget();
@ -465,9 +466,10 @@ RemoteDXGITextureImage::GetAsSurface()
keyedMutex->ReleaseSync(0);
nsRefPtr<gfxImageSurface> surface =
new gfxImageSurface(mSize, mFormat == RemoteImageData::BGRX32 ?
gfxImageFormatRGB24 :
gfxImageFormatARGB32);
new gfxImageSurface(ThebesIntSize(mSize),
mFormat == RemoteImageData::BGRX32 ?
gfxImageFormatRGB24 :
gfxImageFormatARGB32);
if (!surface->CairoSurface() || surface->CairoStatus()) {
NS_WARNING("Failed to created image surface for DXGI texture.");

View File

@ -10,6 +10,7 @@
#include "ImageLayers.h"
#include "ImageContainer.h"
#include "yuv_convert.h"
#include "mozilla/gfx/Point.h"
namespace mozilla {
namespace layers {
@ -60,11 +61,11 @@ public:
already_AddRefed<gfxASurface> GetAsSurface();
gfxIntSize GetSize() { return mSize; }
gfx::IntSize GetSize() { return mSize; }
TextureD3D10BackendData *GetD3D10TextureBackendData(ID3D10Device *aDevice);
gfxIntSize mSize;
gfx::IntSize mSize;
RemoteImageData::Format mFormat;
HANDLE mHandle;
};

View File

@ -16,6 +16,7 @@
#include "nsIConsoleService.h"
#include "Nv3DVUtils.h"
#include "D3D9SurfaceImage.h"
#include "gfx2DGlue.h"
namespace mozilla {
namespace layers {
@ -34,7 +35,7 @@ static already_AddRefed<IDirect3DTexture9>
DataToTexture(IDirect3DDevice9 *aDevice,
unsigned char *aData,
int aStride,
const gfxIntSize &aSize,
const gfx::IntSize &aSize,
_D3DFORMAT aFormat)
{
nsRefPtr<IDirect3DTexture9> texture;
@ -130,13 +131,13 @@ OpenSharedTexture(const D3DSURFACE_DESC& aDesc,
static already_AddRefed<IDirect3DTexture9>
SurfaceToTexture(IDirect3DDevice9 *aDevice,
gfxASurface *aSurface,
const gfxIntSize &aSize)
const gfx::IntSize &aSize)
{
nsRefPtr<gfxImageSurface> imageSurface = aSurface->GetAsImageSurface();
if (!imageSurface) {
imageSurface = new gfxImageSurface(aSize,
imageSurface = new gfxImageSurface(ThebesIntSize(aSize),
gfxImageFormatARGB32);
nsRefPtr<gfxContext> context = new gfxContext(imageSurface);
@ -403,7 +404,7 @@ ImageLayerD3D9::RenderLayer()
SetShaderTransformAndOpacity();
gfxIntSize size = image->GetSize();
gfx::IntSize size = image->GetSize();
if (image->GetFormat() == CAIRO_SURFACE ||
image->GetFormat() == REMOTE_IMAGE_BITMAP ||
@ -564,7 +565,7 @@ ImageLayerD3D9::GetAsTexture(gfxIntSize* aSize)
}
bool dontCare;
*aSize = image->GetSize();
*aSize = gfx::ThebesIntSize(image->GetSize());
nsRefPtr<IDirect3DTexture9> result = GetTexture(image, dontCare);
return result.forget();
}

View File

@ -54,7 +54,7 @@ struct SurfaceDescriptorD3D10 {
struct SharedTextureDescriptor {
SharedTextureShareType shareType;
SharedTextureHandle handle;
nsIntSize size;
IntSize size;
bool inverted;
};

View File

@ -100,7 +100,7 @@ DeprecatedSharedRGBImage::GetBufferSize()
return mSize.width * mSize.height * gfxASurface::BytesPerPixel(mImageFormat);
}
gfxIntSize
gfx::IntSize
DeprecatedSharedRGBImage::GetSize()
{
return mSize;
@ -207,10 +207,10 @@ SharedRGBImage::GetBuffer()
: nullptr;
}
gfxIntSize
gfx::IntSize
SharedRGBImage::GetSize()
{
return ThebesIntSize(mSize);
return mSize;
}
size_t

View File

@ -57,7 +57,7 @@ public:
virtual uint8_t *GetBuffer() MOZ_OVERRIDE;
gfxIntSize GetSize();
gfx::IntSize GetSize();
size_t GetBufferSize();
static uint8_t BytesPerPixel(gfxImageFormat aImageFormat);
@ -89,7 +89,7 @@ public:
TextureClient* GetTextureClient() MOZ_OVERRIDE { return nullptr; }
protected:
gfxIntSize mSize;
gfx::IntSize mSize;
gfxImageFormat mImageFormat;
ISurfaceAllocator* mSurfaceAllocator;
@ -114,7 +114,7 @@ public:
virtual uint8_t* GetBuffer() MOZ_OVERRIDE;
gfxIntSize GetSize();
gfx::IntSize GetSize();
size_t GetBufferSize();

View File

@ -374,7 +374,7 @@ ImageLayerOGL::RenderLayer(int,
}
gl()->ApplyFilterToBoundTexture(handleDetails.mTarget, mFilter);
program->SetLayerQuadRect(nsIntRect(nsIntPoint(0, 0), data->mSize));
program->SetLayerQuadRect(gfx::Rect(0, 0, data->mSize.width, data->mSize.height));
mOGLManager->BindAndDrawQuad(program, data->mInverted);
gl()->fBindTexture(handleDetails.mTarget, 0);
gl()->DetachSharedHandle(data->mShareType, data->mHandle);
@ -515,17 +515,17 @@ ImageLayerOGL::AllocateTexturesCairo(CairoImage *aImage)
* If the OpenGL setup is capable of using non-POT textures, then it
* will just return aSize.
*/
static gfxIntSize
CalculatePOTSize(const gfxIntSize& aSize, GLContext* gl)
static gfx::IntSize
CalculatePOTSize(const gfx::IntSize& aSize, GLContext* gl)
{
if (gl->CanUploadNonPowerOfTwo())
return aSize;
return gfxIntSize(NextPowerOfTwo(aSize.width), NextPowerOfTwo(aSize.height));
return gfx::IntSize(NextPowerOfTwo(aSize.width), NextPowerOfTwo(aSize.height));
}
bool
ImageLayerOGL::LoadAsTexture(GLuint aTextureUnit, gfxIntSize* aSize)
ImageLayerOGL::LoadAsTexture(GLuint aTextureUnit, gfx::IntSize* aSize)
{
// this method shares a lot of code with RenderLayer, but it doesn't seem
// to be possible to factor it out into a helper method

View File

@ -114,7 +114,7 @@ public:
// LayerOGL Implementation
virtual void Destroy() { mDestroyed = true; }
virtual Layer* GetLayer();
virtual bool LoadAsTexture(GLuint aTextureUnit, gfxIntSize* aSize);
virtual bool LoadAsTexture(GLuint aTextureUnit, gfx::IntSize* aSize);
virtual void RenderLayer(int aPreviousFrameBuffer,
const nsIntPoint& aOffset);
@ -156,7 +156,7 @@ struct CairoOGLBackendData : public ImageBackendData
CairoOGLBackendData() : mLayerProgram(RGBALayerProgramType) {}
GLTexture mTexture;
ShaderProgramType mLayerProgram;
gfxIntSize mTextureSize;
gfx::IntSize mTextureSize;
};
} /* layers */

View File

@ -493,7 +493,7 @@ public:
* Any layer that can be used as a mask layer should override this method.
* aSize will contain the size of the image.
*/
virtual bool LoadAsTexture(GLuint aTextureUnit, gfxIntSize* aSize)
virtual bool LoadAsTexture(GLuint aTextureUnit, gfx::IntSize* aSize)
{
NS_WARNING("LoadAsTexture called without being overriden");
return false;

View File

@ -446,7 +446,7 @@ ShaderProgramOGL::LoadMask(Layer* aMaskLayer)
return false;
}
gfxIntSize size;
gfx::IntSize size;
if (!static_cast<LayerOGL*>(aMaskLayer->ImplData())
->LoadAsTexture(LOCAL_GL_TEXTURE0 + mProfile.mTextureCount - 1, &size)){
return false;
@ -459,7 +459,7 @@ ShaderProgramOGL::LoadMask(Layer* aMaskLayer)
mozilla::DebugOnly<bool> isMask2D =
aMaskLayer->GetEffectiveTransform().CanDraw2D(&maskTransform);
NS_ASSERTION(isMask2D, "How did we end up with a 3D transform here?!");
gfxRect bounds = gfxRect(gfxPoint(), size);
gfxRect bounds = gfxRect(0, 0, size.width, size.height);
bounds = maskTransform.TransformBounds(bounds);
gfx3DMatrix m;

View File

@ -100,7 +100,7 @@ CreateTextureHostOGL(uint64_t aID,
result = new SharedTextureHostOGL(aID, aFlags,
desc.shareType(),
desc.handle(),
gfx::ToIntSize(desc.size()),
desc.size(),
desc.inverted());
break;
}
@ -617,8 +617,7 @@ SharedDeprecatedTextureHostOGL::SwapTexturesImpl(const SurfaceDescriptor& aImage
SharedTextureDescriptor texture = aImage.get_SharedTextureDescriptor();
SharedTextureHandle newHandle = texture.handle();
nsIntSize size = texture.size();
mSize = gfx::IntSize(size.width, size.height);
mSize = texture.size();
if (texture.inverted()) {
mFlags |= TEXTURE_NEEDS_Y_FLIP;
}

View File

@ -685,7 +685,7 @@ gfxUtils::GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut)
void
gfxUtils::GetYCbCrToRGBDestFormatAndSize(const PlanarYCbCrData& aData,
gfxImageFormat& aSuggestedFormat,
gfxIntSize& aSuggestedSize)
gfx::IntSize& aSuggestedSize)
{
gfx::YUVType yuvtype =
gfx::TypeFromSize(aData.mYSize.width,
@ -739,7 +739,7 @@ gfxUtils::GetYCbCrToRGBDestFormatAndSize(const PlanarYCbCrData& aData,
void
gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData,
const gfxImageFormat& aDestFormat,
const gfxIntSize& aDestSize,
const gfx::IntSize& aDestSize,
unsigned char* aDestBuffer,
int32_t aStride)
{

View File

@ -134,7 +134,7 @@ public:
static void
GetYCbCrToRGBDestFormatAndSize(const mozilla::layers::PlanarYCbCrData& aData,
gfxImageFormat& aSuggestedFormat,
gfxIntSize& aSuggestedSize);
mozilla::gfx::IntSize& aSuggestedSize);
/**
* Convert YCbCrImage into RGB aDestBuffer
@ -144,7 +144,7 @@ public:
static void
ConvertYCbCrToRGB(const mozilla::layers::PlanarYCbCrData& aData,
const gfxImageFormat& aDestFormat,
const gfxIntSize& aDestSize,
const mozilla::gfx::IntSize& aDestSize,
unsigned char* aDestBuffer,
int32_t aStride);

View File

@ -1950,7 +1950,7 @@ nsDisplayBackgroundImage::GetLayerState(nsDisplayListBuilder* aBuilder,
}
if (!animated) {
gfxSize imageSize = mImageContainer->GetCurrentSize();
mozilla::gfx::IntSize imageSize = mImageContainer->GetCurrentSize();
NS_ASSERTION(imageSize.width != 0 && imageSize.height != 0, "Invalid image size!");
gfxRect destRect = mDestRect;
@ -1997,7 +1997,7 @@ nsDisplayBackgroundImage::ConfigureLayer(ImageLayer* aLayer, const nsIntPoint& a
{
aLayer->SetFilter(nsLayoutUtils::GetGraphicsFilterForFrame(mFrame));
gfxIntSize imageSize = mImageContainer->GetCurrentSize();
mozilla::gfx::IntSize imageSize = mImageContainer->GetCurrentSize();
NS_ASSERTION(imageSize.width != 0 && imageSize.height != 0, "Invalid image size!");
gfxMatrix transform;

View File

@ -82,6 +82,7 @@
#include "nsAnimationManager.h"
#include "nsTransitionManager.h"
#include "RestyleManager.h"
#include "gfx2DGlue.h"
using namespace mozilla;
using namespace mozilla::css;
@ -4899,24 +4900,25 @@ nsLayoutUtils::SurfaceFromElement(HTMLVideoElement* aElement,
if (!container)
return result;
gfxIntSize size;
gfx::IntSize size;
nsRefPtr<gfxASurface> surf = container->GetCurrentAsSurface(&size);
if (!surf)
return result;
gfxIntSize gfxSize = ThebesIntSize(size);
if (wantImageSurface && surf->GetType() != gfxSurfaceTypeImage) {
nsRefPtr<gfxImageSurface> imgSurf =
new gfxImageSurface(size, gfxImageFormatARGB32);
new gfxImageSurface(gfxSize, gfxImageFormatARGB32);
nsRefPtr<gfxContext> ctx = new gfxContext(imgSurf);
ctx->SetOperator(gfxContext::OPERATOR_SOURCE);
ctx->DrawSurface(surf, size);
ctx->DrawSurface(surf, gfxSize);
surf = imgSurf;
}
result.mCORSUsed = aElement->GetCORSMode() != CORS_NONE;
result.mSurface = surf;
result.mSize = size;
result.mSize = gfxSize;
result.mPrincipal = principal.forget();
result.mIsWriteOnly = false;

View File

@ -184,10 +184,10 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder,
nsRefPtr<ImageContainer> container = element->GetImageContainer();
if (!container)
return nullptr;
// Retrieve the size of the decoded video frame, before being scaled
// by pixel aspect ratio.
gfxIntSize frameSize = container->GetCurrentSize();
gfx::IntSize frameSize = container->GetCurrentSize();
if (frameSize.width == 0 || frameSize.height == 0) {
// No image, or zero-sized image. No point creating a layer.
return nullptr;

View File

@ -837,7 +837,7 @@ void MediaPipelineTransmit::PipelineListener::ProcessVideoChunk(
return;
}
gfxIntSize size = img->GetSize();
gfx::IntSize size = img->GetSize();
if ((size.width & 1) != 0 || (size.height & 1) != 0) {
MOZ_ASSERT(false, "Can't handle odd-sized images");
return;