diff --git a/content/media/VideoFrameContainer.cpp b/content/media/VideoFrameContainer.cpp index 66ff347b006..b6e8b0cc426 100644 --- a/content/media/VideoFrameContainer.cpp +++ b/content/media/VideoFrameContainer.cpp @@ -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; } diff --git a/content/media/plugins/MediaPluginReader.cpp b/content/media/plugins/MediaPluginReader.cpp index be6b8762bf2..3691f1aa8e2 100644 --- a/content/media/plugins/MediaPluginReader.cpp +++ b/content/media/plugins/MediaPluginReader.cpp @@ -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 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, diff --git a/content/media/webrtc/MediaEngineTabVideoSource.cpp b/content/media/webrtc/MediaEngineTabVideoSource.cpp index 01eef2c6491..dec2c0b5dd3 100644 --- a/content/media/webrtc/MediaEngineTabVideoSource.cpp +++ b/content/media/webrtc/MediaEngineTabVideoSource.cpp @@ -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)); diff --git a/gfx/layers/D3D9SurfaceImage.cpp b/gfx/layers/D3D9SurfaceImage.cpp index 7d75bc5a3ad..955bd5e815e 100644 --- a/gfx/layers/D3D9SurfaceImage.cpp +++ b/gfx/layers/D3D9SurfaceImage.cpp @@ -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 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."); diff --git a/gfx/layers/D3D9SurfaceImage.h b/gfx/layers/D3D9SurfaceImage.h index e71397835ba..010b16a8aaf 100644 --- a/gfx/layers/D3D9SurfaceImage.h +++ b/gfx/layers/D3D9SurfaceImage.h @@ -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 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 mTexture; RefPtr mQuery; HANDLE mShareHandle; diff --git a/gfx/layers/GrallocImages.cpp b/gfx/layers/GrallocImages.cpp index 856d80ba79b..c97239fcf99 100644 --- a/gfx/layers/GrallocImages.cpp +++ b/gfx/layers/GrallocImages.cpp @@ -229,12 +229,12 @@ GrallocImage::GetAsSurface() return nullptr; } - nsRefPtr imageSurface = - new gfxImageSurface(GetSize(), gfxImageFormatRGB16_565); - uint32_t width = GetSize().width; uint32_t height = GetSize().height; + nsRefPtr 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(desc.bufferChild()); - mTextureClient = new GrallocTextureClientOGL(actor, - gfx::ToIntSize(mSize), - flags); + mTextureClient = new GrallocTextureClientOGL(actor, mSize, flags); mTextureClient->SetGraphicBufferLocked(mGraphicBuffer); } return mTextureClient; diff --git a/gfx/layers/ImageContainer.cpp b/gfx/layers/ImageContainer.cpp index d3325ff58ba..99e033cb8b0 100644 --- a/gfx/layers/ImageContainer.cpp +++ b/gfx/layers/ImageContainer.cpp @@ -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 Image::sSerialCounter(0); already_AddRefed 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 -ImageContainer::LockCurrentAsSurface(gfxIntSize *aSize, Image** aCurrentImage) +ImageContainer::LockCurrentAsSurface(gfx::IntSize *aSize, Image** aCurrentImage) { ReentrantMonitorAutoEnter mon(mReentrantMonitor); @@ -333,7 +334,7 @@ ImageContainer::UnlockCurrentImage() } already_AddRefed -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 imageSurface = - new gfxImageSurface(mSize, format); + new gfxImageSurface(ThebesIntSize(mSize), format); gfxUtils::ConvertYCbCrToRGB(mData, format, mSize, imageSurface->Data(), @@ -565,7 +566,7 @@ already_AddRefed RemoteBitmapImage::GetAsSurface() { nsRefPtr newSurf = - new gfxImageSurface(mSize, + new gfxImageSurface(ThebesIntSize(mSize), mFormat == RemoteImageData::BGRX32 ? gfxImageFormatRGB24 : gfxImageFormatARGB32); for (int y = 0; y < mSize.height; y++) { diff --git a/gfx/layers/ImageContainer.h b/gfx/layers/ImageContainer.h index 933ce00a68d..b1130b17650 100644 --- a/gfx/layers/ImageContainer.h +++ b/gfx/layers/ImageContainer.h @@ -147,7 +147,7 @@ public: void* GetImplData() { return mImplData; } virtual already_AddRefed 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 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 GetCurrentAsSurface(gfxIntSize* aSizeResult); + already_AddRefed 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 LockCurrentAsSurface(gfxIntSize* aSizeResult, + already_AddRefed 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 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 mBuffer; uint32_t mBufferSize; Data mData; - gfxIntSize mSize; + gfx::IntSize mSize; gfxImageFormat mOffscreenFormat; nsCountedRef mSurface; nsRefPtr mRecycleBin; @@ -885,12 +885,12 @@ public: return surface.forget(); } - gfxIntSize GetSize() { return mSize; } + gfx::IntSize GetSize() { return mSize; } CairoImage() : Image(nullptr, CAIRO_SURFACE) {} nsCountedRef mSurface; - gfxIntSize mSize; + gfx::IntSize mSize; }; class RemoteBitmapImage : public Image { @@ -899,11 +899,11 @@ public: already_AddRefed GetAsSurface(); - gfxIntSize GetSize() { return mSize; } + gfx::IntSize GetSize() { return mSize; } unsigned char *mData; int mStride; - gfxIntSize mSize; + gfx::IntSize mSize; RemoteImageData::Format mFormat; }; diff --git a/gfx/layers/ImageLayers.cpp b/gfx/layers/ImageLayers.cpp index 62d0631febe..6693e8cca7e 100644 --- a/gfx/layers/ImageLayers.cpp +++ b/gfx/layers/ImageLayers.cpp @@ -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, diff --git a/gfx/layers/SharedTextureImage.h b/gfx/layers/SharedTextureImage.h index 9fce04c4c93..b599c704d8c 100644 --- a/gfx/layers/SharedTextureImage.h +++ b/gfx/layers/SharedTextureImage.h @@ -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 GetAsSurface() { return gl::GLContextProvider::GetSharedHandleAsSurface(mData.mShareType, mData.mHandle); diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 2200776506d..44fe8f5e51a 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -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(), diff --git a/gfx/layers/basic/BasicImageLayer.cpp b/gfx/layers/basic/BasicImageLayer.cpp index a41ba984b2a..7c8a672ccb4 100644 --- a/gfx/layers/basic/BasicImageLayer.cpp +++ b/gfx/layers/basic/BasicImageLayer.cpp @@ -69,7 +69,7 @@ protected: float aOpacity, Layer* aMaskLayer); - gfxIntSize mSize; + gfx::IntSize mSize; }; void @@ -94,7 +94,7 @@ BasicImageLayer::GetAndPaintCurrentImage(gfxContext* aContext, nsRefPtr 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 surface = mContainer->GetCurrentAsSurface(&dontCare); *aSurface = surface.forget().get(); return true; diff --git a/gfx/layers/basic/BasicImages.cpp b/gfx/layers/basic/BasicImages.cpp index ee33c089fb4..de2165fbcbd 100644 --- a/gfx/layers/basic/BasicImages.cpp +++ b/gfx/layers/basic/BasicImages.cpp @@ -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 mDecodedBuffer; - gfxIntSize mScaleHint; + gfx::IntSize mScaleHint; int mStride; bool mDelayedConversion; }; @@ -66,7 +66,7 @@ public: virtual already_AddRefed 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 imgSurface = - new gfxImageSurface(mDecodedBuffer, mSize, mStride, format); + new gfxImageSurface(mDecodedBuffer, ThebesIntSize(mSize), mStride, format); if (!imgSurface || imgSurface->CairoStatus() != 0) { return nullptr; } diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index 0759b8526fe..949f146bc3f 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -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 diff --git a/gfx/layers/d3d10/ImageLayerD3D10.cpp b/gfx/layers/d3d10/ImageLayerD3D10.cpp index 8b78a5b5bb3..de681bda080 100644 --- a/gfx/layers/d3d10/ImageLayerD3D10.cpp +++ b/gfx/layers/d3d10/ImageLayerD3D10.cpp @@ -12,6 +12,7 @@ #include "D3D9SurfaceImage.h" #include "gfxWindowsPlatform.h" +#include "gfx2DGlue.h" namespace mozilla { namespace layers { @@ -20,7 +21,7 @@ static already_AddRefed 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 SurfaceToTexture(ID3D10Device *aDevice, gfxASurface *aSurface, - const gfxIntSize &aSize) + const gfx::IntSize &aSize) { if (!aSurface) { return nullptr; @@ -68,7 +69,7 @@ SurfaceToTexture(ID3D10Device *aDevice, nsRefPtr imageSurface = aSurface->GetAsImageSurface(); if (!imageSurface) { - imageSurface = new gfxImageSurface(aSize, + imageSurface = new gfxImageSurface(ThebesIntSize(aSize), gfxImageFormatARGB32); nsRefPtr 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 result = GetImageSRView(image, dontCare); return result.forget(); @@ -465,9 +466,10 @@ RemoteDXGITextureImage::GetAsSurface() keyedMutex->ReleaseSync(0); nsRefPtr 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."); diff --git a/gfx/layers/d3d10/ImageLayerD3D10.h b/gfx/layers/d3d10/ImageLayerD3D10.h index 747ace69802..17246aef4a5 100644 --- a/gfx/layers/d3d10/ImageLayerD3D10.h +++ b/gfx/layers/d3d10/ImageLayerD3D10.h @@ -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 GetAsSurface(); - gfxIntSize GetSize() { return mSize; } + gfx::IntSize GetSize() { return mSize; } TextureD3D10BackendData *GetD3D10TextureBackendData(ID3D10Device *aDevice); - gfxIntSize mSize; + gfx::IntSize mSize; RemoteImageData::Format mFormat; HANDLE mHandle; }; diff --git a/gfx/layers/d3d9/ImageLayerD3D9.cpp b/gfx/layers/d3d9/ImageLayerD3D9.cpp index c1e14e80b9c..5c4a4545181 100644 --- a/gfx/layers/d3d9/ImageLayerD3D9.cpp +++ b/gfx/layers/d3d9/ImageLayerD3D9.cpp @@ -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 DataToTexture(IDirect3DDevice9 *aDevice, unsigned char *aData, int aStride, - const gfxIntSize &aSize, + const gfx::IntSize &aSize, _D3DFORMAT aFormat) { nsRefPtr texture; @@ -130,13 +131,13 @@ OpenSharedTexture(const D3DSURFACE_DESC& aDesc, static already_AddRefed SurfaceToTexture(IDirect3DDevice9 *aDevice, gfxASurface *aSurface, - const gfxIntSize &aSize) + const gfx::IntSize &aSize) { nsRefPtr imageSurface = aSurface->GetAsImageSurface(); if (!imageSurface) { - imageSurface = new gfxImageSurface(aSize, + imageSurface = new gfxImageSurface(ThebesIntSize(aSize), gfxImageFormatARGB32); nsRefPtr 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 result = GetTexture(image, dontCare); return result.forget(); } diff --git a/gfx/layers/ipc/LayersSurfaces.ipdlh b/gfx/layers/ipc/LayersSurfaces.ipdlh index 46679b7460b..af65216e843 100644 --- a/gfx/layers/ipc/LayersSurfaces.ipdlh +++ b/gfx/layers/ipc/LayersSurfaces.ipdlh @@ -54,7 +54,7 @@ struct SurfaceDescriptorD3D10 { struct SharedTextureDescriptor { SharedTextureShareType shareType; SharedTextureHandle handle; - nsIntSize size; + IntSize size; bool inverted; }; diff --git a/gfx/layers/ipc/SharedRGBImage.cpp b/gfx/layers/ipc/SharedRGBImage.cpp index 38cd0794ed2..dfc05d6f2e4 100644 --- a/gfx/layers/ipc/SharedRGBImage.cpp +++ b/gfx/layers/ipc/SharedRGBImage.cpp @@ -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 diff --git a/gfx/layers/ipc/SharedRGBImage.h b/gfx/layers/ipc/SharedRGBImage.h index 964fee0e3dd..9f31f2d0ec6 100644 --- a/gfx/layers/ipc/SharedRGBImage.h +++ b/gfx/layers/ipc/SharedRGBImage.h @@ -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(); diff --git a/gfx/layers/opengl/ImageLayerOGL.cpp b/gfx/layers/opengl/ImageLayerOGL.cpp index 9aa09abfc6d..8fe6fae33d5 100644 --- a/gfx/layers/opengl/ImageLayerOGL.cpp +++ b/gfx/layers/opengl/ImageLayerOGL.cpp @@ -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 diff --git a/gfx/layers/opengl/ImageLayerOGL.h b/gfx/layers/opengl/ImageLayerOGL.h index 9c9ab993124..480c501e564 100644 --- a/gfx/layers/opengl/ImageLayerOGL.h +++ b/gfx/layers/opengl/ImageLayerOGL.h @@ -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 */ diff --git a/gfx/layers/opengl/LayerManagerOGL.h b/gfx/layers/opengl/LayerManagerOGL.h index bfa22e2fafb..bf5208378a7 100644 --- a/gfx/layers/opengl/LayerManagerOGL.h +++ b/gfx/layers/opengl/LayerManagerOGL.h @@ -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; diff --git a/gfx/layers/opengl/LayerManagerOGLProgram.cpp b/gfx/layers/opengl/LayerManagerOGLProgram.cpp index bbeee162377..8445616fa46 100644 --- a/gfx/layers/opengl/LayerManagerOGLProgram.cpp +++ b/gfx/layers/opengl/LayerManagerOGLProgram.cpp @@ -446,7 +446,7 @@ ShaderProgramOGL::LoadMask(Layer* aMaskLayer) return false; } - gfxIntSize size; + gfx::IntSize size; if (!static_cast(aMaskLayer->ImplData()) ->LoadAsTexture(LOCAL_GL_TEXTURE0 + mProfile.mTextureCount - 1, &size)){ return false; @@ -459,7 +459,7 @@ ShaderProgramOGL::LoadMask(Layer* aMaskLayer) mozilla::DebugOnly 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; diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index 0d65282ce42..c98beafa0d0 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -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; } diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index d16fdb04ac6..95813764fea 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -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) { diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index 086398f0252..1c58a921558 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -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); diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 06f43e9e06a..3b2e9e070c4 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -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; diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 9f7792b3aea..58842206568 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -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 surf = container->GetCurrentAsSurface(&size); if (!surf) return result; + gfxIntSize gfxSize = ThebesIntSize(size); if (wantImageSurface && surf->GetType() != gfxSurfaceTypeImage) { nsRefPtr imgSurf = - new gfxImageSurface(size, gfxImageFormatARGB32); + new gfxImageSurface(gfxSize, gfxImageFormatARGB32); nsRefPtr 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; diff --git a/layout/generic/nsVideoFrame.cpp b/layout/generic/nsVideoFrame.cpp index df192a6031d..9681c3946cd 100644 --- a/layout/generic/nsVideoFrame.cpp +++ b/layout/generic/nsVideoFrame.cpp @@ -184,10 +184,10 @@ nsVideoFrame::BuildLayer(nsDisplayListBuilder* aBuilder, nsRefPtr 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; diff --git a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp index 68e579fd999..85e99e7e22a 100644 --- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp +++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp @@ -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;