From e3eaf89e3f126008204db0612a110fd9d5ad7d14 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Sun, 29 Mar 2015 16:59:08 +0200 Subject: [PATCH] Bug 1132854 - Make nsIntSize a typedef of gfx::IntSize. r=Bas, roc --- accessible/ipc/PDocAccessible.ipdl | 4 ++-- dom/base/nsGlobalWindow.h | 2 +- dom/ipc/PBrowser.ipdl | 4 ++-- dom/ipc/PDocumentRenderer.ipdl | 2 +- dom/media/MediaData.cpp | 10 ++++---- dom/media/VideoUtils.h | 2 +- dom/media/encoder/TrackEncoder.cpp | 2 +- dom/media/gstreamer/GStreamerReader.cpp | 2 +- dom/media/wmf/DXVA2Manager.h | 1 - dom/plugins/base/nsNPAPIPluginInstance.h | 1 + dom/plugins/ipc/PluginInstanceParent.cpp | 2 +- dom/plugins/ipc/PluginLibrary.h | 2 +- gfx/gl/GLTextureImage.cpp | 21 +++-------------- gfx/gl/GLTextureImage.h | 23 ++----------------- gfx/layers/Compositor.h | 1 - gfx/layers/LayerScope.h | 2 -- gfx/layers/LayersLogging.cpp | 9 -------- gfx/layers/LayersLogging.h | 5 ---- gfx/layers/RotatedBuffer.h | 4 +--- gfx/layers/client/ClientLayerManager.cpp | 2 +- .../composite/LayerManagerComposite.cpp | 2 -- gfx/layers/composite/LayerManagerComposite.h | 2 -- gfx/layers/composite/TextureHost.h | 2 -- gfx/layers/composite/TiledContentHost.h | 3 +-- gfx/layers/d3d11/CompositorD3D11.cpp | 2 +- gfx/layers/ipc/LayersSurfaces.ipdlh | 1 - gfx/layers/ipc/ShadowLayerUtilsX11.cpp | 2 +- gfx/layers/opengl/TextureHostOGL.cpp | 6 ++--- gfx/layers/opengl/TextureHostOGL.h | 5 ++-- gfx/src/nsITheme.h | 2 +- gfx/src/nsSize.h | 21 ++++------------- gfx/tests/gtest/TestTextures.cpp | 6 ++--- gfx/thebes/gfxDrawable.cpp | 2 +- gfx/thebes/gfxXlibNativeRenderer.h | 9 ++++---- image/src/Decoder.cpp | 4 ++-- image/src/RasterImage.cpp | 17 +++++++------- image/src/SVGDocumentWrapper.h | 2 +- image/src/imgFrame.cpp | 4 ++-- layout/base/FrameLayerBuilder.cpp | 2 +- layout/base/nsCSSRendering.cpp | 7 +++--- layout/svg/nsSVGPatternFrame.cpp | 2 +- widget/nsBaseDragService.cpp | 2 +- widget/windows/nsNativeThemeWin.h | 2 +- 43 files changed, 66 insertions(+), 142 deletions(-) diff --git a/accessible/ipc/PDocAccessible.ipdl b/accessible/ipc/PDocAccessible.ipdl index 3d9fa3a63053..7127a1c4bbd5 100644 --- a/accessible/ipc/PDocAccessible.ipdl +++ b/accessible/ipc/PDocAccessible.ipdl @@ -9,8 +9,8 @@ include protocol PContent; include "mozilla/GfxMessageUtils.h"; using struct nsIntPoint from "nsRect.h"; -using struct nsIntSize from "nsRect.h"; using struct nsIntRect from "nsRect.h"; +using mozilla::gfx::IntSize from "mozilla/gfx/Point.h"; namespace mozilla { namespace a11y { @@ -131,7 +131,7 @@ child: prio(high) sync PasteText(uint64_t aID, int32_t aPosition); prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(nsIntPoint aRetVal); - prio(high) sync ImageSize(uint64_t aID) returns(nsIntSize aRetVal); + prio(high) sync ImageSize(uint64_t aID) returns(IntSize aRetVal); prio(high) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk); prio(high) sync EndOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk); diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 626d210e7c03..74d9a5dc312c 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -51,6 +51,7 @@ #include "mozilla/dom/WindowBinding.h" #include "Units.h" #include "nsComponentManagerUtils.h" +#include "nsSize.h" #define DEFAULT_HOME_PAGE "www.mozilla.org" #define PREF_BROWSER_STARTUP_HOMEPAGE "browser.startup.homepage" @@ -90,7 +91,6 @@ class nsGlobalWindowObserver; class nsGlobalWindow; class nsDOMWindowUtils; class nsIIdleService; -struct nsIntSize; struct nsRect; class nsWindowSizes; diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index e4da41e964d4..963b172ed251 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -40,7 +40,7 @@ using struct mozilla::widget::IMENotification from "nsIWidget.h"; using struct nsIMEUpdatePreference from "nsIWidget.h"; using struct nsIntPoint from "nsPoint.h"; using struct nsIntRect from "nsRect.h"; -using struct nsIntSize from "nsSize.h"; +using mozilla::gfx::IntSize from "mozilla/gfx/Point.h"; using class mozilla::WidgetKeyboardEvent from "ipc/nsGUIEventIPC.h"; using class mozilla::WidgetMouseEvent from "ipc/nsGUIEventIPC.h"; using class mozilla::WidgetWheelEvent from "ipc/nsGUIEventIPC.h"; @@ -605,7 +605,7 @@ child: PDocumentRenderer(nsRect documentRect, Matrix transform, nsString bgcolor, uint32_t renderFlags, bool flushLayout, - nsIntSize renderSize); + IntSize renderSize); /** * Sent by the chrome process when it no longer wants this remote diff --git a/dom/ipc/PDocumentRenderer.ipdl b/dom/ipc/PDocumentRenderer.ipdl index 6ee3358f7f1a..be3053d01471 100644 --- a/dom/ipc/PDocumentRenderer.ipdl +++ b/dom/ipc/PDocumentRenderer.ipdl @@ -7,7 +7,7 @@ include protocol PBrowser; include "mozilla/GfxMessageUtils.h"; -using struct nsIntSize from "nsSize.h"; +using nsIntSize from "nsSize.h"; namespace mozilla { namespace ipc { diff --git a/dom/media/MediaData.cpp b/dom/media/MediaData.cpp index d76b3eada3d0..966fdc2c065b 100644 --- a/dom/media/MediaData.cpp +++ b/dom/media/MediaData.cpp @@ -257,7 +257,7 @@ VideoData::Create(VideoInfo& aInfo, aDuration, aKeyframe, aTimecode, - aInfo.mDisplay.ToIntSize())); + aInfo.mDisplay)); return v.forget(); } @@ -299,7 +299,7 @@ VideoData::Create(VideoInfo& aInfo, aDuration, aKeyframe, aTimecode, - aInfo.mDisplay.ToIntSize())); + aInfo.mDisplay)); #ifdef MOZ_WIDGET_GONK const YCbCrBuffer::Plane &Y = aBuffer.mPlanes[0]; const YCbCrBuffer::Plane &Cb = aBuffer.mPlanes[1]; @@ -401,7 +401,7 @@ VideoData::CreateFromImage(VideoInfo& aInfo, aDuration, aKeyframe, aTimecode, - aInfo.mDisplay.ToIntSize())); + aInfo.mDisplay)); v->mImage = aImage; return v.forget(); } @@ -427,7 +427,7 @@ VideoData::Create(VideoInfo& aInfo, aDuration, aKeyframe, aTimecode, - aInfo.mDisplay.ToIntSize())); + aInfo.mDisplay)); return v.forget(); } @@ -454,7 +454,7 @@ VideoData::Create(VideoInfo& aInfo, aDuration, aKeyframe, aTimecode, - aInfo.mDisplay.ToIntSize())); + aInfo.mDisplay)); v->mImage = aContainer->CreateImage(ImageFormat::GRALLOC_PLANAR_YCBCR); if (!v->mImage) { diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h index e11087f6c607..dbc8f192f55e 100644 --- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -11,6 +11,7 @@ #include "mozilla/ReentrantMonitor.h" #include "mozilla/CheckedInt.h" #include "nsIThread.h" +#include "nsSize.h" #if !(defined(XP_WIN) || defined(XP_MACOSX) || defined(LINUX)) || \ defined(MOZ_ASAN) @@ -27,7 +28,6 @@ using mozilla::CheckedUint64; using mozilla::CheckedInt32; using mozilla::CheckedUint32; -struct nsIntSize; struct nsIntRect; // This file contains stuff we'd rather put elsewhere, but which is diff --git a/dom/media/encoder/TrackEncoder.cpp b/dom/media/encoder/TrackEncoder.cpp index 59ef78042483..2f43594298a2 100644 --- a/dom/media/encoder/TrackEncoder.cpp +++ b/dom/media/encoder/TrackEncoder.cpp @@ -240,7 +240,7 @@ VideoTrackEncoder::AppendVideoSegment(const VideoSegment& aSegment) nsRefPtr image = chunk.mFrame.GetImage(); mRawSegment.AppendFrame(image.forget(), chunk.GetDuration(), - chunk.mFrame.GetIntrinsicSize().ToIntSize(), + chunk.mFrame.GetIntrinsicSize(), chunk.mFrame.GetForceBlack()); iter.Next(); } diff --git a/dom/media/gstreamer/GStreamerReader.cpp b/dom/media/gstreamer/GStreamerReader.cpp index f82eb0acd653..6d624b32ac31 100644 --- a/dom/media/gstreamer/GStreamerReader.cpp +++ b/dom/media/gstreamer/GStreamerReader.cpp @@ -1121,7 +1121,7 @@ void GStreamerReader::VideoPreroll() if (IsValidVideoRegion(frameSize, pictureRect, displaySize)) { GstStructure* structure = gst_caps_get_structure(caps, 0); gst_structure_get_fraction(structure, "framerate", &fpsNum, &fpsDen); - mInfo.mVideo.mDisplay = ThebesIntSize(displaySize.ToIntSize()); + mInfo.mVideo.mDisplay = ThebesIntSize(displaySize); mInfo.mVideo.mHasVideo = true; } else { LOG(PR_LOG_DEBUG, "invalid video region"); diff --git a/dom/media/wmf/DXVA2Manager.h b/dom/media/wmf/DXVA2Manager.h index 7b0fb318914f..f92b1108bb0f 100644 --- a/dom/media/wmf/DXVA2Manager.h +++ b/dom/media/wmf/DXVA2Manager.h @@ -10,7 +10,6 @@ #include "nsAutoPtr.h" #include "mozilla/Mutex.h" -struct nsIntSize; struct nsIntRect; namespace mozilla { diff --git a/dom/plugins/base/nsNPAPIPluginInstance.h b/dom/plugins/base/nsNPAPIPluginInstance.h index 5cff613a1d5d..63626ef2b586 100644 --- a/dom/plugins/base/nsNPAPIPluginInstance.h +++ b/dom/plugins/base/nsNPAPIPluginInstance.h @@ -6,6 +6,7 @@ #ifndef nsNPAPIPluginInstance_h_ #define nsNPAPIPluginInstance_h_ +#include "nsSize.h" #include "nsCOMPtr.h" #include "nsTArray.h" #include "nsPIDOMWindow.h" diff --git a/dom/plugins/ipc/PluginInstanceParent.cpp b/dom/plugins/ipc/PluginInstanceParent.cpp index 3527b90d7813..aa87df9d4940 100644 --- a/dom/plugins/ipc/PluginInstanceParent.cpp +++ b/dom/plugins/ipc/PluginInstanceParent.cpp @@ -641,7 +641,7 @@ PluginInstanceParent::RecvShow(const NPRect& updatedRect, NS_ASSERTION(image->GetFormat() == ImageFormat::CAIRO_SURFACE, "Wrong format?"); CairoImage* cairoImage = static_cast(image.get()); CairoImage::Data cairoData; - cairoData.mSize = surface->GetSize().ToIntSize(); + cairoData.mSize = surface->GetSize(); cairoData.mSourceSurface = gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(nullptr, surface); cairoImage->SetData(cairoData); diff --git a/dom/plugins/ipc/PluginLibrary.h b/dom/plugins/ipc/PluginLibrary.h index b7435b392609..045c6d636721 100644 --- a/dom/plugins/ipc/PluginLibrary.h +++ b/dom/plugins/ipc/PluginLibrary.h @@ -14,11 +14,11 @@ #include "nsTArray.h" #include "nsError.h" #include "mozilla/EventForwards.h" +#include "nsSize.h" class gfxContext; class nsCString; struct nsIntRect; -struct nsIntSize; class nsNPAPIPlugin; namespace mozilla { diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp index 8dd8f2f5a310..a30ad4cc415a 100644 --- a/gfx/gl/GLTextureImage.cpp +++ b/gfx/gl/GLTextureImage.cpp @@ -265,7 +265,7 @@ gfx::IntSize TextureImage::GetSize() const { TextureImage::TextureImage(const gfx::IntSize& aSize, GLenum aWrapMode, ContentType aContentType, - Flags aFlags) + Flags aFlags, ImageFormat aImageFormat) : mSize(aSize) , mWrapMode(aWrapMode) , mContentType(aContentType) @@ -273,21 +273,6 @@ TextureImage::TextureImage(const gfx::IntSize& aSize, , mFlags(aFlags) {} -BasicTextureImage::BasicTextureImage(GLuint aTexture, - const nsIntSize& aSize, - GLenum aWrapMode, - ContentType aContentType, - GLContext* aContext, - TextureImage::Flags aFlags /* = TextureImage::NoFlags */, - TextureImage::ImageFormat aImageFormat /* = gfxImageFormat::Unknown */) - : TextureImage(aSize, aWrapMode, aContentType, aFlags, aImageFormat) - , mTexture(aTexture) - , mTextureState(Created) - , mGLContext(aContext) - , mUpdateOffset(0, 0) -{ -} - BasicTextureImage::BasicTextureImage(GLuint aTexture, const gfx::IntSize& aSize, GLenum aWrapMode, @@ -295,7 +280,7 @@ BasicTextureImage::BasicTextureImage(GLuint aTexture, GLContext* aContext, TextureImage::Flags aFlags, TextureImage::ImageFormat aImageFormat) - : TextureImage(ThebesIntSize(aSize), aWrapMode, aContentType, aFlags, aImageFormat) + : TextureImage(aSize, aWrapMode, aContentType, aFlags, aImageFormat) , mTexture(aTexture) , mTextureState(Created) , mGLContext(aContext) @@ -499,7 +484,7 @@ TiledTextureImage::BeginUpdate(nsIntRegion& aRegion) (GetContentType() == gfxContentType::COLOR) ? gfx::SurfaceFormat::B8G8R8X8: gfx::SurfaceFormat::B8G8R8A8; mUpdateDrawTarget = gfx::Factory::CreateDrawTarget(gfx::BackendType::CAIRO, - bounds.Size().ToIntSize(), + bounds.Size(), format); return mUpdateDrawTarget;; diff --git a/gfx/gl/GLTextureImage.h b/gfx/gl/GLTextureImage.h index d313c5dcc728..b5e6822e0894 100644 --- a/gfx/gl/GLTextureImage.h +++ b/gfx/gl/GLTextureImage.h @@ -211,22 +211,10 @@ protected: * TextureImage from GLContext::CreateTextureImage(). That is, * clients must not be given partially-constructed TextureImages. */ - TextureImage(const nsIntSize& aSize, - GLenum aWrapMode, ContentType aContentType, - Flags aFlags = NoFlags, - ImageFormat aImageFormat = gfxImageFormat::Unknown) - : mSize(aSize.ToIntSize()) - , mWrapMode(aWrapMode) - , mContentType(aContentType) - , mImageFormat(aImageFormat) - , mFilter(GraphicsFilter::FILTER_GOOD) - , mFlags(aFlags) - {} - - // Moz2D equivalent... TextureImage(const gfx::IntSize& aSize, GLenum aWrapMode, ContentType aContentType, - Flags aFlags = NoFlags); + Flags aFlags = NoFlags, + ImageFormat aImageFormat = gfxImageFormat::Unknown); // Protected destructor, to discourage deletion outside of Release(): virtual ~TextureImage() {} @@ -257,13 +245,6 @@ class BasicTextureImage public: virtual ~BasicTextureImage(); - BasicTextureImage(GLuint aTexture, - const nsIntSize& aSize, - GLenum aWrapMode, - ContentType aContentType, - GLContext* aContext, - TextureImage::Flags aFlags = TextureImage::NoFlags, - TextureImage::ImageFormat aImageFormat = gfxImageFormat::Unknown); BasicTextureImage(GLuint aTexture, const gfx::IntSize& aSize, GLenum aWrapMode, diff --git a/gfx/layers/Compositor.h b/gfx/layers/Compositor.h index 488540e4006b..031c285b5725 100644 --- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -106,7 +106,6 @@ */ class nsIWidget; -struct nsIntSize; class nsIntRegion; namespace mozilla { diff --git a/gfx/layers/LayerScope.h b/gfx/layers/LayerScope.h index f023b4dc6bb8..10725a7c7a85 100644 --- a/gfx/layers/LayerScope.h +++ b/gfx/layers/LayerScope.h @@ -10,8 +10,6 @@ #include #include -struct nsIntSize; - namespace mozilla { namespace gl { class GLContext; } diff --git a/gfx/layers/LayersLogging.cpp b/gfx/layers/LayersLogging.cpp index f7241d06d0d1..f2f21d6cab2e 100644 --- a/gfx/layers/LayersLogging.cpp +++ b/gfx/layers/LayersLogging.cpp @@ -164,15 +164,6 @@ AppendToString(std::stringstream& aStream, const EventRegions& e, aStream << "}" << sfx; } -void -AppendToString(std::stringstream& aStream, const nsIntSize& sz, - const char* pfx, const char* sfx) -{ - aStream << pfx; - aStream << nsPrintfCString("(w=%d, h=%d)", sz.width, sz.height).get(); - aStream << sfx; -} - void AppendToString(std::stringstream& aStream, const FrameMetrics& m, const char* pfx, const char* sfx, bool detailed) diff --git a/gfx/layers/LayersLogging.h b/gfx/layers/LayersLogging.h index 0487128d10e5..00f66d6f3127 100644 --- a/gfx/layers/LayersLogging.h +++ b/gfx/layers/LayersLogging.h @@ -19,7 +19,6 @@ struct gfxRGBA; struct nsIntPoint; struct nsIntRect; -struct nsIntSize; namespace mozilla { namespace gfx { @@ -133,10 +132,6 @@ void AppendToString(std::stringstream& aStream, const EventRegions& e, const char* pfx="", const char* sfx=""); -void -AppendToString(std::stringstream& aStream, const nsIntSize& sz, - const char* pfx="", const char* sfx=""); - void AppendToString(std::stringstream& aStream, const FrameMetrics& m, const char* pfx="", const char* sfx="", bool detailed = false); diff --git a/gfx/layers/RotatedBuffer.h b/gfx/layers/RotatedBuffer.h index 29ebcfb3de9d..fcf06e3a48ef 100644 --- a/gfx/layers/RotatedBuffer.h +++ b/gfx/layers/RotatedBuffer.h @@ -21,8 +21,6 @@ #include "nsRegion.h" // for nsIntRegion #include "LayersTypes.h" -struct nsIntSize; - namespace mozilla { namespace gfx { class Matrix; @@ -389,7 +387,7 @@ protected: * buffer provider. */ gfxContentType BufferContentType(); - bool BufferSizeOkFor(const nsIntSize& aSize); + bool BufferSizeOkFor(const gfx::IntSize& aSize); /** * If the buffer hasn't been mapped, map it. */ diff --git a/gfx/layers/client/ClientLayerManager.cpp b/gfx/layers/client/ClientLayerManager.cpp index f5588d8a1bb6..27183fcfdbba 100644 --- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -476,7 +476,7 @@ ClientLayerManager::MakeSnapshotIfRequired() SurfaceDescriptor inSnapshot; if (!bounds.IsEmpty() && - mForwarder->AllocSurfaceDescriptor(bounds.Size().ToIntSize(), + mForwarder->AllocSurfaceDescriptor(bounds.Size(), gfxContentType::COLOR_ALPHA, &inSnapshot) && remoteRenderer->SendMakeSnapshot(inSnapshot, bounds)) { diff --git a/gfx/layers/composite/LayerManagerComposite.cpp b/gfx/layers/composite/LayerManagerComposite.cpp index 282659db00be..54b7c66eb107 100644 --- a/gfx/layers/composite/LayerManagerComposite.cpp +++ b/gfx/layers/composite/LayerManagerComposite.cpp @@ -59,8 +59,6 @@ #include "TextRenderer.h" // for TextRenderer class gfxContext; -struct nsIntSize; - namespace mozilla { namespace layers { diff --git a/gfx/layers/composite/LayerManagerComposite.h b/gfx/layers/composite/LayerManagerComposite.h index 9bc86c1a5c77..0e6552099dc2 100644 --- a/gfx/layers/composite/LayerManagerComposite.h +++ b/gfx/layers/composite/LayerManagerComposite.h @@ -31,8 +31,6 @@ #include "LayerTreeInvalidation.h" class gfxContext; -struct nsIntPoint; -struct nsIntSize; #ifdef XP_WIN #include diff --git a/gfx/layers/composite/TextureHost.h b/gfx/layers/composite/TextureHost.h index cacd88e8db12..5a3d10993ac9 100644 --- a/gfx/layers/composite/TextureHost.h +++ b/gfx/layers/composite/TextureHost.h @@ -30,8 +30,6 @@ #include "mozilla/layers/AtomicRefCountedWithFinalize.h" class gfxReusableSurfaceWrapper; -struct nsIntPoint; -struct nsIntSize; struct nsIntRect; namespace mozilla { diff --git a/gfx/layers/composite/TiledContentHost.h b/gfx/layers/composite/TiledContentHost.h index 359d89e3859d..610847215f7c 100644 --- a/gfx/layers/composite/TiledContentHost.h +++ b/gfx/layers/composite/TiledContentHost.h @@ -34,7 +34,6 @@ class gfxReusableSurfaceWrapper; struct nsIntPoint; struct nsIntRect; -struct nsIntSize; namespace mozilla { namespace gfx { @@ -309,7 +308,7 @@ private: const gfx::Rect& aClipRect, const nsIntRegion& aScreenRegion, const nsIntPoint& aTextureOffset, - const nsIntSize& aTextureBounds); + const gfx::IntSize& aTextureBounds); void EnsureTileStore() {} diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 08e5b1db578a..eafd44bff7f5 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1265,7 +1265,7 @@ CompositorD3D11::UpdateRenderTarget() } mDefaultRT = new CompositingRenderTargetD3D11(backBuf, IntPoint(0, 0)); - mDefaultRT->SetSize(mSize.ToIntSize()); + mDefaultRT->SetSize(mSize); } bool diff --git a/gfx/layers/ipc/LayersSurfaces.ipdlh b/gfx/layers/ipc/LayersSurfaces.ipdlh index a8de2948aff2..6a3dd2931491 100644 --- a/gfx/layers/ipc/LayersSurfaces.ipdlh +++ b/gfx/layers/ipc/LayersSurfaces.ipdlh @@ -5,7 +5,6 @@ using struct gfxPoint from "gfxPoint.h"; using struct nsIntRect from "nsRect.h"; using nsIntRegion from "nsRegion.h"; -using struct nsIntSize from "nsSize.h"; using struct mozilla::layers::MagicGrallocBufferHandle from "gfxipc/ShadowLayerUtils.h"; using struct mozilla::layers::GrallocBufferRef from "gfxipc/ShadowLayerUtils.h"; using struct mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h"; diff --git a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp index ae130704f298..8fa9a53f0abb 100644 --- a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp +++ b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp @@ -64,7 +64,7 @@ GetXRenderPictFormatFromId(Display* aDisplay, PictFormat aFormatId) SurfaceDescriptorX11::SurfaceDescriptorX11(gfxXlibSurface* aSurf) : mId(aSurf->XDrawable()) - , mSize(aSurf->GetSize().ToIntSize()) + , mSize(aSurf->GetSize()) { const XRenderPictFormat *pictFormat = aSurf->XRenderFormat(); if (pictFormat) { diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index 822634c78a60..1ca62a491f4a 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -280,15 +280,15 @@ TextureImageTextureSourceOGL::EnsureBuffer(const nsIntSize& aSize, gfxContentType aContentType) { if (!mTexImage || - mTexImage->GetSize() != aSize.ToIntSize() || + mTexImage->GetSize() != aSize || mTexImage->GetContentType() != aContentType) { mTexImage = CreateTextureImage(mCompositor->gl(), - aSize.ToIntSize(), + aSize, aContentType, LOCAL_GL_CLAMP_TO_EDGE, FlagsToGLFlags(mFlags)); } - mTexImage->Resize(aSize.ToIntSize()); + mTexImage->Resize(aSize); } void diff --git a/gfx/layers/opengl/TextureHostOGL.h b/gfx/layers/opengl/TextureHostOGL.h index 01129fa841ed..c4b5bfe3c9d1 100644 --- a/gfx/layers/opengl/TextureHostOGL.h +++ b/gfx/layers/opengl/TextureHostOGL.h @@ -41,7 +41,6 @@ class gfxReusableSurfaceWrapper; class nsIntRegion; struct nsIntPoint; struct nsIntRect; -struct nsIntSize; namespace mozilla { namespace gfx { @@ -202,8 +201,8 @@ public: nsIntRegion* aDestRegion = nullptr, gfx::IntPoint* aSrcOffset = nullptr) override; - void EnsureBuffer(const nsIntSize& aSize, - gfxContentType aContentType); + void EnsureBuffer(const gfx::IntSize& aSize, + gfxContentType aContentType); void CopyTo(const nsIntRect& aSourceRect, DataTextureSource* aDest, diff --git a/gfx/src/nsITheme.h b/gfx/src/nsITheme.h index 9263251a2b95..ff46778683a9 100644 --- a/gfx/src/nsITheme.h +++ b/gfx/src/nsITheme.h @@ -12,10 +12,10 @@ #include "nsISupports.h" #include "nsCOMPtr.h" #include "nsColor.h" +#include "nsSize.h" struct nsRect; struct nsIntRect; -struct nsIntSize; class nsIntRegion; struct nsFont; struct nsIntMargin; diff --git a/gfx/src/nsSize.h b/gfx/src/nsSize.h index f710d985a9ac..5c06e8af4e2d 100644 --- a/gfx/src/nsSize.h +++ b/gfx/src/nsSize.h @@ -13,7 +13,7 @@ // Maximum allowable size #define NS_MAXSIZE nscoord_MAX -struct nsIntSize; +typedef mozilla::gfx::IntSize nsIntSize; typedef nsIntSize gfxIntSize; struct nsSize : public mozilla::gfx::BaseSize { @@ -35,19 +35,6 @@ struct nsSize : public mozilla::gfx::BaseSize { ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const; }; -struct nsIntSize : public mozilla::gfx::BaseSize { - typedef mozilla::gfx::BaseSize Super; - - nsIntSize() : Super() {} - nsIntSize(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {} - - inline nsSize ToAppUnits(nscoord aAppUnitsPerPixel) const; - mozilla::gfx::IntSize ToIntSize() const - { - return mozilla::gfx::IntSize(width, height); - }; -}; - inline nsIntSize nsSize::ScaleToNearestPixels(float aXScale, float aYScale, nscoord aAppUnitsPerPixel) const @@ -75,10 +62,10 @@ nsSize::ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const { } inline nsSize -nsIntSize::ToAppUnits(nscoord aAppUnitsPerPixel) const +IntSizeToAppUnits(mozilla::gfx::IntSize aSize, nscoord aAppUnitsPerPixel) { - return nsSize(NSIntPixelsToAppUnits(width, aAppUnitsPerPixel), - NSIntPixelsToAppUnits(height, aAppUnitsPerPixel)); + return nsSize(NSIntPixelsToAppUnits(aSize.width, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(aSize.height, aAppUnitsPerPixel)); } #endif /* NSSIZE_H */ diff --git a/gfx/tests/gtest/TestTextures.cpp b/gfx/tests/gtest/TestTextures.cpp index 4c89a5c38f7a..8a84e9f3fbbf 100644 --- a/gfx/tests/gtest/TestTextures.cpp +++ b/gfx/tests/gtest/TestTextures.cpp @@ -297,9 +297,9 @@ TEST(Layers, TextureYCbCrSerialization) { clientData.mYChannel = ySurface->Data(); clientData.mCbChannel = cbSurface->Data(); clientData.mCrChannel = crSurface->Data(); - clientData.mYSize = ySurface->GetSize().ToIntSize(); - clientData.mPicSize = ySurface->GetSize().ToIntSize(); - clientData.mCbCrSize = cbSurface->GetSize().ToIntSize(); + clientData.mYSize = ySurface->GetSize(); + clientData.mPicSize = ySurface->GetSize(); + clientData.mCbCrSize = cbSurface->GetSize(); clientData.mYStride = ySurface->Stride(); clientData.mCbCrStride = cbSurface->Stride(); clientData.mStereoMode = StereoMode::MONO; diff --git a/gfx/thebes/gfxDrawable.cpp b/gfx/thebes/gfxDrawable.cpp index d2d6ebc9e85a..3b35fb667bb7 100644 --- a/gfx/thebes/gfxDrawable.cpp +++ b/gfx/thebes/gfxDrawable.cpp @@ -115,7 +115,7 @@ gfxCallbackDrawable::MakeSurfaceDrawable(const GraphicsFilter aFilter) SurfaceFormat format = gfxPlatform::GetPlatform()->Optimal2DFormatForContent(gfxContentType::COLOR_ALPHA); RefPtr dt = - gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(mSize.ToIntSize(), + gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(mSize, format); if (!dt) return nullptr; diff --git a/gfx/thebes/gfxXlibNativeRenderer.h b/gfx/thebes/gfxXlibNativeRenderer.h index a6e816b5710e..e355fe62e451 100644 --- a/gfx/thebes/gfxXlibNativeRenderer.h +++ b/gfx/thebes/gfxXlibNativeRenderer.h @@ -20,7 +20,6 @@ class gfxASurface; class gfxContext; struct nsIntRect; struct nsIntPoint; -struct nsIntSize; typedef struct _cairo cairo_t; typedef struct _cairo_surface cairo_surface_t; @@ -82,18 +81,18 @@ public: * successful, a pointer to the new gfxASurface is stored in *resultSurface, * otherwise *resultSurface is set to nullptr. */ - void Draw(gfxContext* ctx, nsIntSize size, + void Draw(gfxContext* ctx, mozilla::gfx::IntSize size, uint32_t flags, Screen *screen, Visual *visual); private: - bool DrawDirect(gfxContext *ctx, nsIntSize bounds, + bool DrawDirect(gfxContext *ctx, mozilla::gfx::IntSize bounds, uint32_t flags, Screen *screen, Visual *visual); - bool DrawCairo(cairo_t* cr, nsIntSize size, + bool DrawCairo(cairo_t* cr, mozilla::gfx::IntSize size, uint32_t flags, Screen *screen, Visual *visual); void DrawFallback(mozilla::gfx::DrawTarget* dt, gfxContext* ctx, - gfxASurface* aSurface, nsIntSize& size, + gfxASurface* aSurface, mozilla::gfx::IntSize& size, nsIntRect& drawingRect, bool canDrawOverBackground, uint32_t flags, Screen* screen, Visual* visual); diff --git a/image/src/Decoder.cpp b/image/src/Decoder.cpp index cf8cff4976cb..833c35b5a78c 100644 --- a/image/src/Decoder.cpp +++ b/image/src/Decoder.cpp @@ -470,7 +470,7 @@ Decoder::InternalAddFrame(uint32_t aFrameNum, return RawAccessFrameRef(); } - if (!SurfaceCache::CanHold(aTargetSize.ToIntSize())) { + if (!SurfaceCache::CanHold(aTargetSize)) { NS_WARNING("Trying to add frame that's too large for the SurfaceCache"); return RawAccessFrameRef(); } @@ -492,7 +492,7 @@ Decoder::InternalAddFrame(uint32_t aFrameNum, InsertOutcome outcome = SurfaceCache::Insert(frame, ImageKey(mImage.get()), - RasterSurfaceKey(aTargetSize.ToIntSize(), + RasterSurfaceKey(aTargetSize, aDecodeFlags, aFrameNum), Lifetime::Persistent); diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 238485a427ac..5c25a9f5003c 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -161,7 +161,7 @@ public: // Insert the new surface into the cache immediately. We need to do this so // that we won't start multiple scaling jobs for the same size. SurfaceCache::Insert(mDstRef.get(), ImageKey(mImage.get()), - RasterSurfaceKey(mDstSize.ToIntSize(), mImageFlags, 0), + RasterSurfaceKey(mDstSize, mImageFlags, 0), Lifetime::Transient); return true; @@ -210,7 +210,7 @@ public: // Remove the frame from the cache since we know we don't need it. SurfaceCache::RemoveSurface(ImageKey(mImage.get()), - RasterSurfaceKey(mDstSize.ToIntSize(), + RasterSurfaceKey(mDstSize, mImageFlags, 0)); // Release everything we're holding, too. @@ -504,8 +504,7 @@ RasterImage::LookupFrame(uint32_t aFrameNum, MOZ_ASSERT(NS_IsMainThread()); IntSize requestedSize = CanDownscaleDuringDecode(aSize, aFlags) - ? aSize.ToIntSize() - : mSize.ToIntSize(); + ? aSize : mSize; DrawableFrameRef ref = LookupFrameInternal(aFrameNum, requestedSize, aFlags); @@ -935,7 +934,7 @@ RasterImage::OnAddedFrame(uint32_t aNewFrameCount, if (aNewFrameCount == 2) { // We're becoming animated, so initialize animation stuff. MOZ_ASSERT(!mAnim, "Already have animation state?"); - mAnim = MakeUnique(this, mSize.ToIntSize(), mAnimationMode); + mAnim = MakeUnique(this, mSize, mAnimationMode); // We don't support discarding animated images (See bug 414259). // Lock the image and throw away the key. @@ -1612,7 +1611,7 @@ RasterImage::CanScale(GraphicsFilter aFilter, } // There's no point in scaling if we can't store the result. - if (!SurfaceCache::CanHold(aSize.ToIntSize())) { + if (!SurfaceCache::CanHold(aSize)) { return false; } @@ -1654,7 +1653,7 @@ RasterImage::CanDownscaleDuringDecode(const nsIntSize& aSize, uint32_t aFlags) } // There's no point in scaling if we can't store the result. - if (!SurfaceCache::CanHold(aSize.ToIntSize())) { + if (!SurfaceCache::CanHold(aSize)) { return false; } @@ -1715,7 +1714,7 @@ RasterImage::DrawWithPreDownscaleIfNeeded(DrawableFrameRef&& aFrameRef, if (CanScale(aFilter, aSize, aFlags)) { frameRef = SurfaceCache::Lookup(ImageKey(this), - RasterSurfaceKey(aSize.ToIntSize(), + RasterSurfaceKey(aSize, DecodeFlags(aFlags), 0)); if (!frameRef) { @@ -2096,7 +2095,7 @@ RasterImage::OptimalImageSizeForDest(const gfxSize& aDest, uint32_t aWhichFrame, } else if (CanScale(aFilter, destSize, aFlags)) { DrawableFrameRef frameRef = SurfaceCache::Lookup(ImageKey(this), - RasterSurfaceKey(destSize.ToIntSize(), + RasterSurfaceKey(destSize, DecodeFlags(aFlags), 0)); diff --git a/image/src/SVGDocumentWrapper.h b/image/src/SVGDocumentWrapper.h index d8e571d2d486..7f79039874f7 100644 --- a/image/src/SVGDocumentWrapper.h +++ b/image/src/SVGDocumentWrapper.h @@ -15,13 +15,13 @@ #include "nsIObserver.h" #include "nsIContentViewer.h" #include "nsWeakReference.h" +#include "nsSize.h" class nsIAtom; class nsIPresShell; class nsIRequest; class nsILoadGroup; class nsIFrame; -struct nsIntSize; #define OBSERVER_SVC_CID "@mozilla.org/observer-service;1" diff --git a/image/src/imgFrame.cpp b/image/src/imgFrame.cpp index 3dfa76f2f227..389a064dc337 100644 --- a/image/src/imgFrame.cpp +++ b/image/src/imgFrame.cpp @@ -254,7 +254,7 @@ imgFrame::InitForDecoder(const nsIntSize& aImageSize, return NS_ERROR_FAILURE; } - mImageSize = aImageSize.ToIntSize(); + mImageSize = aImageSize; mOffset.MoveTo(aRect.x, aRect.y); mSize.SizeTo(aRect.width, aRect.height); @@ -319,7 +319,7 @@ imgFrame::InitWithDrawable(gfxDrawable* aDrawable, return NS_ERROR_FAILURE; } - mImageSize = aSize.ToIntSize(); + mImageSize = aSize; mOffset.MoveTo(0, 0); mSize.SizeTo(aSize.width, aSize.height); diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 3a94fddca395..3ec6eefbdf35 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -2797,7 +2797,7 @@ PaintInactiveLayer(nsDisplayListBuilder* aBuilder, RefPtr tempDT; if (gfxUtils::sDumpPainting) { tempDT = gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( - itemVisibleRect.Size().ToIntSize(), + itemVisibleRect.Size(), SurfaceFormat::B8G8R8A8); if (tempDT) { context = new gfxContext(tempDT); diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index 3d0e055dc67a..ab1da90e8eeb 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -4737,9 +4737,10 @@ nsImageRenderer::ComputeIntrinsicSize() int32_t appUnitsPerDevPixel = mForFrame->PresContext()->AppUnitsPerDevPixel(); result.SetSize( - nsSVGIntegrationUtils::GetContinuationUnionSize(mPaintServerFrame). - ToNearestPixels(appUnitsPerDevPixel). - ToAppUnits(appUnitsPerDevPixel)); + IntSizeToAppUnits( + nsSVGIntegrationUtils::GetContinuationUnionSize(mPaintServerFrame). + ToNearestPixels(appUnitsPerDevPixel), + appUnitsPerDevPixel)); } } else { NS_ASSERTION(mImageElementSurface.mSourceSurface, "Surface should be ready."); diff --git a/layout/svg/nsSVGPatternFrame.cpp b/layout/svg/nsSVGPatternFrame.cpp index ca9a27fac983..6c835857c85d 100644 --- a/layout/svg/nsSVGPatternFrame.cpp +++ b/layout/svg/nsSVGPatternFrame.cpp @@ -346,7 +346,7 @@ nsSVGPatternFrame::PaintPattern(const DrawTarget* aDrawTarget, bool resultOverflows; IntSize surfaceSize = nsSVGUtils::ConvertToSurfaceSize( - transformedBBox.Size(), &resultOverflows).ToIntSize(); + transformedBBox.Size(), &resultOverflows); // 0 disables rendering, < 0 is an error if (surfaceSize.width <= 0 || surfaceSize.height <= 0) { diff --git a/widget/nsBaseDragService.cpp b/widget/nsBaseDragService.cpp index 4097f4944db5..f6675bf6b40c 100644 --- a/widget/nsBaseDragService.cpp +++ b/widget/nsBaseDragService.cpp @@ -623,7 +623,7 @@ nsBaseDragService::DrawDragForImage(nsPresContext* aPresContext, if (aImageLoader) { RefPtr dt = gfxPlatform::GetPlatform()-> - CreateOffscreenContentDrawTarget(destSize.ToIntSize(), + CreateOffscreenContentDrawTarget(destSize, SurfaceFormat::B8G8R8A8); if (!dt) return NS_ERROR_FAILURE; diff --git a/widget/windows/nsNativeThemeWin.h b/widget/windows/nsNativeThemeWin.h index 96ddce235785..53a154561284 100644 --- a/widget/windows/nsNativeThemeWin.h +++ b/widget/windows/nsNativeThemeWin.h @@ -14,9 +14,9 @@ #include "gfxTypes.h" #include #include "mozilla/TimeStamp.h" +#include "nsSize.h" struct nsIntRect; -struct nsIntSize; class nsNativeThemeWin : private nsNativeTheme, public nsITheme {