From cfff5e52c5f15692432cdf3b2d1d9e078852d408 Mon Sep 17 00:00:00 2001 From: Nicolas Silva Date: Tue, 21 Apr 2015 17:04:57 +0200 Subject: [PATCH] Bug 1155621 - Make nsIntRect and nsIntPoint typedefs of mozilla::gfx::IntRect and mozilla::gfx::IntPoint. r=Bas --- accessible/base/nsCoreUtils.cpp | 2 +- accessible/generic/Accessible.h | 2 +- accessible/generic/HyperTextAccessible.cpp | 4 +- accessible/ipc/PDocAccessible.ipdl | 6 +- docshell/base/nsIContentViewer.idl | 2 +- docshell/shistory/public/nsISHEntry.idl | 2 +- dom/events/WheelHandlingHelper.h | 3 +- dom/ipc/PBrowser.ipdl | 10 +-- dom/ipc/PPluginWidget.ipdl | 2 +- dom/ipc/PScreenManager.ipdl | 2 +- dom/ipc/TabChild.cpp | 4 +- dom/media/VideoUtils.h | 3 +- dom/media/wmf/DXVA2Manager.h | 3 +- dom/plugins/base/nsPluginInstanceOwner.h | 1 - dom/plugins/ipc/PPluginInstance.ipdl | 2 +- dom/plugins/ipc/PluginLibrary.h | 2 +- dom/plugins/ipc/PluginUtilsOSX.h | 3 +- gfx/2d/Rect.h | 16 +++++ gfx/gl/GLTextureImage.cpp | 35 +++++----- gfx/gl/GLUploadHelpers.cpp | 8 +-- gfx/gl/GLUploadHelpers.h | 2 +- gfx/gl/TextureImageEGL.cpp | 10 +-- gfx/ipc/GfxMessageUtils.h | 22 ------ gfx/layers/LayerTreeInvalidation.cpp | 39 ++++++----- gfx/layers/LayerTreeInvalidation.h | 9 ++- gfx/layers/LayersLogging.h | 10 --- gfx/layers/ReadbackLayer.h | 17 +++-- gfx/layers/RotatedBuffer.cpp | 62 ++++++++--------- gfx/layers/RotatedBuffer.h | 24 +++---- gfx/layers/basic/BasicContainerLayer.cpp | 5 +- gfx/layers/basic/BasicContainerLayer.h | 4 +- gfx/layers/client/ClientTiledPaintedLayer.cpp | 9 ++- gfx/layers/composite/CanvasLayerComposite.cpp | 1 - gfx/layers/composite/CanvasLayerComposite.h | 1 - gfx/layers/composite/ColorLayerComposite.cpp | 6 +- gfx/layers/composite/ColorLayerComposite.h | 5 +- gfx/layers/composite/CompositableHost.h | 5 +- .../composite/ContainerLayerComposite.cpp | 34 ++++------ .../composite/ContainerLayerComposite.h | 20 +++--- gfx/layers/composite/ContentHost.cpp | 2 +- gfx/layers/composite/ImageLayerComposite.cpp | 4 +- gfx/layers/composite/ImageLayerComposite.h | 6 +- .../composite/PaintedLayerComposite.cpp | 5 +- gfx/layers/composite/PaintedLayerComposite.h | 7 +- gfx/layers/composite/TextureHost.cpp | 2 - gfx/layers/composite/TextureHost.h | 4 +- gfx/layers/composite/TiledContentHost.cpp | 22 +++--- gfx/layers/composite/TiledContentHost.h | 6 +- gfx/layers/d3d11/CompositorD3D11.cpp | 2 +- gfx/layers/d3d9/DeviceManagerD3D9.cpp | 2 +- gfx/layers/d3d9/DeviceManagerD3D9.h | 5 +- gfx/layers/ipc/CompositableForwarder.h | 6 +- gfx/layers/ipc/CompositorParent.cpp | 12 ++-- gfx/layers/ipc/CompositorParent.h | 6 +- gfx/layers/ipc/ImageBridgeChild.cpp | 4 +- gfx/layers/ipc/ImageBridgeChild.h | 5 +- gfx/layers/ipc/LayersMessages.ipdlh | 20 +++--- gfx/layers/ipc/LayersSurfaces.ipdlh | 2 +- gfx/layers/ipc/PCompositor.ipdl | 4 +- gfx/layers/ipc/ShadowLayers.cpp | 11 ++- gfx/layers/ipc/ShadowLayers.h | 8 +-- .../opengl/GLBlitTextureImageHelper.cpp | 16 ++--- gfx/layers/opengl/GLBlitTextureImageHelper.h | 7 +- gfx/layers/opengl/OGLShaderProgram.h | 1 - gfx/layers/opengl/TextureHostOGL.cpp | 9 ++- gfx/layers/opengl/TextureHostOGL.h | 10 ++- gfx/src/nsPoint.h | 26 +++---- gfx/src/nsRect.cpp | 14 ++++ gfx/src/nsRect.h | 68 ++----------------- gfx/src/nsRegion.h | 2 +- gfx/thebes/gfx2DGlue.h | 10 +++ gfx/thebes/gfxASurface.h | 3 +- gfx/thebes/gfxAlphaRecovery.h | 11 ++- gfx/thebes/gfxAlphaRecoverySSE2.cpp | 9 ++- gfx/thebes/gfxD2DSurface.cpp | 4 +- gfx/thebes/gfxD2DSurface.h | 7 +- gfx/thebes/gfxQtNativeRenderer.h | 7 +- gfx/thebes/gfxUtils.cpp | 16 ++--- gfx/thebes/gfxUtils.h | 9 ++- gfx/thebes/gfxXlibNativeRenderer.cpp | 26 +++---- gfx/thebes/gfxXlibNativeRenderer.h | 13 ++-- hal/sandbox/PHal.ipdl | 2 +- image/src/Decoder.cpp | 2 +- image/src/ImageOps.h | 2 +- image/src/MultipartImage.cpp | 2 +- image/src/ProgressTracker.cpp | 2 +- image/src/RasterImage.cpp | 58 ++++++++-------- image/src/SVGDocumentWrapper.cpp | 2 +- image/src/VectorImage.cpp | 16 ++--- image/src/imgFrame.cpp | 4 +- image/src/imgRequestProxy.cpp | 2 +- image/src/imgRequestProxy.h | 4 +- layout/base/FrameLayerBuilder.cpp | 6 +- layout/base/nsIPresShell.h | 3 +- layout/base/nsPresShell.cpp | 2 +- layout/generic/nsFrame.cpp | 3 +- layout/generic/nsImageFrame.cpp | 2 +- layout/svg/nsFilterInstance.cpp | 4 +- layout/svg/nsISVGChildFrame.h | 1 - layout/svg/nsSVGContainerFrame.h | 1 - layout/svg/nsSVGFilterPaintCallback.h | 4 +- layout/svg/nsSVGImageFrame.cpp | 2 +- layout/svg/nsSVGIntegrationUtils.h | 1 - layout/svg/nsSVGPathGeometryFrame.h | 1 - layout/svg/nsSVGUtils.h | 1 - layout/tables/nsCellMap.h | 2 +- layout/xul/BoxObject.h | 2 +- layout/xul/PopupBoxObject.cpp | 2 +- layout/xul/nsMenuPopupFrame.cpp | 2 +- layout/xul/nsResizerFrame.cpp | 2 +- layout/xul/nsSliderFrame.cpp | 2 +- view/nsView.cpp | 4 +- view/nsViewManager.cpp | 7 +- widget/PuppetWidget.cpp | 2 +- widget/android/AndroidDirectTexture.h | 3 +- widget/android/AndroidGraphicBuffer.h | 3 +- widget/cocoa/nsChildView.mm | 4 +- widget/gonk/HwcComposer2D.cpp | 2 +- widget/gonk/nsWindow.cpp | 2 +- widget/gtk/nsNativeThemeGTK.cpp | 3 +- widget/nsBaseDragService.cpp | 2 +- widget/nsIPluginWidget.h | 2 +- widget/nsIRollupListener.h | 2 +- widget/qt/nsWindow.cpp | 2 +- widget/windows/WinMouseScrollHandler.h | 2 +- widget/windows/WinUtils.h | 2 +- widget/windows/nsIMM32Handler.h | 2 +- widget/windows/winrt/MetroInput.cpp | 1 + widget/windows/winrt/MetroInput.h | 1 - widget/windows/winrt/MetroUtils.h | 2 +- xpfe/appshell/nsAppShellService.cpp | 2 +- 131 files changed, 437 insertions(+), 562 deletions(-) diff --git a/accessible/base/nsCoreUtils.cpp b/accessible/base/nsCoreUtils.cpp index a564f7b65e80..2b427e39efd7 100644 --- a/accessible/base/nsCoreUtils.cpp +++ b/accessible/base/nsCoreUtils.cpp @@ -300,7 +300,7 @@ nsCoreUtils::ScrollFrameToPoint(nsIFrame *aScrollableFrame, return; nsPoint point = - aPoint.ToAppUnits(aFrame->PresContext()->AppUnitsPerDevPixel()); + ToAppUnits(aPoint, aFrame->PresContext()->AppUnitsPerDevPixel()); nsRect frameRect = aFrame->GetScreenRectInAppUnits(); nsPoint deltaPoint(point.x - frameRect.x, point.y - frameRect.y); diff --git a/accessible/generic/Accessible.h b/accessible/generic/Accessible.h index f9d909de42e1..10528d347ef5 100644 --- a/accessible/generic/Accessible.h +++ b/accessible/generic/Accessible.h @@ -15,13 +15,13 @@ #include "nsString.h" #include "nsTArray.h" #include "nsRefPtrHashtable.h" +#include "nsRect.h" struct nsRoleMapEntry; struct nsRect; class nsIFrame; class nsIAtom; -struct nsIntRect; class nsIPersistentProperties; class nsView; diff --git a/accessible/generic/HyperTextAccessible.cpp b/accessible/generic/HyperTextAccessible.cpp index bba558296b77..eeef848a4294 100644 --- a/accessible/generic/HyperTextAccessible.cpp +++ b/accessible/generic/HyperTextAccessible.cpp @@ -1040,7 +1040,7 @@ HyperTextAccessible::OffsetAtPoint(int32_t aX, int32_t aY, uint32_t aCoordType) nsPresContext* presContext = mDoc->PresContext(); nsPoint coordsInAppUnits = - coords.ToAppUnits(presContext->AppUnitsPerDevPixel()); + ToAppUnits(coords, presContext->AppUnitsPerDevPixel()); nsRect frameScreenRect = hyperFrame->GetScreenRectInAppUnits(); if (!frameScreenRect.Contains(coordsInAppUnits.x, coordsInAppUnits.y)) @@ -1568,7 +1568,7 @@ HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset, nsPresContext* presContext = frame->PresContext(); nsPoint coordsInAppUnits = - coords.ToAppUnits(presContext->AppUnitsPerDevPixel()); + ToAppUnits(coords, presContext->AppUnitsPerDevPixel()); bool initialScrolled = false; nsIFrame *parentFrame = frame; diff --git a/accessible/ipc/PDocAccessible.ipdl b/accessible/ipc/PDocAccessible.ipdl index 689879254d80..eddd7e64420b 100644 --- a/accessible/ipc/PDocAccessible.ipdl +++ b/accessible/ipc/PDocAccessible.ipdl @@ -8,9 +8,9 @@ include protocol PContent; include "mozilla/GfxMessageUtils.h"; -using struct nsIntPoint from "nsRect.h"; -using struct nsIntRect from "nsRect.h"; +using nsIntRect from "nsRect.h"; using mozilla::gfx::IntSize from "mozilla/gfx/Point.h"; +using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h"; namespace mozilla { namespace a11y { @@ -135,7 +135,7 @@ child: prio(high) sync PasteText(uint64_t aID, int32_t aPosition) returns(bool aValid); - prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(nsIntPoint aRetVal); + prio(high) sync ImagePosition(uint64_t aID, uint32_t aCoordType) returns(IntPoint aRetVal); prio(high) sync ImageSize(uint64_t aID) returns(IntSize aRetVal); prio(high) sync StartOffset(uint64_t aID) returns(uint32_t aRetVal, bool aOk); diff --git a/docshell/base/nsIContentViewer.idl b/docshell/base/nsIContentViewer.idl index 63c7aeb5b3d5..507a5f41e27f 100644 --- a/docshell/base/nsIContentViewer.idl +++ b/docshell/base/nsIContentViewer.idl @@ -14,9 +14,9 @@ interface nsIPrintSettings; %{ C++ #include "nsTArray.h" +#include "nsRect.h" class nsIWidget; -struct nsIntRect; class nsIPresShell; class nsPresContext; class nsView; diff --git a/docshell/shistory/public/nsISHEntry.idl b/docshell/shistory/public/nsISHEntry.idl index e36c7b6cf361..3e29e8be32ff 100644 --- a/docshell/shistory/public/nsISHEntry.idl +++ b/docshell/shistory/public/nsISHEntry.idl @@ -22,7 +22,7 @@ interface nsIStructuredCloneContainer; interface nsIBFCacheEntry; %{C++ -struct nsIntRect; +#include "nsRect.h" class nsDocShellEditorData; class nsSHEntryShared; %} diff --git a/dom/events/WheelHandlingHelper.h b/dom/events/WheelHandlingHelper.h index 11eb03f62b9e..7cc3b8e08cc9 100644 --- a/dom/events/WheelHandlingHelper.h +++ b/dom/events/WheelHandlingHelper.h @@ -11,12 +11,11 @@ #include "mozilla/EventForwards.h" #include "nsCoord.h" #include "nsIFrame.h" +#include "nsPoint.h" class nsIScrollableFrame; class nsITimer; -struct nsIntPoint; - namespace mozilla { class EventStateManager; diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 5adbb8510c49..df74b1eea1cf 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -37,9 +37,9 @@ using nscolor from "nsColor.h"; using class mozilla::WidgetCompositionEvent from "ipc/nsGUIEventIPC.h"; 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 mozilla::gfx::IntSize from "mozilla/gfx/Point.h"; +using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h"; +using mozilla::gfx::IntRect from "mozilla/gfx/Rect.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"; @@ -488,11 +488,11 @@ parent: uint64_t aObserverId); SynthesizeNativeTouchPoint(uint32_t aPointerId, TouchPointerState aPointerState, - nsIntPoint aPointerScreenPoint, + IntPoint aPointerScreenPoint, double aPointerPressure, uint32_t aPointerOrientation, uint64_t aObserverId); - SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint, + SynthesizeNativeTouchTap(IntPoint aPointerScreenPoint, bool aLongTap, uint64_t aObserverId); ClearNativeTouchSequence(uint64_t aObserverId); @@ -548,7 +548,7 @@ child: CacheFileDescriptor(nsString path, FileDescriptor fd); - UpdateDimensions(nsIntRect rect, ScreenIntSize size, ScreenOrientation orientation, + UpdateDimensions(IntRect rect, ScreenIntSize size, ScreenOrientation orientation, LayoutDeviceIntPoint chromeDisp) compress; UpdateFrame(FrameMetrics frame); diff --git a/dom/ipc/PPluginWidget.ipdl b/dom/ipc/PPluginWidget.ipdl index 02b86e9c77cd..174e83cdf275 100644 --- a/dom/ipc/PPluginWidget.ipdl +++ b/dom/ipc/PPluginWidget.ipdl @@ -6,7 +6,7 @@ include protocol PBrowser; include "mozilla/GfxMessageUtils.h"; -using struct nsIntRect from "nsRect.h"; +using nsIntRect from "nsRect.h"; namespace mozilla { namespace plugins { diff --git a/dom/ipc/PScreenManager.ipdl b/dom/ipc/PScreenManager.ipdl index d958993fb0ad..844821c8f443 100644 --- a/dom/ipc/PScreenManager.ipdl +++ b/dom/ipc/PScreenManager.ipdl @@ -8,7 +8,7 @@ include protocol PContent; include "mozilla/GfxMessageUtils.h"; -using struct nsIntRect from "nsRect.h"; +using nsIntRect from "nsRect.h"; using mozilla::dom::TabId from "mozilla/dom/ipc/IdType.h"; namespace mozilla { diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index 730788de53dc..5bb4f164d9b7 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -1085,7 +1085,7 @@ TabChild::Init() } mWidget->Create( nullptr, 0, // no parents - nsIntRect(nsIntPoint(0, 0), nsIntSize(0, 0)), + gfx::IntRect(gfx::IntPoint(0, 0), gfx::IntSize(0, 0)), nullptr // HandleWidgetEvent ); @@ -3179,7 +3179,7 @@ TabChild::CreatePluginWidget(nsIWidget* aParent, nsIWidget** aOut) initData.mUnicode = false; initData.clipChildren = true; initData.clipSiblings = true; - nsresult rv = pluginWidget->Create(aParent, nullptr, nsIntRect(nsIntPoint(0, 0), + nsresult rv = pluginWidget->Create(aParent, nullptr, gfx::IntRect(gfx::IntPoint(0, 0), nsIntSize(0, 0)), &initData); if (NS_FAILED(rv)) { NS_WARNING("Creating native plugin widget on the chrome side failed."); diff --git a/dom/media/VideoUtils.h b/dom/media/VideoUtils.h index 6bc06c1a463e..495e1ae6bfa4 100644 --- a/dom/media/VideoUtils.h +++ b/dom/media/VideoUtils.h @@ -12,6 +12,7 @@ #include "mozilla/CheckedInt.h" #include "nsIThread.h" #include "nsSize.h" +#include "nsRect.h" #if !(defined(XP_WIN) || defined(XP_MACOSX) || defined(LINUX)) || \ defined(MOZ_ASAN) @@ -28,8 +29,6 @@ using mozilla::CheckedUint64; using mozilla::CheckedInt32; using mozilla::CheckedUint32; -struct nsIntRect; - // This file contains stuff we'd rather put elsewhere, but which is // dependent on other changes which we don't want to wait for. We plan to // remove this file in the near future. diff --git a/dom/media/wmf/DXVA2Manager.h b/dom/media/wmf/DXVA2Manager.h index d0fe3002f8ae..5770e4d3386b 100644 --- a/dom/media/wmf/DXVA2Manager.h +++ b/dom/media/wmf/DXVA2Manager.h @@ -9,8 +9,7 @@ #include "WMF.h" #include "nsAutoPtr.h" #include "mozilla/Mutex.h" - -struct nsIntRect; +#include "nsRect.h" namespace mozilla { diff --git a/dom/plugins/base/nsPluginInstanceOwner.h b/dom/plugins/base/nsPluginInstanceOwner.h index 5b5d97e0f842..2101d3900998 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.h +++ b/dom/plugins/base/nsPluginInstanceOwner.h @@ -24,7 +24,6 @@ #endif class nsIInputStream; -struct nsIntRect; class nsPluginDOMContextMenuListener; class nsPluginFrame; class nsDisplayListBuilder; diff --git a/dom/plugins/ipc/PPluginInstance.ipdl b/dom/plugins/ipc/PPluginInstance.ipdl index 659805e99981..cd608eca2033 100644 --- a/dom/plugins/ipc/PPluginInstance.ipdl +++ b/dom/plugins/ipc/PPluginInstance.ipdl @@ -26,7 +26,7 @@ using gfxIntSize from "nsSize.h"; using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; using mozilla::plugins::WindowsSharedMemoryHandle from "mozilla/plugins/PluginMessageUtils.h"; using mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils.h"; -using struct nsIntRect from "nsRect.h"; +using nsIntRect from "nsRect.h"; namespace mozilla { namespace plugins { diff --git a/dom/plugins/ipc/PluginLibrary.h b/dom/plugins/ipc/PluginLibrary.h index 275afa439307..efec7ce84ca1 100644 --- a/dom/plugins/ipc/PluginLibrary.h +++ b/dom/plugins/ipc/PluginLibrary.h @@ -15,10 +15,10 @@ #include "nsError.h" #include "mozilla/EventForwards.h" #include "nsSize.h" +#include "nsRect.h" class gfxContext; class nsCString; -struct nsIntRect; class nsNPAPIPlugin; namespace mozilla { diff --git a/dom/plugins/ipc/PluginUtilsOSX.h b/dom/plugins/ipc/PluginUtilsOSX.h index 164efe814db4..7abab1efdbf9 100644 --- a/dom/plugins/ipc/PluginUtilsOSX.h +++ b/dom/plugins/ipc/PluginUtilsOSX.h @@ -9,8 +9,7 @@ #include "npapi.h" #include "mozilla/gfx/QuartzSupport.h" - -struct nsIntRect; +#include "nsRect.h" namespace mozilla { namespace plugins { diff --git a/gfx/2d/Rect.h b/gfx/2d/Rect.h index c102e501b616..9a9b09d8beae 100644 --- a/gfx/2d/Rect.h +++ b/gfx/2d/Rect.h @@ -8,6 +8,7 @@ #include "BaseRect.h" #include "BaseMargin.h" +#include "NumericTools.h" #include "Point.h" #include "Tools.h" @@ -105,6 +106,21 @@ struct IntRectTyped : { return IntRectTyped::IsEqualEdges(aRect); } + + void InflateToMultiple(const IntSizeTyped& aTileSize) + { + int32_t yMost = this->YMost(); + int32_t xMost = this->XMost(); + + this->x = RoundDownToMultiple(this->x, aTileSize.width); + this->y = RoundDownToMultiple(this->y, aTileSize.height); + xMost = RoundUpToMultiple(xMost, aTileSize.width); + yMost = RoundUpToMultiple(yMost, aTileSize.height); + + this->width = xMost - this->x; + this->height = yMost - this->y; + } + }; typedef IntRectTyped IntRect; diff --git a/gfx/gl/GLTextureImage.cpp b/gfx/gl/GLTextureImage.cpp index 54f2f773b4f3..478b79e42089 100644 --- a/gfx/gl/GLTextureImage.cpp +++ b/gfx/gl/GLTextureImage.cpp @@ -79,7 +79,7 @@ TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface, const gfx::IntPoint* aSrcPoint) { nsIntRegion destRegion = aDestRegion ? *aDestRegion - : nsIntRect(0, 0, + : IntRect(0, 0, aSurface->GetSize().width, aSurface->GetSize().height); gfx::IntPoint srcPoint = aSrcPoint ? *aSrcPoint @@ -120,13 +120,13 @@ BasicTextureImage::BeginUpdate(nsIntRegion& aRegion) if (CanUploadSubTextures(mGLContext)) { GetUpdateRegion(aRegion); } else { - aRegion = nsIntRect(nsIntPoint(0, 0), mSize); + aRegion = IntRect(IntPoint(0, 0), mSize); } mUpdateRegion = aRegion; - nsIntRect rgnSize = mUpdateRegion.GetBounds(); - if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(rgnSize)) { + IntRect rgnSize = mUpdateRegion.GetBounds(); + if (!IntRect(IntPoint(0, 0), mSize).Contains(rgnSize)) { NS_ERROR("update outside of image"); return nullptr; } @@ -147,7 +147,7 @@ BasicTextureImage::GetUpdateRegion(nsIntRegion& aForRegion) // changed, we need to recreate our backing surface and force the // client to paint everything if (mTextureState != Valid) { - aForRegion = nsIntRect(nsIntPoint(0, 0), mSize); + aForRegion = IntRect(IntPoint(0, 0), mSize); } } @@ -169,7 +169,7 @@ BasicTextureImage::EndUpdate() mUpdateRegion, mTexture, mTextureState == Created, - mUpdateOffset, + ToIntPoint(mUpdateOffset), relative); FinishedSurfaceUpload(); @@ -205,10 +205,10 @@ BasicTextureImage::FinishedSurfaceUpload() bool BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0, 0) */) { - nsIntRect bounds = aRegion.GetBounds(); + IntRect bounds = aRegion.GetBounds(); nsIntRegion region; if (mTextureState != Valid) { - bounds = nsIntRect(0, 0, mSize.width, mSize.height); + bounds = IntRect(0, 0, mSize.width, mSize.height); region = nsIntRegion(bounds); } else { region = aRegion; @@ -220,7 +220,7 @@ BasicTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion region, mTexture, mTextureState == Created, - bounds.TopLeft() + nsIntPoint(aFrom.x, aFrom.y), + bounds.TopLeft() + IntPoint(aFrom.x, aFrom.y), false); mTextureState = Valid; return true; @@ -345,7 +345,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion nsIntRegion region; if (mTextureState != Valid) { - nsIntRect bounds = nsIntRect(0, 0, mSize.width, mSize.height); + IntRect bounds = IntRect(0, 0, mSize.width, mSize.height); region = nsIntRegion(bounds); } else { region = aRegion; @@ -355,7 +355,7 @@ TiledTextureImage::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion int oldCurrentImage = mCurrentImage; BeginBigImageIteration(); do { - nsIntRect tileRect = ThebesIntRect(GetSrcTileRect()); + IntRect tileRect = ThebesIntRect(GetSrcTileRect()); int xPos = tileRect.x; int yPos = tileRect.y; @@ -400,7 +400,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion) // if the texture hasn't been initialized yet, or something important // changed, we need to recreate our backing surface and force the // client to paint everything - aForRegion = nsIntRect(nsIntPoint(0, 0), mSize); + aForRegion = IntRect(IntPoint(0, 0), mSize); return; } @@ -411,7 +411,7 @@ TiledTextureImage::GetUpdateRegion(nsIntRegion& aForRegion) for (unsigned i = 0; i < mImages.Length(); i++) { int xPos = (i % mColumns) * mTileSize; int yPos = (i / mColumns) * mTileSize; - nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos), + IntRect imageRect = IntRect(IntPoint(xPos,yPos), mImages[i]->GetSize()); if (aForRegion.Intersects(imageRect)) { @@ -446,16 +446,16 @@ TiledTextureImage::BeginUpdate(nsIntRegion& aRegion) // if the texture hasn't been initialized yet, or something important // changed, we need to recreate our backing surface and force the // client to paint everything - aRegion = nsIntRect(nsIntPoint(0, 0), mSize); + aRegion = IntRect(IntPoint(0, 0), mSize); } - nsIntRect bounds = aRegion.GetBounds(); + IntRect bounds = aRegion.GetBounds(); for (unsigned i = 0; i < mImages.Length(); i++) { int xPos = (i % mColumns) * mTileSize; int yPos = (i / mColumns) * mTileSize; nsIntRegion imageRegion = - nsIntRegion(nsIntRect(nsIntPoint(xPos,yPos), + nsIntRegion(IntRect(IntPoint(xPos,yPos), mImages[i]->GetSize())); // a single Image can handle this update request @@ -510,8 +510,7 @@ TiledTextureImage::EndUpdate() for (unsigned i = 0; i < mImages.Length(); i++) { int xPos = (i % mColumns) * mTileSize; int yPos = (i / mColumns) * mTileSize; - nsIntRect imageRect = nsIntRect(nsIntPoint(xPos,yPos), - mImages[i]->GetSize()); + IntRect imageRect = IntRect(IntPoint(xPos,yPos), mImages[i]->GetSize()); nsIntRegion subregion; subregion.And(mUpdateRegion, imageRect); diff --git a/gfx/gl/GLUploadHelpers.cpp b/gfx/gl/GLUploadHelpers.cpp index 8b1a3fcea06a..3cf04691d9a3 100644 --- a/gfx/gl/GLUploadHelpers.cpp +++ b/gfx/gl/GLUploadHelpers.cpp @@ -50,7 +50,7 @@ NextPowerOfTwo(int aNumber) } static unsigned int -DataOffset(const nsIntPoint &aPoint, int32_t aStride, SurfaceFormat aFormat) +DataOffset(const IntPoint &aPoint, int32_t aStride, SurfaceFormat aFormat) { unsigned int data = aPoint.y * aStride; data += aPoint.x * BytesPerPixel(aFormat); @@ -502,10 +502,10 @@ UploadImageDataToTexture(GLContext* gl, } nsIntRegionRectIterator iter(paintRegion); - const nsIntRect *iterRect; + const IntRect *iterRect; // Top left point of the region's bounding rectangle. - nsIntPoint topLeft = paintRegion.GetBounds().TopLeft(); + IntPoint topLeft = paintRegion.GetBounds().TopLeft(); while ((iterRect = iter.Next())) { // The inital data pointer is at the top left point of the region's @@ -556,7 +556,7 @@ UploadSurfaceToTexture(GLContext* gl, const nsIntRegion& aDstRegion, GLuint& aTexture, bool aOverwrite, - const nsIntPoint& aSrcPoint, + const gfx::IntPoint& aSrcPoint, bool aPixelBuffer, GLenum aTextureUnit, GLenum aTextureTarget) diff --git a/gfx/gl/GLUploadHelpers.h b/gfx/gl/GLUploadHelpers.h index 239e743d051e..1f41b9457791 100644 --- a/gfx/gl/GLUploadHelpers.h +++ b/gfx/gl/GLUploadHelpers.h @@ -74,7 +74,7 @@ UploadSurfaceToTexture(GLContext* gl, const nsIntRegion& aDstRegion, GLuint& aTexture, bool aOverwrite = false, - const nsIntPoint& aSrcPoint = nsIntPoint(0, 0), + const gfx::IntPoint& aSrcPoint = gfx::IntPoint(0, 0), bool aPixelBuffer = false, GLenum aTextureUnit = LOCAL_GL_TEXTURE0, GLenum aTextureTarget = LOCAL_GL_TEXTURE_2D); diff --git a/gfx/gl/TextureImageEGL.cpp b/gfx/gl/TextureImageEGL.cpp index 9380d0a4828b..7d9d519e1200 100644 --- a/gfx/gl/TextureImageEGL.cpp +++ b/gfx/gl/TextureImageEGL.cpp @@ -102,7 +102,7 @@ TextureImageEGL::GetUpdateRegion(nsIntRegion& aForRegion) if (mTextureState != Valid) { // if the texture hasn't been initialized yet, force the // client to paint everything - aForRegion = nsIntRect(nsIntPoint(0, 0), mSize); + aForRegion = gfx::IntRect(gfx::IntPoint(0, 0), mSize); } // We can only draw a rectangle, not subregions due to @@ -122,7 +122,7 @@ TextureImageEGL::BeginUpdate(nsIntRegion& aRegion) mUpdateRect = aRegion.GetBounds(); //printf_stderr("BeginUpdate with updateRect [%d %d %d %d]\n", mUpdateRect.x, mUpdateRect.y, mUpdateRect.width, mUpdateRect.height); - if (!nsIntRect(nsIntPoint(0, 0), mSize).Contains(mUpdateRect)) { + if (!gfx::IntRect(gfx::IntPoint(0, 0), mSize).Contains(mUpdateRect)) { NS_ERROR("update outside of image"); return nullptr; } @@ -198,11 +198,11 @@ TextureImageEGL::EndUpdate() bool TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& aRegion, const gfx::IntPoint& aFrom /* = gfx::IntPoint(0,0) */) { - nsIntRect bounds = aRegion.GetBounds(); + gfx::IntRect bounds = aRegion.GetBounds(); nsIntRegion region; if (mTextureState != Valid) { - bounds = nsIntRect(0, 0, mSize.width, mSize.height); + bounds = gfx::IntRect(0, 0, mSize.width, mSize.height); region = nsIntRegion(bounds); } else { region = aRegion; @@ -214,7 +214,7 @@ TextureImageEGL::DirectUpdate(gfx::DataSourceSurface* aSurf, const nsIntRegion& region, mTexture, mTextureState == Created, - bounds.TopLeft() + nsIntPoint(aFrom.x, aFrom.y), + bounds.TopLeft() + gfx::IntPoint(aFrom.x, aFrom.y), false); mTextureState = Valid; diff --git a/gfx/ipc/GfxMessageUtils.h b/gfx/ipc/GfxMessageUtils.h index a678137fb8f0..ab4c94299444 100644 --- a/gfx/ipc/GfxMessageUtils.h +++ b/gfx/ipc/GfxMessageUtils.h @@ -391,28 +391,6 @@ struct ParamTraits > } }; -template<> -struct ParamTraits -{ - typedef nsIntRect paramType; - - static void Write(Message* msg, const paramType& param) - { - WriteParam(msg, param.x); - WriteParam(msg, param.y); - WriteParam(msg, param.width); - WriteParam(msg, param.height); - } - - static bool Read(const Message* msg, void** iter, paramType* result) - { - return (ReadParam(msg, iter, &result->x) && - ReadParam(msg, iter, &result->y) && - ReadParam(msg, iter, &result->width) && - ReadParam(msg, iter, &result->height)); - } -}; - template struct RegionParamTraits { diff --git a/gfx/layers/LayerTreeInvalidation.cpp b/gfx/layers/LayerTreeInvalidation.cpp index 56a8f08bf070..c0f476846675 100644 --- a/gfx/layers/LayerTreeInvalidation.cpp +++ b/gfx/layers/LayerTreeInvalidation.cpp @@ -21,8 +21,7 @@ #include "nsDebug.h" // for NS_ASSERTION #include "nsHashKeys.h" // for nsPtrHashKey #include "nsISupportsImpl.h" // for Layer::AddRef, etc -#include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect +#include "nsRect.h" // for IntRect #include "nsTArray.h" // for nsAutoTArray, nsTArray_Impl using namespace mozilla::gfx; @@ -33,20 +32,20 @@ namespace layers { struct LayerPropertiesBase; UniquePtr CloneLayerTreePropertiesInternal(Layer* aRoot, bool aIsMask = false); -static nsIntRect -TransformRect(const nsIntRect& aRect, const Matrix4x4& aTransform) +static IntRect +TransformRect(const IntRect& aRect, const Matrix4x4& aTransform) { if (aRect.IsEmpty()) { - return nsIntRect(); + return IntRect(); } Rect rect(aRect.x, aRect.y, aRect.width, aRect.height); rect = aTransform.TransformBounds(rect); rect.RoundOut(); - nsIntRect intRect; + IntRect intRect; if (!gfxUtils::GfxRectToIntRect(ThebesRect(rect), &intRect)) { - return nsIntRect(); + return IntRect(); } return intRect; @@ -56,7 +55,7 @@ static void AddTransformedRegion(nsIntRegion& aDest, const nsIntRegion& aSource, const Matrix4x4& aTransform) { nsIntRegionRectIterator iter(aSource); - const nsIntRect *r; + const IntRect *r; while ((r = iter.Next())) { aDest.Or(aDest, TransformRect(*r, aTransform)); } @@ -127,12 +126,12 @@ struct LayerPropertiesBase : public LayerProperties { MOZ_COUNT_DTOR(LayerPropertiesBase); } - - virtual nsIntRegion ComputeDifferences(Layer* aRoot, + + virtual nsIntRegion ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFunc aCallback, bool* aGeometryChanged); - virtual void MoveBy(const nsIntPoint& aOffset); + virtual void MoveBy(const IntPoint& aOffset); nsIntRegion ComputeChange(NotifySubDocInvalidationFunc aCallback, bool& aGeometryChanged) @@ -176,12 +175,12 @@ struct LayerPropertiesBase : public LayerProperties return result; } - nsIntRect NewTransformedBounds() + IntRect NewTransformedBounds() { return TransformRect(mLayer->GetVisibleRegion().GetBounds(), mLayer->GetLocalTransform()); } - nsIntRect OldTransformedBounds() + IntRect OldTransformedBounds() { return TransformRect(mVisibleRegion.GetBounds(), mTransform); } @@ -189,7 +188,7 @@ struct LayerPropertiesBase : public LayerProperties virtual nsIntRegion ComputeChangeInternal(NotifySubDocInvalidationFunc aCallback, bool& aGeometryChanged) { - return nsIntRect(); + return IntRect(); } nsRefPtr mLayer; @@ -351,7 +350,7 @@ struct ColorLayerProperties : public LayerPropertiesBase } gfxRGBA mColor; - nsIntRect mBounds; + IntRect mBounds; }; struct ImageLayerProperties : public LayerPropertiesBase @@ -373,7 +372,7 @@ struct ImageLayerProperties : public LayerPropertiesBase if (!imageLayer->GetVisibleRegion().IsEqual(mVisibleRegion)) { aGeometryChanged = true; - nsIntRect result = NewTransformedBounds(); + IntRect result = NewTransformedBounds(); result = result.Union(OldTransformedBounds()); return result; } @@ -389,7 +388,7 @@ struct ImageLayerProperties : public LayerPropertiesBase // Mask layers have an empty visible region, so we have to // use the image size instead. IntSize size = container->GetCurrentSize(); - nsIntRect rect(0, 0, size.width, size.height); + IntRect rect(0, 0, size.width, size.height); return TransformRect(rect, mLayer->GetLocalTransform()); } else { @@ -397,7 +396,7 @@ struct ImageLayerProperties : public LayerPropertiesBase } } - return nsIntRect(); + return IntRect(); } nsRefPtr mContainer; @@ -466,7 +465,7 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu } else { ClearInvalidations(aRoot); } - nsIntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(), + IntRect result = TransformRect(aRoot->GetVisibleRegion().GetBounds(), aRoot->GetLocalTransform()); result = result.Union(OldTransformedBounds()); if (aGeometryChanged != nullptr) { @@ -484,7 +483,7 @@ LayerPropertiesBase::ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFu } void -LayerPropertiesBase::MoveBy(const nsIntPoint& aOffset) +LayerPropertiesBase::MoveBy(const IntPoint& aOffset) { mTransform.PostTranslate(aOffset.x, aOffset.y, 0); } diff --git a/gfx/layers/LayerTreeInvalidation.h b/gfx/layers/LayerTreeInvalidation.h index ab71b65e554c..1d6b2af0fe70 100644 --- a/gfx/layers/LayerTreeInvalidation.h +++ b/gfx/layers/LayerTreeInvalidation.h @@ -8,9 +8,9 @@ #include "nsRegion.h" // for nsIntRegion #include "mozilla/UniquePtr.h" // for UniquePtr +#include "mozilla/gfx/Point.h" class nsPresContext; -struct nsIntPoint; namespace mozilla { namespace layers { @@ -59,12 +59,11 @@ struct LayerProperties * are invalidated. * @return Painted area changed by the layer tree changes. */ - virtual nsIntRegion ComputeDifferences(Layer* aRoot, + virtual nsIntRegion ComputeDifferences(Layer* aRoot, NotifySubDocInvalidationFunc aCallback, bool* aGeometryChanged = nullptr) = 0; - - - virtual void MoveBy(const nsIntPoint& aOffset) = 0; + + virtual void MoveBy(const gfx::IntPoint& aOffset) = 0; }; } // namespace layers diff --git a/gfx/layers/LayersLogging.h b/gfx/layers/LayersLogging.h index 00f66d6f3127..97498a2c6ff9 100644 --- a/gfx/layers/LayersLogging.h +++ b/gfx/layers/LayersLogging.h @@ -17,8 +17,6 @@ #include "nscore.h" // for nsACString, etc struct gfxRGBA; -struct nsIntPoint; -struct nsIntRect; namespace mozilla { namespace gfx { @@ -52,10 +50,6 @@ void AppendToString(std::stringstream& aStream, const nsRect& r, const char* pfx="", const char* sfx=""); -void -AppendToString(std::stringstream& aStream, const nsIntPoint& p, - const char* pfx="", const char* sfx=""); - template void AppendToString(std::stringstream& aStream, const mozilla::gfx::PointTyped& p, @@ -72,10 +66,6 @@ AppendToString(std::stringstream& aStream, const mozilla::gfx::IntPointTyped& aStream << pfx << p << sfx; } -void -AppendToString(std::stringstream& aStream, const nsIntRect& r, - const char* pfx="", const char* sfx=""); - template void AppendToString(std::stringstream& aStream, const mozilla::gfx::RectTyped& r, diff --git a/gfx/layers/ReadbackLayer.h b/gfx/layers/ReadbackLayer.h index 3e72ce941c99..f9de30bb4f34 100644 --- a/gfx/layers/ReadbackLayer.h +++ b/gfx/layers/ReadbackLayer.h @@ -9,14 +9,13 @@ #include // for uint64_t #include "Layers.h" // for Layer, etc #include "gfxColor.h" // for gfxRGBA -#include "gfxRect.h" // for gfxRect +#include "mozilla/gfx/Rect.h" // for gfxRect +#include "mozilla/gfx/Point.h" // for gfxRect #include "mozilla/mozalloc.h" // for operator delete #include "nsAutoPtr.h" // for nsAutoPtr #include "nsCOMPtr.h" // for already_AddRefed #include "nsDebug.h" // for NS_ASSERTION #include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect -#include "nsSize.h" // for nsIntSize #include "nscore.h" // for nsACString class gfxContext; @@ -61,14 +60,14 @@ public: * first BeginUpdate after a SetUnknown will have the complete background. */ virtual already_AddRefed - BeginUpdate(const nsIntRect& aRect, uint64_t aSequenceNumber) = 0; + BeginUpdate(const gfx::IntRect& aRect, uint64_t aSequenceNumber) = 0; /** * EndUpdate must be called immediately after BeginUpdate, without returning * to the event loop. * @param aContext the context returned by BeginUpdate * Implicitly Restore()s the state of aContext. */ - virtual void EndUpdate(gfxContext* aContext, const nsIntRect& aRect) = 0; + virtual void EndUpdate(gfxContext* aContext, const gfx::IntRect& aRect) = 0; }; /** @@ -122,13 +121,13 @@ public: * has its top-left at 0,0 and has size aSize. * Can only be called while the sink is null! */ - void SetSize(const nsIntSize& aSize) + void SetSize(const gfx::IntSize& aSize) { NS_ASSERTION(!mSink, "Should have no sink while changing size!"); mSize = aSize; } - const nsIntSize& GetSize() { return mSize; } - nsIntRect GetRect() { return nsIntRect(nsIntPoint(0, 0), mSize); } + const gfx::IntSize& GetSize() { return mSize; } + gfx::IntRect GetRect() { return gfx::IntRect(gfx::IntPoint(0, 0), mSize); } bool IsBackgroundKnown() { @@ -180,7 +179,7 @@ protected: uint64_t mSequenceCounter; nsAutoPtr mSink; - nsIntSize mSize; + gfx::IntSize mSize; // This can refer to any (earlier) sibling PaintedLayer. That PaintedLayer // must have mUsedForReadback set on it. If the PaintedLayer is removed diff --git a/gfx/layers/RotatedBuffer.cpp b/gfx/layers/RotatedBuffer.cpp index 754a9fef6fad..e4430f4edaf5 100644 --- a/gfx/layers/RotatedBuffer.cpp +++ b/gfx/layers/RotatedBuffer.cpp @@ -34,12 +34,12 @@ using namespace gfx; namespace layers { -nsIntRect +IntRect RotatedBuffer::GetQuadrantRectangle(XSide aXSide, YSide aYSide) const { // quadrantTranslation is the amount we translate the top-left // of the quadrant by to get coordinates relative to the layer - nsIntPoint quadrantTranslation = -mBufferRotation; + IntPoint quadrantTranslation = -mBufferRotation; quadrantTranslation.x += aXSide == LEFT ? mBufferRect.width : 0; quadrantTranslation.y += aYSide == TOP ? mBufferRect.height : 0; return mBufferRect + quadrantTranslation; @@ -89,8 +89,8 @@ RotatedBuffer::DrawBufferQuadrant(gfx::DrawTarget* aTarget, // render the buffer at mBufferRect + quadrantTranslation to get the // pixels in the right place, but we're only going to paint within // mBufferRect - nsIntRect quadrantRect = GetQuadrantRectangle(aXSide, aYSide); - nsIntRect fillRect; + IntRect quadrantRect = GetQuadrantRectangle(aXSide, aYSide); + IntRect fillRect; if (!fillRect.IntersectRect(mBufferRect, quadrantRect)) return; @@ -241,11 +241,11 @@ RotatedContentBuffer::DrawTo(PaintedLayer* aLayer, } DrawTarget* -RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds, +RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const IntRect& aBounds, ContextSource aSource, DrawIterator* aIter) { - nsIntRect bounds = aBounds; + IntRect bounds = aBounds; if (aIter) { // If an iterator was provided, then BeginPaint must have been run with // PAINT_CAN_DRAW_ROTATED, and the draw region might cover multiple quadrants. @@ -254,7 +254,7 @@ RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds // quadrants we have considered across multiple calls to this function. aIter->mDrawRegion.SetEmpty(); while (aIter->mCount < 4) { - nsIntRect quadrant = GetQuadrantRectangle((aIter->mCount & 1) ? LEFT : RIGHT, + IntRect quadrant = GetQuadrantRectangle((aIter->mCount & 1) ? LEFT : RIGHT, (aIter->mCount & 2) ? TOP : BOTTOM); aIter->mDrawRegion.And(aBounds, quadrant); aIter->mCount++; @@ -294,7 +294,7 @@ RotatedContentBuffer::BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds int32_t yBoundary = mBufferRect.YMost() - mBufferRotation.y; XSide sideX = bounds.XMost() <= xBoundary ? RIGHT : LEFT; YSide sideY = bounds.YMost() <= yBoundary ? BOTTOM : TOP; - nsIntRect quadrantRect = GetQuadrantRectangle(sideX, sideY); + IntRect quadrantRect = GetQuadrantRectangle(sideX, sideY); NS_ASSERTION(quadrantRect.Contains(bounds), "Messed up quadrants"); mLoanedTransform = mLoanedDrawTarget->GetTransform(); @@ -390,10 +390,10 @@ WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize) } } -static nsIntRect -ComputeBufferRect(const nsIntRect& aRequestedRect) +static IntRect +ComputeBufferRect(const IntRect& aRequestedRect) { - nsIntRect rect(aRequestedRect); + IntRect rect(aRequestedRect); // Set a minimum width to guarantee a minimum size of buffers we // allocate (and work around problems on some platforms with smaller // dimensions). 64 is the magic number needed to work around the @@ -447,7 +447,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, SurfaceMode mode; nsIntRegion neededRegion; - nsIntRect destBufferRect; + IntRect destBufferRect; bool canReuseBuffer = HaveBuffer(); @@ -464,7 +464,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, } else if (neededRegion.GetBounds().Size() <= mBufferRect.Size()) { // The buffer's big enough but doesn't contain everything that's // going to be visible. We'll move it. - destBufferRect = nsIntRect(neededRegion.GetBounds().TopLeft(), mBufferRect.Size()); + destBufferRect = IntRect(neededRegion.GetBounds().TopLeft(), mBufferRect.Size()); } else { destBufferRect = neededRegion.GetBounds(); } @@ -555,7 +555,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, FinalizeFrame(result.mRegionToDraw); } - nsIntRect drawBounds = result.mRegionToDraw.GetBounds(); + IntRect drawBounds = result.mRegionToDraw.GetBounds(); RefPtr destDTBuffer; RefPtr destDTBufferOnWhite; uint32_t bufferFlags = 0; @@ -566,40 +566,38 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, if (!EnsureBuffer()) { return result; } - nsIntRect keepArea; + IntRect keepArea; if (keepArea.IntersectRect(destBufferRect, mBufferRect)) { // Set mBufferRotation so that the pixels currently in mDTBuffer // will still be rendered in the right place when mBufferRect // changes to destBufferRect. - nsIntPoint newRotation = mBufferRotation + + IntPoint newRotation = mBufferRotation + (destBufferRect.TopLeft() - mBufferRect.TopLeft()); WrapRotationAxis(&newRotation.x, mBufferRect.width); WrapRotationAxis(&newRotation.y, mBufferRect.height); - NS_ASSERTION(nsIntRect(nsIntPoint(0,0), mBufferRect.Size()).Contains(newRotation), + NS_ASSERTION(gfx::IntRect(gfx::IntPoint(0,0), mBufferRect.Size()).Contains(newRotation), "newRotation out of bounds"); int32_t xBoundary = destBufferRect.XMost() - newRotation.x; int32_t yBoundary = destBufferRect.YMost() - newRotation.y; bool drawWrapsBuffer = (drawBounds.x < xBoundary && xBoundary < drawBounds.XMost()) || (drawBounds.y < yBoundary && yBoundary < drawBounds.YMost()); if ((drawWrapsBuffer && !(aFlags & PAINT_CAN_DRAW_ROTATED)) || - (newRotation != nsIntPoint(0,0) && !canHaveRotation)) { + (newRotation != IntPoint(0,0) && !canHaveRotation)) { // The stuff we need to redraw will wrap around an edge of the // buffer (and the caller doesn't know how to support that), so // move the pixels we can keep into a position that lets us // redraw in just one quadrant. - if (mBufferRotation == nsIntPoint(0,0)) { - nsIntRect srcRect(nsIntPoint(0, 0), mBufferRect.Size()); - nsIntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft(); + if (mBufferRotation == IntPoint(0,0)) { + IntRect srcRect(IntPoint(0, 0), mBufferRect.Size()); + IntPoint dest = mBufferRect.TopLeft() - destBufferRect.TopLeft(); MOZ_ASSERT(mDTBuffer); - mDTBuffer->CopyRect(IntRect(srcRect.x, srcRect.y, srcRect.width, srcRect.height), - IntPoint(dest.x, dest.y)); + mDTBuffer->CopyRect(srcRect, dest); if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) { if (!EnsureBufferOnWhite()) { return result; } MOZ_ASSERT(mDTBufferOnWhite); - mDTBufferOnWhite->CopyRect(IntRect(srcRect.x, srcRect.y, srcRect.width, srcRect.height), - IntPoint(dest.x, dest.y)); + mDTBufferOnWhite->CopyRect(srcRect, dest); } result.mDidSelfCopy = true; mDidSelfCopy = true; @@ -641,7 +639,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, result.mDidSelfCopy = true; mDidSelfCopy = true; mBufferRect = destBufferRect; - mBufferRotation = nsIntPoint(0, 0); + mBufferRotation = IntPoint(0, 0); } if (!result.mDidSelfCopy) { @@ -664,7 +662,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, // will be redrawn, so we don't need to copy anything, so we don't // set destBuffer. mBufferRect = destBufferRect; - mBufferRotation = nsIntPoint(0,0); + mBufferRotation = IntPoint(0,0); } } else { // The buffer's not big enough, so allocate a new one @@ -687,7 +685,7 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, if (destDTBuffer) { if (!isClear && (mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || HaveBufferOnWhite())) { // Copy the bits - nsIntPoint offset = -destBufferRect.TopLeft(); + IntPoint offset = -destBufferRect.TopLeft(); Matrix mat = Matrix::Translation(offset.x, offset.y); destDTBuffer->SetTransform(mat); if (!EnsureBuffer()) { @@ -711,9 +709,9 @@ RotatedContentBuffer::BeginPaint(PaintedLayer* aLayer, mDTBuffer = destDTBuffer.forget(); mDTBufferOnWhite = destDTBufferOnWhite.forget(); mBufferRect = destBufferRect; - mBufferRotation = nsIntPoint(0,0); + mBufferRotation = IntPoint(0,0); } - NS_ASSERTION(canHaveRotation || mBufferRotation == nsIntPoint(0,0), + NS_ASSERTION(canHaveRotation || mBufferRotation == IntPoint(0,0), "Rotation disabled, but we have nonzero rotation?"); nsIntRegion invalidate; @@ -758,7 +756,7 @@ RotatedContentBuffer::BorrowDrawTargetForPainting(PaintState& aPaintState, return nullptr; } nsIntRegionRectIterator iter(*drawPtr); - const nsIntRect *iterRect; + const IntRect *iterRect; while ((iterRect = iter.Next())) { mDTBuffer->FillRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height), ColorPattern(Color(0.0, 0.0, 0.0, 1.0))); @@ -768,7 +766,7 @@ RotatedContentBuffer::BorrowDrawTargetForPainting(PaintState& aPaintState, } else if (aPaintState.mContentType == gfxContentType::COLOR_ALPHA && HaveBuffer()) { // HaveBuffer() => we have an existing buffer that we must clear nsIntRegionRectIterator iter(*drawPtr); - const nsIntRect *iterRect; + const IntRect *iterRect; while ((iterRect = iter.Next())) { result->ClearRect(Rect(iterRect->x, iterRect->y, iterRect->width, iterRect->height)); } diff --git a/gfx/layers/RotatedBuffer.h b/gfx/layers/RotatedBuffer.h index fcf06e3a48ef..3dab3d349be9 100644 --- a/gfx/layers/RotatedBuffer.h +++ b/gfx/layers/RotatedBuffer.h @@ -16,8 +16,6 @@ #include "nsCOMPtr.h" // for already_AddRefed #include "nsDebug.h" // for NS_RUNTIMEABORT #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc -#include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect #include "nsRegion.h" // for nsIntRegion #include "LayersTypes.h" @@ -50,8 +48,8 @@ class RotatedBuffer { public: typedef gfxContentType ContentType; - RotatedBuffer(const nsIntRect& aBufferRect, - const nsIntPoint& aBufferRotation) + RotatedBuffer(const gfx::IntRect& aBufferRect, + const gfx::IntPoint& aBufferRotation) : mBufferRect(aBufferRect) , mBufferRotation(aBufferRotation) , mDidSelfCopy(false) @@ -81,8 +79,8 @@ public: * RotatedBuffer covers. That is what DrawBufferWithRotation() * will paint when it's called. */ - const nsIntRect& BufferRect() const { return mBufferRect; } - const nsIntPoint& BufferRotation() const { return mBufferRotation; } + const gfx::IntRect& BufferRect() const { return mBufferRect; } + const gfx::IntPoint& BufferRotation() const { return mBufferRotation; } virtual bool HaveBuffer() const = 0; virtual bool HaveBufferOnWhite() const = 0; @@ -97,7 +95,7 @@ protected: enum YSide { TOP, BOTTOM }; - nsIntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const; + gfx::IntRect GetQuadrantRectangle(XSide aXSide, YSide aYSide) const; gfx::Rect GetSourceRectangle(XSide aXSide, YSide aYSide) const; @@ -114,7 +112,7 @@ protected: const gfx::Matrix* aMaskTransform) const; /** The area of the PaintedLayer that is covered by the buffer as a whole */ - nsIntRect mBufferRect; + gfx::IntRect mBufferRect; /** * The x and y rotation of the buffer. Conceptually the buffer * has its origin translated to mBufferRect.TopLeft() - mBufferRotation, @@ -125,7 +123,7 @@ protected: * where items falling off the end of the buffer are returned to the * buffer at the other end, not 2D rotation! */ - nsIntPoint mBufferRotation; + gfx::IntPoint mBufferRotation; // When this is true it means that all pixels have moved inside the buffer. // It's not possible to sync with another buffer without a full copy. bool mDidSelfCopy; @@ -135,8 +133,8 @@ class SourceRotatedBuffer : public RotatedBuffer { public: SourceRotatedBuffer(gfx::SourceSurface* aSource, gfx::SourceSurface* aSourceOnWhite, - const nsIntRect& aBufferRect, - const nsIntPoint& aBufferRotation) + const gfx::IntRect& aBufferRect, + const gfx::IntPoint& aBufferRotation) : RotatedBuffer(aBufferRect, aBufferRotation) , mSource(aSource) , mSourceOnWhite(aSourceOnWhite) @@ -310,7 +308,7 @@ public: * will be used. */ virtual void - CreateBuffer(ContentType aType, const nsIntRect& aRect, uint32_t aFlags, + CreateBuffer(ContentType aType, const gfx::IntRect& aRect, uint32_t aFlags, RefPtr* aBlackDT, RefPtr* aWhiteDT) = 0; /** @@ -375,7 +373,7 @@ protected: * draw target, if necessary. */ gfx::DrawTarget* - BorrowDrawTargetForQuadrantUpdate(const nsIntRect& aBounds, + BorrowDrawTargetForQuadrantUpdate(const gfx::IntRect& aBounds, ContextSource aSource, DrawIterator* aIter); diff --git a/gfx/layers/basic/BasicContainerLayer.cpp b/gfx/layers/basic/BasicContainerLayer.cpp index 116aaa3e37af..5e2b01fdb7c4 100644 --- a/gfx/layers/basic/BasicContainerLayer.cpp +++ b/gfx/layers/basic/BasicContainerLayer.cpp @@ -14,7 +14,6 @@ #include "nsCOMPtr.h" // for already_AddRefed #include "nsISupportsImpl.h" // for Layer::AddRef, etc #include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect #include "nsRegion.h" // for nsIntRegion #include "ReadbackProcessor.h" @@ -78,7 +77,7 @@ BasicContainerLayer::ComputeEffectiveTransforms(const Matrix4x4& aTransformToSur } bool -BasicContainerLayer::ChildrenPartitionVisibleRegion(const nsIntRect& aInRect) +BasicContainerLayer::ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect) { Matrix transform; if (!GetEffectiveTransform().CanDraw2D(&transform) || @@ -86,7 +85,7 @@ BasicContainerLayer::ChildrenPartitionVisibleRegion(const nsIntRect& aInRect) return false; nsIntPoint offset(int32_t(transform._31), int32_t(transform._32)); - nsIntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().GetBounds() + offset); + gfx::IntRect rect = aInRect.Intersect(GetEffectiveVisibleRegion().GetBounds() + offset); nsIntRegion covered; for (Layer* l = mFirstChild; l; l = l->GetNextSibling()) { diff --git a/gfx/layers/basic/BasicContainerLayer.h b/gfx/layers/basic/BasicContainerLayer.h index 4b7fbaa1d866..ef825a6efb9c 100644 --- a/gfx/layers/basic/BasicContainerLayer.h +++ b/gfx/layers/basic/BasicContainerLayer.h @@ -12,7 +12,7 @@ #include "nsDebug.h" // for NS_ASSERTION #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR #include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE -struct nsIntRect; +#include "mozilla/gfx/Rect.h" namespace mozilla { namespace layers { @@ -77,7 +77,7 @@ public: * This method can be conservative; it's OK to return false under any * circumstances. */ - bool ChildrenPartitionVisibleRegion(const nsIntRect& aInRect); + bool ChildrenPartitionVisibleRegion(const gfx::IntRect& aInRect); void ForceIntermediateSurface() { mUseIntermediateSurface = true; } diff --git a/gfx/layers/client/ClientTiledPaintedLayer.cpp b/gfx/layers/client/ClientTiledPaintedLayer.cpp index 942280b6c2bd..5c45f0f37f36 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.cpp +++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp @@ -18,7 +18,6 @@ #include "mozilla/layers/LayersMessages.h" #include "mozilla/mozalloc.h" // for operator delete, etc #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc -#include "nsRect.h" // for nsIntRect #include "LayersLogging.h" namespace mozilla { @@ -424,12 +423,12 @@ ClientTiledPaintedLayer::RenderLayer() // outside of our texture coords. Make the visible region a single rect, // and pad it out by 1 pixel (restricted to tile boundaries) so that // we always have valid content or transparent pixels to sample from. - nsIntRect bounds = neededRegion.GetBounds(); - nsIntRect wholeTiles = bounds; - wholeTiles.InflateToMultiple(nsIntSize( + IntRect bounds = neededRegion.GetBounds(); + IntRect wholeTiles = bounds; + wholeTiles.InflateToMultiple(IntSize( gfxPlatform::GetPlatform()->GetTileWidth(), gfxPlatform::GetPlatform()->GetTileHeight())); - nsIntRect padded = bounds; + IntRect padded = bounds; padded.Inflate(1); padded.IntersectRect(padded, wholeTiles); neededRegion = padded; diff --git a/gfx/layers/composite/CanvasLayerComposite.cpp b/gfx/layers/composite/CanvasLayerComposite.cpp index 4f2788cfe792..665c95a16cdd 100644 --- a/gfx/layers/composite/CanvasLayerComposite.cpp +++ b/gfx/layers/composite/CanvasLayerComposite.cpp @@ -17,7 +17,6 @@ #include "nsAString.h" #include "nsRefPtr.h" // for nsRefPtr #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc -#include "nsPoint.h" // for nsIntPoint #include "nsString.h" // for nsAutoCString #include "gfxVR.h" diff --git a/gfx/layers/composite/CanvasLayerComposite.h b/gfx/layers/composite/CanvasLayerComposite.h index b47c30cebf1f..db6bfbb86d08 100644 --- a/gfx/layers/composite/CanvasLayerComposite.h +++ b/gfx/layers/composite/CanvasLayerComposite.h @@ -14,7 +14,6 @@ #include "nsDebug.h" // for NS_RUNTIMEABORT #include "nsRect.h" // for nsIntRect #include "nscore.h" // for nsACString -struct nsIntPoint; namespace mozilla { namespace layers { diff --git a/gfx/layers/composite/ColorLayerComposite.cpp b/gfx/layers/composite/ColorLayerComposite.cpp index 231e93551884..cdc23320114b 100644 --- a/gfx/layers/composite/ColorLayerComposite.cpp +++ b/gfx/layers/composite/ColorLayerComposite.cpp @@ -14,20 +14,18 @@ #include "mozilla/layers/CompositorTypes.h" // for DiagnosticFlags::COLOR #include "mozilla/layers/Effects.h" // for Effect, EffectChain, etc #include "mozilla/mozalloc.h" // for operator delete, etc -#include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect namespace mozilla { namespace layers { void -ColorLayerComposite::RenderLayer(const nsIntRect& aClipRect) +ColorLayerComposite::RenderLayer(const gfx::IntRect& aClipRect) { EffectChain effects(this); GenEffectChain(effects); - nsIntRect boundRect = GetBounds(); + gfx::IntRect boundRect = GetBounds(); LayerManagerComposite::AutoAddMaskEffect autoMaskEffect(GetMaskLayer(), effects); diff --git a/gfx/layers/composite/ColorLayerComposite.h b/gfx/layers/composite/ColorLayerComposite.h index f102028f7919..9f36e1e0872f 100644 --- a/gfx/layers/composite/ColorLayerComposite.h +++ b/gfx/layers/composite/ColorLayerComposite.h @@ -11,9 +11,6 @@ #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc -struct nsIntPoint; -struct nsIntRect; - namespace mozilla { namespace layers { @@ -50,7 +47,7 @@ public: virtual void Destroy() override { mDestroyed = true; } - virtual void RenderLayer(const nsIntRect& aClipRect) override; + virtual void RenderLayer(const gfx::IntRect& aClipRect) override; virtual void CleanupResources() override {}; virtual void GenEffectChain(EffectChain& aEffect) override; diff --git a/gfx/layers/composite/CompositableHost.h b/gfx/layers/composite/CompositableHost.h index 526d3b387df1..3624ceb26965 100644 --- a/gfx/layers/composite/CompositableHost.h +++ b/gfx/layers/composite/CompositableHost.h @@ -28,9 +28,6 @@ #include "nscore.h" // for nsACString #include "Units.h" // for CSSToScreenScale -struct nsIntPoint; -struct nsIntRect; - namespace mozilla { namespace gfx { class Matrix4x4; @@ -108,7 +105,7 @@ public: virtual LayerRenderState GetRenderState() = 0; - virtual void SetPictureRect(const nsIntRect& aPictureRect) + virtual void SetPictureRect(const gfx::IntRect& aPictureRect) { MOZ_ASSERT(false, "Should have been overridden"); } diff --git a/gfx/layers/composite/ContainerLayerComposite.cpp b/gfx/layers/composite/ContainerLayerComposite.cpp index fef39072c1a9..bb911d91032c 100755 --- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -29,8 +29,6 @@ #include "nsDebug.h" // for NS_ASSERTION #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc #include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE -#include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect #include "nsRegion.h" // for nsIntRegion #include "nsTArray.h" // for nsAutoTArray #include "TextRenderer.h" // for TextRenderer @@ -85,8 +83,8 @@ static void DrawLayerInfo(const RenderTargetIntRect& aClipRect, uint32_t maxWidth = std::min(visibleRegion.GetBounds().width, 500); - nsIntPoint topLeft = visibleRegion.GetBounds().TopLeft(); - aManager->GetTextRenderer()->RenderText(ss.str().c_str(), gfx::IntPoint(topLeft.x, topLeft.y), + IntPoint topLeft = visibleRegion.GetBounds().TopLeft(); + aManager->GetTextRenderer()->RenderText(ss.str().c_str(), topLeft, aLayer->GetEffectiveTransform(), 16, maxWidth); } @@ -94,9 +92,7 @@ static void DrawLayerInfo(const RenderTargetIntRect& aClipRect, template static gfx::IntRect ContainerVisibleRect(ContainerT* aContainer) { - nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); - gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y, - visibleRect.width, visibleRect.height); + gfx::IntRect surfaceRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); return surfaceRect; } @@ -137,7 +133,7 @@ struct PreparedLayer template void ContainerRenderVR(ContainerT* aContainer, LayerManagerComposite* aManager, - const nsIntRect& aClipRect, + const gfx::IntRect& aClipRect, gfx::VRHMDInfo* aHMD) { RefPtr surface; @@ -146,7 +142,7 @@ ContainerRenderVR(ContainerT* aContainer, RefPtr previousTarget = compositor->GetCurrentRenderTarget(); - nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); + gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); float opacity = aContainer->GetEffectiveOpacity(); @@ -176,7 +172,7 @@ ContainerRenderVR(ContainerT* aContainer, /** * Render this container's contents. */ - nsIntRect surfaceClipRect(0, 0, surfaceRect.width, surfaceRect.height); + gfx::IntRect surfaceClipRect(0, 0, surfaceRect.width, surfaceRect.height); RenderTargetIntRect rtClipRect(0, 0, surfaceRect.width, surfaceRect.height); for (uint32_t i = 0; i < children.Length(); i++) { LayerComposite* layerToRender = static_cast(children.ElementAt(i)->ImplData()); @@ -352,7 +348,7 @@ RenderLayers(ContainerT* aContainer, // intersect areas in different coordinate spaces. So we do this a little more permissively // and only fill in the background when we know there is checkerboard, which in theory // should only occur transiently. - nsIntRect layerBounds = layer->GetLayerBounds(); + gfx::IntRect layerBounds = layer->GetLayerBounds(); EffectChain effectChain(layer); effectChain.mPrimaryEffect = new EffectSolidColor(ToColor(color)); aManager->GetCompositor()->DrawQuad(gfx::Rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height), @@ -365,12 +361,12 @@ RenderLayers(ContainerT* aContainer, // Composer2D will compose this layer so skip GPU composition // this time & reset composition flag for next composition phase layerToRender->SetLayerComposited(false); - nsIntRect clearRect = layerToRender->GetClearRect(); + gfx::IntRect clearRect = layerToRender->GetClearRect(); if (!clearRect.IsEmpty()) { // Clear layer's visible rect on FrameBuffer with transparent pixels gfx::Rect fbRect(clearRect.x, clearRect.y, clearRect.width, clearRect.height); compositor->ClearRect(fbRect); - layerToRender->SetClearRect(nsIntRect(0, 0, 0, 0)); + layerToRender->SetClearRect(gfx::IntRect(0, 0, 0, 0)); } } else { layerToRender->RenderLayer(RenderTargetPixel::ToUntyped(clipRect)); @@ -445,7 +441,7 @@ CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer, LayerManagerComposite* aManager) { Compositor* compositor = aManager->GetCompositor(); - nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); + gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); RefPtr previousTarget = compositor->GetCurrentRenderTarget(); gfx::IntRect surfaceRect = gfx::IntRect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height); @@ -465,7 +461,7 @@ CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer, template void RenderIntermediate(ContainerT* aContainer, LayerManagerComposite* aManager, - const nsIntRect& aClipRect, + const gfx::IntRect& aClipRect, RefPtr surface) { Compositor* compositor = aManager->GetCompositor(); @@ -485,7 +481,7 @@ RenderIntermediate(ContainerT* aContainer, template void ContainerRender(ContainerT* aContainer, LayerManagerComposite* aManager, - const nsIntRect& aClipRect) + const gfx::IntRect& aClipRect) { MOZ_ASSERT(aContainer->mPrepared); @@ -515,7 +511,7 @@ ContainerRender(ContainerT* aContainer, float opacity = aContainer->GetEffectiveOpacity(); - nsIntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); + gfx::IntRect visibleRect = aContainer->GetEffectiveVisibleRegion().GetBounds(); #ifdef MOZ_DUMP_PAINTING if (gfxUtils::sDumpPainting) { RefPtr surf = surface->Dump(aManager->GetCompositor()); @@ -614,7 +610,7 @@ ContainerLayerComposite::GetFirstChildComposite() } void -ContainerLayerComposite::RenderLayer(const nsIntRect& aClipRect) +ContainerLayerComposite::RenderLayer(const gfx::IntRect& aClipRect) { ContainerRender(this, mCompositeManager, aClipRect); } @@ -665,7 +661,7 @@ RefLayerComposite::GetFirstChildComposite() } void -RefLayerComposite::RenderLayer(const nsIntRect& aClipRect) +RefLayerComposite::RenderLayer(const gfx::IntRect& aClipRect) { ContainerRender(this, mCompositeManager, aClipRect); } diff --git a/gfx/layers/composite/ContainerLayerComposite.h b/gfx/layers/composite/ContainerLayerComposite.h index 642ed1939978..5621d24acc37 100644 --- a/gfx/layers/composite/ContainerLayerComposite.h +++ b/gfx/layers/composite/ContainerLayerComposite.h @@ -10,9 +10,7 @@ #include "mozilla/Attributes.h" // for override #include "mozilla/UniquePtr.h" // for UniquePtr #include "mozilla/layers/LayerManagerComposite.h" - -struct nsIntPoint; -struct nsIntRect; +#include "mozilla/gfx/Rect.h" namespace mozilla { namespace layers { @@ -39,7 +37,7 @@ class ContainerLayerComposite : public ContainerLayer, template friend void RenderIntermediate(ContainerT* aContainer, LayerManagerComposite* aManager, - const nsIntRect& aClipRect, + const gfx::IntRect& aClipRect, RefPtr surface); template friend RefPtr @@ -77,7 +75,7 @@ public: LayerComposite* GetFirstChildComposite() override; - virtual void RenderLayer(const nsIntRect& aClipRect) override; + virtual void RenderLayer(const gfx::IntRect& aClipRect) override; virtual void Prepare(const RenderTargetIntRect& aClipRect) override; virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override @@ -126,26 +124,26 @@ class RefLayerComposite : public RefLayer, template friend void ContainerRender(ContainerT* aContainer, LayerManagerComposite* aManager, - const nsIntRect& aClipRect); + const gfx::IntRect& aClipRect); template friend void RenderLayers(ContainerT* aContainer, LayerManagerComposite* aManager, - const nsIntRect& aClipRect); + const gfx::IntRect& aClipRect); template friend void RenderIntermediate(ContainerT* aContainer, LayerManagerComposite* aManager, - const nsIntRect& aClipRect, + const gfx::IntRect& aClipRect, RefPtr surface); template friend RefPtr CreateTemporaryTargetAndCopyFromBackground(ContainerT* aContainer, LayerManagerComposite* aManager, - const nsIntRect& aClipRect); + const gfx::IntRect& aClipRect); template friend RefPtr CreateTemporaryTarget(ContainerT* aContainer, LayerManagerComposite* aManager, - const nsIntRect& aClipRect); + const gfx::IntRect& aClipRect); public: explicit RefLayerComposite(LayerManagerComposite *aManager); @@ -161,7 +159,7 @@ public: LayerComposite* GetFirstChildComposite() override; - virtual void RenderLayer(const nsIntRect& aClipRect) override; + virtual void RenderLayer(const gfx::IntRect& aClipRect) override; virtual void Prepare(const RenderTargetIntRect& aClipRect) override; virtual void ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSurface) override diff --git a/gfx/layers/composite/ContentHost.cpp b/gfx/layers/composite/ContentHost.cpp index 166184f778a7..a8d95341c1df 100644 --- a/gfx/layers/composite/ContentHost.cpp +++ b/gfx/layers/composite/ContentHost.cpp @@ -327,7 +327,7 @@ ContentHostSingleBuffered::UpdateThebes(const ThebesBufferData& aData, // Select only the pixels that are still within the buffer. nsIntRegion finalRegion; - finalRegion.And(nsIntRect(nsIntPoint(), bufferSize), destRegion); + finalRegion.And(IntRect(IntPoint(), bufferSize), destRegion); // For each of the overlap areas (right, bottom-right, bottom), select those // pixels and wrap them around to the opposite edge of the buffer rect. diff --git a/gfx/layers/composite/ImageLayerComposite.cpp b/gfx/layers/composite/ImageLayerComposite.cpp index afd630c5d76a..025ba722ba31 100644 --- a/gfx/layers/composite/ImageLayerComposite.cpp +++ b/gfx/layers/composite/ImageLayerComposite.cpp @@ -21,8 +21,6 @@ #include "nsRefPtr.h" // for nsRefPtr #include "nsDebug.h" // for NS_ASSERTION #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc -#include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect #include "nsString.h" // for nsAutoCString namespace mozilla { @@ -82,7 +80,7 @@ ImageLayerComposite::GetLayer() } void -ImageLayerComposite::RenderLayer(const nsIntRect& aClipRect) +ImageLayerComposite::RenderLayer(const IntRect& aClipRect) { if (!mImageHost || !mImageHost->IsAttached()) { return; diff --git a/gfx/layers/composite/ImageLayerComposite.h b/gfx/layers/composite/ImageLayerComposite.h index 1cb0499a6fbe..850dc52fea8c 100644 --- a/gfx/layers/composite/ImageLayerComposite.h +++ b/gfx/layers/composite/ImageLayerComposite.h @@ -9,6 +9,7 @@ #include "GLTextureImage.h" // for TextureImage #include "ImageLayers.h" // for ImageLayer #include "mozilla/Attributes.h" // for override +#include "mozilla/gfx/Rect.h" #include "mozilla/RefPtr.h" // for RefPtr #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc #include "mozilla/layers/LayersTypes.h" // for LayerRenderState, etc @@ -16,9 +17,6 @@ #include "nscore.h" // for nsACString #include "CompositableHost.h" // for CompositableHost -struct nsIntPoint; -struct nsIntRect; - namespace mozilla { namespace layers { @@ -54,7 +52,7 @@ public: } } - virtual void RenderLayer(const nsIntRect& aClipRect) override; + virtual void RenderLayer(const gfx::IntRect& aClipRect) override; virtual void ComputeEffectiveTransforms(const mozilla::gfx::Matrix4x4& aTransformToSurface) override; diff --git a/gfx/layers/composite/PaintedLayerComposite.cpp b/gfx/layers/composite/PaintedLayerComposite.cpp index 076efd0d9a7a..20f79e0bcb57 100644 --- a/gfx/layers/composite/PaintedLayerComposite.cpp +++ b/gfx/layers/composite/PaintedLayerComposite.cpp @@ -22,9 +22,6 @@ #include "nsRefPtr.h" // for nsRefPtr #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc #include "nsMathUtils.h" // for NS_lround -#include "nsPoint.h" // for nsIntPoint -#include "nsRect.h" // for nsIntRect -#include "nsSize.h" // for nsIntSize #include "nsString.h" // for nsAutoCString #include "TextRenderer.h" #include "GeckoProfiler.h" @@ -114,7 +111,7 @@ PaintedLayerComposite::GetRenderState() } void -PaintedLayerComposite::RenderLayer(const nsIntRect& aClipRect) +PaintedLayerComposite::RenderLayer(const gfx::IntRect& aClipRect) { if (!mBuffer || !mBuffer->IsAttached()) { return; diff --git a/gfx/layers/composite/PaintedLayerComposite.h b/gfx/layers/composite/PaintedLayerComposite.h index 564ea4e8fc6c..911f99945723 100644 --- a/gfx/layers/composite/PaintedLayerComposite.h +++ b/gfx/layers/composite/PaintedLayerComposite.h @@ -7,7 +7,7 @@ #define GFX_PaintedLayerComposite_H #include "Layers.h" // for Layer (ptr only), etc -#include "gfxRect.h" // for gfxRect +#include "mozilla/gfx/Rect.h" #include "mozilla/Attributes.h" // for override #include "mozilla/RefPtr.h" // for RefPtr #include "mozilla/layers/LayerManagerComposite.h" // for LayerComposite, etc @@ -16,9 +16,6 @@ #include "nsRegion.h" // for nsIntRegion #include "nscore.h" // for nsACString -struct nsIntPoint; -struct nsIntRect; - namespace mozilla { namespace layers { @@ -57,7 +54,7 @@ public: virtual TiledLayerComposer* GetTiledLayerComposer() override; - virtual void RenderLayer(const nsIntRect& aClipRect) override; + virtual void RenderLayer(const gfx::IntRect& aClipRect) override; virtual void CleanupResources() override; diff --git a/gfx/layers/composite/TextureHost.cpp b/gfx/layers/composite/TextureHost.cpp index 66bff22a0511..d685f38f8b87 100644 --- a/gfx/layers/composite/TextureHost.cpp +++ b/gfx/layers/composite/TextureHost.cpp @@ -58,8 +58,6 @@ #define RECYCLE_LOG(...) do { } while (0) #endif -struct nsIntPoint; - namespace mozilla { namespace layers { diff --git a/gfx/layers/composite/TextureHost.h b/gfx/layers/composite/TextureHost.h index ec8e639a1e02..c734a64a121f 100644 --- a/gfx/layers/composite/TextureHost.h +++ b/gfx/layers/composite/TextureHost.h @@ -28,9 +28,9 @@ #include "nsTraceRefcnt.h" // for MOZ_COUNT_CTOR, etc #include "nscore.h" // for nsACString #include "mozilla/layers/AtomicRefCountedWithFinalize.h" +#include "mozilla/gfx/Rect.h" class gfxReusableSurfaceWrapper; -struct nsIntRect; namespace mozilla { namespace gl { @@ -70,7 +70,7 @@ class BigImageIterator public: virtual void BeginBigImageIteration() = 0; virtual void EndBigImageIteration() {}; - virtual nsIntRect GetTileRect() = 0; + virtual gfx::IntRect GetTileRect() = 0; virtual size_t GetTileCount() = 0; virtual bool NextTile() = 0; }; diff --git a/gfx/layers/composite/TiledContentHost.cpp b/gfx/layers/composite/TiledContentHost.cpp index 70883ccad581..c21e94c7fe79 100644 --- a/gfx/layers/composite/TiledContentHost.cpp +++ b/gfx/layers/composite/TiledContentHost.cpp @@ -13,9 +13,9 @@ #include "mozilla/layers/TextureHostOGL.h" // for TextureHostOGL #include "nsAString.h" #include "nsDebug.h" // for NS_WARNING -#include "nsPoint.h" // for nsIntPoint +#include "nsPoint.h" // for IntPoint #include "nsPrintfCString.h" // for nsPrintfCString -#include "nsRect.h" // for nsIntRect +#include "nsRect.h" // for IntRect #include "nsSize.h" // for nsIntSize #include "mozilla/layers/TiledContentClient.h" @@ -171,7 +171,7 @@ TiledLayerBufferComposite::Upload() TileHost TiledLayerBufferComposite::ValidateTile(TileHost aTile, - const nsIntPoint& aTileOrigin, + const IntPoint& aTileOrigin, const nsIntRegion& aDirtyRect) { if (aTile.IsPlaceholderTile()) { @@ -465,7 +465,7 @@ TiledContentHost::RenderTile(const TileHost& aTile, const gfx::Filter& aFilter, const gfx::Rect& aClipRect, const nsIntRegion& aScreenRegion, - const nsIntPoint& aTextureOffset, + const IntPoint& aTextureOffset, const nsIntSize& aTextureBounds) { if (aTile.IsPlaceholderTile()) { @@ -477,7 +477,7 @@ TiledContentHost::RenderTile(const TileHost& aTile, if (aBackgroundColor) { aEffectChain.mPrimaryEffect = new EffectSolidColor(ToColor(*aBackgroundColor)); nsIntRegionRectIterator it(aScreenRegion); - for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) { + for (const IntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) { Rect graphicsRect(rect->x, rect->y, rect->width, rect->height); mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, 1.0, aTransform); } @@ -507,7 +507,7 @@ TiledContentHost::RenderTile(const TileHost& aTile, aEffectChain.mPrimaryEffect = effect; nsIntRegionRectIterator it(aScreenRegion); - for (const nsIntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) { + for (const IntRect* rect = it.Next(); rect != nullptr; rect = it.Next()) { Rect graphicsRect(rect->x, rect->y, rect->width, rect->height); Rect textureRect(rect->x - aTextureOffset.x, rect->y - aTextureOffset.y, rect->width, rect->height); @@ -574,7 +574,7 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer, uint32_t rowCount = 0; uint32_t tileX = 0; - nsIntRect visibleRect = aVisibleRegion.GetBounds(); + IntRect visibleRect = aVisibleRegion.GetBounds(); gfx::IntSize scaledTileSize = aLayerBuffer.GetScaledTileSize(); for (int32_t x = visibleRect.x; x < visibleRect.x + visibleRect.width;) { rowCount++; @@ -592,17 +592,17 @@ TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer, } TileHost tileTexture = aLayerBuffer. - GetTile(nsIntPoint(aLayerBuffer.RoundDownToTileEdge(x, scaledTileSize.width), - aLayerBuffer.RoundDownToTileEdge(y, scaledTileSize.height))); + GetTile(IntPoint(aLayerBuffer.RoundDownToTileEdge(x, scaledTileSize.width), + aLayerBuffer.RoundDownToTileEdge(y, scaledTileSize.height))); if (tileTexture != aLayerBuffer.GetPlaceholderTile()) { nsIntRegion tileDrawRegion; - tileDrawRegion.And(nsIntRect(x, y, w, h), aLayerBuffer.GetValidRegion()); + tileDrawRegion.And(IntRect(x, y, w, h), aLayerBuffer.GetValidRegion()); tileDrawRegion.And(tileDrawRegion, aVisibleRegion); tileDrawRegion.Sub(tileDrawRegion, maskRegion); if (!tileDrawRegion.IsEmpty()) { tileDrawRegion.ScaleRoundOut(resolution, resolution); - nsIntPoint tileOffset((x - tileStartX) * resolution, + IntPoint tileOffset((x - tileStartX) * resolution, (y - tileStartY) * resolution); gfx::IntSize tileSize = aLayerBuffer.GetTileSize(); RenderTile(tileTexture, aBackgroundColor, aEffectChain, aOpacity, aTransform, diff --git a/gfx/layers/composite/TiledContentHost.h b/gfx/layers/composite/TiledContentHost.h index f765a063a8f5..6281aa9e3a89 100644 --- a/gfx/layers/composite/TiledContentHost.h +++ b/gfx/layers/composite/TiledContentHost.h @@ -32,8 +32,6 @@ #endif class gfxReusableSurfaceWrapper; -struct nsIntPoint; -struct nsIntRect; namespace mozilla { namespace gfx { @@ -164,7 +162,7 @@ public: protected: TileHost ValidateTile(TileHost aTile, - const nsIntPoint& aTileRect, + const gfx::IntPoint& aTileRect, const nsIntRegion& dirtyRect); // do nothing, the desctructor in the texture host takes care of releasing resources @@ -291,7 +289,7 @@ private: const gfx::Filter& aFilter, const gfx::Rect& aClipRect, const nsIntRegion& aScreenRegion, - const nsIntPoint& aTextureOffset, + const gfx::IntPoint& aTextureOffset, const gfx::IntSize& aTextureBounds); void EnsureTileStore() {} diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 6b19cf62436f..52d43ead6bc7 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1076,7 +1076,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, UINT offset = 0; mContext->IASetVertexBuffers(0, 1, &buffer, &size, &offset); - nsIntRect intRect = nsIntRect(nsIntPoint(0, 0), mSize); + nsIntRect intRect = IntRect(IntPoint(0, 0), mSize); // Sometimes the invalid region is larger than we want to draw. nsIntRegion invalidRegionSafe; diff --git a/gfx/layers/d3d9/DeviceManagerD3D9.cpp b/gfx/layers/d3d9/DeviceManagerD3D9.cpp index 75750e68ca24..a978d10bad16 100644 --- a/gfx/layers/d3d9/DeviceManagerD3D9.cpp +++ b/gfx/layers/d3d9/DeviceManagerD3D9.cpp @@ -132,7 +132,7 @@ SwapChainD3D9::PrepareForRendering() } void -SwapChainD3D9::Present(const nsIntRect &aRect) +SwapChainD3D9::Present(const gfx::IntRect &aRect) { RECT r; r.left = aRect.x; diff --git a/gfx/layers/d3d9/DeviceManagerD3D9.h b/gfx/layers/d3d9/DeviceManagerD3D9.h index a29f96d7980b..18419aba22e4 100644 --- a/gfx/layers/d3d9/DeviceManagerD3D9.h +++ b/gfx/layers/d3d9/DeviceManagerD3D9.h @@ -12,8 +12,7 @@ #include "nsTArray.h" #include "mozilla/layers/CompositorTypes.h" #include "mozilla/RefPtr.h" - -struct nsIntRect; +#include "mozilla/gfx/Rect.h" namespace mozilla { namespace layers { @@ -102,7 +101,7 @@ public: * This function will present the selected rectangle of the swap chain to * its associated window. */ - void Present(const nsIntRect &aRect); + void Present(const gfx::IntRect &aRect); void Present(); private: diff --git a/gfx/layers/ipc/CompositableForwarder.h b/gfx/layers/ipc/CompositableForwarder.h index 69992b2a7989..3f08962b94cf 100644 --- a/gfx/layers/ipc/CompositableForwarder.h +++ b/gfx/layers/ipc/CompositableForwarder.h @@ -15,9 +15,7 @@ #include "mozilla/layers/LayersTypes.h" // for LayersBackend #include "mozilla/layers/TextureClient.h" // for TextureClient #include "nsRegion.h" // for nsIntRegion - -struct nsIntPoint; -struct nsIntRect; +#include "mozilla/gfx/Rect.h" namespace mozilla { namespace layers { @@ -79,7 +77,7 @@ public: * Communicate the picture rect of a YUV image in aLayer to the compositor */ virtual void UpdatePictureRect(CompositableClient* aCompositable, - const nsIntRect& aRect) = 0; + const gfx::IntRect& aRect) = 0; #ifdef MOZ_WIDGET_GONK virtual void UseOverlaySource(CompositableClient* aCompositabl, diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 0e038a615e3a..83bb6420831d 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -27,6 +27,7 @@ #include "mozilla/DebugOnly.h" // for DebugOnly #include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/gfx/Point.h" // for IntSize +#include "mozilla/gfx/Rect.h" // for IntSize #include "mozilla/ipc/Transport.h" // for Transport #include "mozilla/layers/APZCTreeManager.h" // for APZCTreeManager #include "mozilla/layers/APZThreadUtils.h" // for APZCTreeManager @@ -48,7 +49,6 @@ #include "nsDebug.h" // for NS_ASSERTION, etc #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc #include "nsIWidget.h" // for nsIWidget -#include "nsRect.h" // for nsIntRect #include "nsTArray.h" // for nsTArray #include "nsThreadUtils.h" // for NS_IsMainThread #include "nsXULAppAPI.h" // for XRE_GetIOMessageLoop @@ -606,7 +606,7 @@ CompositorParent::RecvResume() bool CompositorParent::RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, - const nsIntRect& aRect) + const gfx::IntRect& aRect) { RefPtr target = GetDrawTargetForDescriptor(aInSnapshot, gfx::BackendType::CAIRO); ForceComposeToTarget(target, &aRect); @@ -977,7 +977,7 @@ CompositorParent::SetShadowProperties(Layer* aLayer) } void -CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect) +CompositorParent::CompositeToTarget(DrawTarget* aTarget, const gfx::IntRect* aRect) { profiler_tracing("Paint", "Composite", TRACING_INTERVAL_START); PROFILER_LABEL("CompositorParent", "Composite", @@ -1072,7 +1072,7 @@ CompositorParent::CompositeToTarget(DrawTarget* aTarget, const nsIntRect* aRect) } void -CompositorParent::ForceComposeToTarget(DrawTarget* aTarget, const nsIntRect* aRect) +CompositorParent::ForceComposeToTarget(DrawTarget* aTarget, const gfx::IntRect* aRect) { PROFILER_LABEL("CompositorParent", "ForceComposeToTarget", js::ProfileEntry::Category::GRAPHICS); @@ -1338,7 +1338,7 @@ CompositorParent::AllocPLayerTransactionParent(const nsTArray& aB // mWidget doesn't belong to the compositor thread, so it should be set to // nullptr before returning from this method, to avoid accessing it elsewhere. - nsIntRect rect; + gfx::IntRect rect; mWidget->GetClientBounds(rect); InitializeLayerManager(aBackendHints); mWidget = nullptr; @@ -1600,7 +1600,7 @@ public: virtual bool RecvNotifyChildCreated(const uint64_t& child) override; virtual bool RecvAdoptChild(const uint64_t& child) override { return false; } virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, - const nsIntRect& aRect) override + const gfx::IntRect& aRect) override { return true; } virtual bool RecvFlushRendering() override { return true; } virtual bool RecvNotifyRegionInvalidated(const nsIntRegion& aRegion) override { return true; } diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index e066ec29e7b4..e673d014b43f 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -167,7 +167,7 @@ public: virtual bool RecvNotifyChildCreated(const uint64_t& child) override; virtual bool RecvAdoptChild(const uint64_t& child) override; virtual bool RecvMakeSnapshot(const SurfaceDescriptor& aInSnapshot, - const nsIntRect& aRect) override; + const gfx::IntRect& aRect) override; virtual bool RecvFlushRendering() override; virtual bool RecvGetTileSize(int32_t* aWidth, int32_t* aHeight) override; @@ -364,8 +364,8 @@ protected: virtual bool DeallocPLayerTransactionParent(PLayerTransactionParent* aLayers) override; virtual void ScheduleTask(CancelableTask*, int); void CompositeCallback(TimeStamp aScheduleTime); - void CompositeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr); - void ForceComposeToTarget(gfx::DrawTarget* aTarget, const nsIntRect* aRect = nullptr); + void CompositeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr); + void ForceComposeToTarget(gfx::DrawTarget* aTarget, const gfx::IntRect* aRect = nullptr); void SetEGLSurfaceSize(int width, int height); diff --git a/gfx/layers/ipc/ImageBridgeChild.cpp b/gfx/layers/ipc/ImageBridgeChild.cpp index 33a02465eac5..fa048ea55e05 100644 --- a/gfx/layers/ipc/ImageBridgeChild.cpp +++ b/gfx/layers/ipc/ImageBridgeChild.cpp @@ -38,8 +38,6 @@ #include "mozilla/StaticPtr.h" // for StaticRefPtr #include "mozilla/layers/TextureClient.h" -struct nsIntRect; - namespace mozilla { namespace ipc { class Shmem; @@ -149,7 +147,7 @@ ImageBridgeChild::UseOverlaySource(CompositableClient* aCompositable, void ImageBridgeChild::UpdatePictureRect(CompositableClient* aCompositable, - const nsIntRect& aRect) + const gfx::IntRect& aRect) { MOZ_ASSERT(aCompositable); MOZ_ASSERT(aCompositable->GetIPDLActor()); diff --git a/gfx/layers/ipc/ImageBridgeChild.h b/gfx/layers/ipc/ImageBridgeChild.h index a2339b8f5171..39fec3bd6772 100644 --- a/gfx/layers/ipc/ImageBridgeChild.h +++ b/gfx/layers/ipc/ImageBridgeChild.h @@ -17,10 +17,9 @@ #include "mozilla/layers/PImageBridgeChild.h" #include "nsDebug.h" // for NS_RUNTIMEABORT #include "nsRegion.h" // for nsIntRegion +#include "mozilla/gfx/Rect.h" class MessageLoop; -struct nsIntPoint; -struct nsIntRect; namespace base { class Thread; @@ -241,7 +240,7 @@ public: * Communicate the picture rect of a YUV image in aLayer to the compositor */ virtual void UpdatePictureRect(CompositableClient* aCompositable, - const nsIntRect& aRect) override; + const gfx::IntRect& aRect) override; virtual void UpdateTextureRegion(CompositableClient* aCompositable, diff --git a/gfx/layers/ipc/LayersMessages.ipdlh b/gfx/layers/ipc/LayersMessages.ipdlh index 6fc1bd53b74e..f94a4426b75a 100644 --- a/gfx/layers/ipc/LayersMessages.ipdlh +++ b/gfx/layers/ipc/LayersMessages.ipdlh @@ -19,9 +19,9 @@ include "ImageLayers.h"; using mozilla::GraphicsFilterType from "mozilla/GfxMessageUtils.h"; using struct gfxRGBA from "gfxColor.h"; using struct mozilla::gfx::Point3D from "mozilla/gfx/Point.h"; +using mozilla::gfx::IntPoint from "mozilla/gfx/Point.h"; using class mozilla::gfx::Matrix4x4 from "mozilla/gfx/Matrix.h"; using nscoord from "nsCoord.h"; -using struct nsIntPoint from "nsPoint.h"; using struct nsRect from "nsRect.h"; using struct nsPoint from "nsPoint.h"; using class mozilla::TimeDuration from "mozilla/TimeStamp.h"; @@ -47,7 +47,7 @@ namespace mozilla { namespace layers { struct TargetConfig { - nsIntRect naturalBounds; + IntRect naturalBounds; ScreenRotation rotation; ScreenOrientation orientation; nsIntRegion clearRegion; @@ -72,8 +72,8 @@ struct OpAttachAsyncCompositable { }; struct ThebesBufferData { - nsIntRect rect; - nsIntPoint rotation; + IntRect rect; + IntPoint rotation; }; struct CubicBezierFunction { @@ -195,7 +195,7 @@ struct Animation { // Change a layer's attributes struct CommonLayerAttributes { - nsIntRect layerBounds; + IntRect layerBounds; nsIntRegion visibleRegion; EventRegions eventRegions; TransformMatrix transform; @@ -241,8 +241,8 @@ struct ContainerLayerAttributes { // cross process at some point by passing the HMDConfig uint64_t hmdInfo; }; -struct ColorLayerAttributes { LayerColor color; nsIntRect bounds; }; -struct CanvasLayerAttributes { GraphicsFilterType filter; nsIntRect bounds; }; +struct ColorLayerAttributes { LayerColor color; IntRect bounds; }; +struct CanvasLayerAttributes { GraphicsFilterType filter; IntRect bounds; }; struct RefLayerAttributes { int64_t id; // TODO: Once bug 1132895 is fixed we shouldn't need to propagate the override @@ -269,8 +269,8 @@ struct LayerAttributes { // See nsIWidget Configurations struct PluginWindowData { uintptr_t windowId; - nsIntRect[] clip; - nsIntRect bounds; + IntRect[] clip; + IntRect bounds; bool visible; }; @@ -348,7 +348,7 @@ struct OpPaintTextureRegion { struct OpUpdatePictureRect { PCompositable compositable; - nsIntRect picture; + IntRect picture; }; /** diff --git a/gfx/layers/ipc/LayersSurfaces.ipdlh b/gfx/layers/ipc/LayersSurfaces.ipdlh index 6a3dd2931491..0ef312d736a6 100644 --- a/gfx/layers/ipc/LayersSurfaces.ipdlh +++ b/gfx/layers/ipc/LayersSurfaces.ipdlh @@ -3,7 +3,6 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ using struct gfxPoint from "gfxPoint.h"; -using struct nsIntRect from "nsRect.h"; using nsIntRegion from "nsRegion.h"; using struct mozilla::layers::MagicGrallocBufferHandle from "gfxipc/ShadowLayerUtils.h"; using struct mozilla::layers::GrallocBufferRef from "gfxipc/ShadowLayerUtils.h"; @@ -11,6 +10,7 @@ using struct mozilla::layers::SurfaceDescriptorX11 from "gfxipc/ShadowLayerUtils using struct mozilla::null_t from "ipc/IPCMessageUtils.h"; using mozilla::WindowsHandle from "ipc/IPCMessageUtils.h"; using mozilla::gfx::SurfaceFormat from "mozilla/gfx/Types.h"; +using mozilla::gfx::IntRect from "mozilla/gfx/Rect.h"; using mozilla::gfx::IntSize from "mozilla/gfx/Point.h"; using gfxImageFormat from "gfxTypes.h"; diff --git a/gfx/layers/ipc/PCompositor.ipdl b/gfx/layers/ipc/PCompositor.ipdl index 312e2cbee932..ba3620506bec 100644 --- a/gfx/layers/ipc/PCompositor.ipdl +++ b/gfx/layers/ipc/PCompositor.ipdl @@ -60,7 +60,7 @@ child: * application on the widgets. Used on Windows and Linux in managing * plugin widgets. */ - async UpdatePluginConfigurations(nsIntPoint aContentOffset, + async UpdatePluginConfigurations(IntPoint aContentOffset, nsIntRegion aVisibleRegion, PluginWindowData[] aPlugins); @@ -95,7 +95,7 @@ parent: // // NB: this message will result in animations, transforms, effects, // and so forth being interpolated. That's what we want to happen. - sync MakeSnapshot(SurfaceDescriptor inSnapshot, nsIntRect dirtyRect); + sync MakeSnapshot(SurfaceDescriptor inSnapshot, IntRect dirtyRect); // Make sure any pending composites are started immediately and // block until they are completed. diff --git a/gfx/layers/ipc/ShadowLayers.cpp b/gfx/layers/ipc/ShadowLayers.cpp index f320f533cbb6..43ce9f925378 100644 --- a/gfx/layers/ipc/ShadowLayers.cpp +++ b/gfx/layers/ipc/ShadowLayers.cpp @@ -28,14 +28,11 @@ #include "mozilla/layers/TextureClient.h" // for TextureClient #include "mozilla/mozalloc.h" // for operator new, etc #include "nsAutoPtr.h" // for nsRefPtr, getter_AddRefs, etc -#include "nsRect.h" // for nsIntRect #include "nsSize.h" // for nsIntSize #include "nsTArray.h" // for nsAutoTArray, nsTArray, etc #include "nsXULAppAPI.h" // for XRE_GetProcessType, etc #include "mozilla/ReentrantMonitor.h" -struct nsIntPoint; - namespace mozilla { namespace ipc { class Shmem; @@ -62,7 +59,7 @@ public: , mRotationChanged(false) {} - void Begin(const nsIntRect& aTargetBounds, ScreenRotation aRotation, + void Begin(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation, dom::ScreenOrientation aOrientation) { mOpen = true; @@ -139,7 +136,7 @@ public: EditVector mCset; EditVector mPaints; ShadowableLayerSet mMutants; - nsIntRect mTargetBounds; + gfx::IntRect mTargetBounds; ScreenRotation mTargetRotation; dom::ScreenOrientation mTargetOrientation; bool mSwapRequired; @@ -185,7 +182,7 @@ ShadowLayerForwarder::~ShadowLayerForwarder() } void -ShadowLayerForwarder::BeginTransaction(const nsIntRect& aTargetBounds, +ShadowLayerForwarder::BeginTransaction(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation, dom::ScreenOrientation aOrientation) { @@ -354,7 +351,7 @@ ShadowLayerForwarder::UpdateTextureRegion(CompositableClient* aCompositable, void ShadowLayerForwarder::UpdatePictureRect(CompositableClient* aCompositable, - const nsIntRect& aRect) + const gfx::IntRect& aRect) { MOZ_ASSERT(aCompositable); MOZ_ASSERT(aCompositable->GetIPDLActor()); diff --git a/gfx/layers/ipc/ShadowLayers.h b/gfx/layers/ipc/ShadowLayers.h index 17758dca1c2f..81cf4bd34e78 100644 --- a/gfx/layers/ipc/ShadowLayers.h +++ b/gfx/layers/ipc/ShadowLayers.h @@ -12,6 +12,7 @@ #include // for uint64_t #include "gfxTypes.h" #include "mozilla/Attributes.h" // for override +#include "mozilla/gfx/Rect.h" #include "mozilla/WidgetUtils.h" // for ScreenRotation #include "mozilla/dom/ScreenOrientation.h" // for ScreenOrientation #include "mozilla/ipc/SharedMemory.h" // for SharedMemory, etc @@ -22,9 +23,6 @@ #include "nsTArrayForwardDeclare.h" // for InfallibleTArray #include "nsIWidget.h" -struct nsIntPoint; -struct nsIntRect; - namespace mozilla { namespace layers { @@ -170,7 +168,7 @@ public: * Begin recording a transaction to be forwarded atomically to a * LayerManagerComposite. */ - void BeginTransaction(const nsIntRect& aTargetBounds, + void BeginTransaction(const gfx::IntRect& aTargetBounds, ScreenRotation aRotation, mozilla::dom::ScreenOrientation aOrientation); @@ -258,7 +256,7 @@ public: * Communicate the picture rect of an image to the compositor */ void UpdatePictureRect(CompositableClient* aCompositable, - const nsIntRect& aRect) override; + const gfx::IntRect& aRect) override; /** * See CompositableForwarder::UseTexture diff --git a/gfx/layers/opengl/GLBlitTextureImageHelper.cpp b/gfx/layers/opengl/GLBlitTextureImageHelper.cpp index d1ea27e64cc6..8ffd699bf6ed 100644 --- a/gfx/layers/opengl/GLBlitTextureImageHelper.cpp +++ b/gfx/layers/opengl/GLBlitTextureImageHelper.cpp @@ -37,8 +37,8 @@ GLBlitTextureImageHelper::~GLBlitTextureImageHelper() } void -GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect& aSrcRect, - TextureImage *aDst, const nsIntRect& aDstRect) +GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const gfx::IntRect& aSrcRect, + TextureImage *aDst, const gfx::IntRect& aDstRect) { GLContext *gl = mCompositor->gl(); NS_ASSERTION(!aSrc->InUpdate(), "Source texture is in update!"); @@ -61,8 +61,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect& aDst->BeginBigImageIteration(); do { // calculate portion of the tile that is going to be painted to - nsIntRect dstSubRect; - nsIntRect dstTextureRect = ThebesIntRect(aDst->GetTileRect()); + gfx::IntRect dstSubRect; + gfx::IntRect dstTextureRect = ThebesIntRect(aDst->GetTileRect()); dstSubRect.IntersectRect(aDstRect, dstTextureRect); // this tile is not part of the destination rectangle aDstRect @@ -70,7 +70,7 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect& continue; // (*) transform the rect of this tile into the rectangle defined by aSrcRect... - nsIntRect dstInSrcRect(dstSubRect); + gfx::IntRect dstInSrcRect(dstSubRect); dstInSrcRect.MoveBy(-aDstRect.TopLeft()); // ...which might be of different size, hence scale accordingly dstInSrcRect.ScaleRoundOut(1.0f / blitScaleX, 1.0f / blitScaleY); @@ -83,8 +83,8 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect& // now iterate over all tiles in the source Image... do { // calculate portion of the source tile that is in the source rect - nsIntRect srcSubRect; - nsIntRect srcTextureRect = ThebesIntRect(aSrc->GetTileRect()); + gfx::IntRect srcSubRect; + gfx::IntRect srcTextureRect = ThebesIntRect(aSrc->GetTileRect()); srcSubRect.IntersectRect(aSrcRect, srcTextureRect); // this tile is not part of the source rect @@ -104,7 +104,7 @@ GLBlitTextureImageHelper::BlitTextureImage(TextureImage *aSrc, const nsIntRect& // and the desired destination rectange // in destination space. // We need to transform this back into destination space, inverting the transform from (*) - nsIntRect srcSubInDstRect(srcSubRect); + gfx::IntRect srcSubInDstRect(srcSubRect); srcSubInDstRect.MoveBy(-aSrcRect.TopLeft()); srcSubInDstRect.ScaleRoundOut(blitScaleX, blitScaleY); srcSubInDstRect.MoveBy(aDstRect.TopLeft()); diff --git a/gfx/layers/opengl/GLBlitTextureImageHelper.h b/gfx/layers/opengl/GLBlitTextureImageHelper.h index 9075a6f85f2f..1a0703145356 100644 --- a/gfx/layers/opengl/GLBlitTextureImageHelper.h +++ b/gfx/layers/opengl/GLBlitTextureImageHelper.h @@ -10,8 +10,7 @@ #include "mozilla/Attributes.h" #include "GLContextTypes.h" #include "GLConsts.h" - -struct nsIntRect; +#include "mozilla/gfx/Rect.h" namespace mozilla { namespace gl { @@ -62,8 +61,8 @@ public: * - active texture (will be 0) * - texture 0 binding */ - void BlitTextureImage(gl::TextureImage *aSrc, const nsIntRect& aSrcRect, - gl::TextureImage *aDst, const nsIntRect& aDstRect); + void BlitTextureImage(gl::TextureImage *aSrc, const gfx::IntRect& aSrcRect, + gl::TextureImage *aDst, const gfx::IntRect& aDstRect); }; } diff --git a/gfx/layers/opengl/OGLShaderProgram.h b/gfx/layers/opengl/OGLShaderProgram.h index 63c5002e6330..a284a9a9399c 100644 --- a/gfx/layers/opengl/OGLShaderProgram.h +++ b/gfx/layers/opengl/OGLShaderProgram.h @@ -21,7 +21,6 @@ #include struct gfxRGBA; -struct nsIntRect; namespace mozilla { namespace layers { diff --git a/gfx/layers/opengl/TextureHostOGL.cpp b/gfx/layers/opengl/TextureHostOGL.cpp index 1ca62a491f4a..684d7301cb5f 100644 --- a/gfx/layers/opengl/TextureHostOGL.cpp +++ b/gfx/layers/opengl/TextureHostOGL.cpp @@ -22,7 +22,6 @@ #include "mozilla/layers/ISurfaceAllocator.h" #include "mozilla/layers/YCbCrImageDataSerializer.h" #include "mozilla/layers/GrallocTextureHost.h" -#include "nsPoint.h" // for nsIntPoint #include "nsRegion.h" // for nsIntRegion #include "AndroidSurfaceTexture.h" #include "GfxTexturesReporter.h" // for GfxTexturesReporter @@ -258,7 +257,7 @@ TextureImageTextureSourceOGL::Update(gfx::DataSourceSurface* aSurface, if (aDestRegion && !aSrcOffset && - !aDestRegion->IsEqual(nsIntRect(0, 0, size.width, size.height))) { + !aDestRegion->IsEqual(gfx::IntRect(0, 0, size.width, size.height))) { // UpdateFromDataSource will ignore our specified aDestRegion since the texture // hasn't been allocated with glTexImage2D yet. Call Resize() to force the // allocation (full size, but no upload), and then we'll only upload the pixels @@ -292,9 +291,9 @@ TextureImageTextureSourceOGL::EnsureBuffer(const nsIntSize& aSize, } void -TextureImageTextureSourceOGL::CopyTo(const nsIntRect& aSourceRect, +TextureImageTextureSourceOGL::CopyTo(const gfx::IntRect& aSourceRect, DataTextureSource *aDest, - const nsIntRect& aDestRect) + const gfx::IntRect& aDestRect) { MOZ_ASSERT(aDest->AsSourceOGL(), "Incompatible destination type!"); TextureImageTextureSourceOGL *dest = @@ -341,7 +340,7 @@ TextureImageTextureSourceOGL::GetFormat() const return gfx::SurfaceFormat::UNKNOWN; } -nsIntRect TextureImageTextureSourceOGL::GetTileRect() +gfx::IntRect TextureImageTextureSourceOGL::GetTileRect() { return ThebesIntRect(mTexImage->GetTileRect()); } diff --git a/gfx/layers/opengl/TextureHostOGL.h b/gfx/layers/opengl/TextureHostOGL.h index c4b5bfe3c9d1..1859178ca4c3 100644 --- a/gfx/layers/opengl/TextureHostOGL.h +++ b/gfx/layers/opengl/TextureHostOGL.h @@ -39,8 +39,6 @@ class gfxReusableSurfaceWrapper; class nsIntRegion; -struct nsIntPoint; -struct nsIntRect; namespace mozilla { namespace gfx { @@ -204,9 +202,9 @@ public: void EnsureBuffer(const gfx::IntSize& aSize, gfxContentType aContentType); - void CopyTo(const nsIntRect& aSourceRect, - DataTextureSource* aDest, - const nsIntRect& aDestRect); + void CopyTo(const gfx::IntRect& aSourceRect, + DataTextureSource* aDest, + const gfx::IntRect& aDestRect); virtual TextureImageTextureSourceOGL* AsTextureImageTextureSource() override { return this; } @@ -250,7 +248,7 @@ public: mIterating = false; } - virtual nsIntRect GetTileRect() override; + virtual gfx::IntRect GetTileRect() override; virtual size_t GetTileCount() override { diff --git a/gfx/src/nsPoint.h b/gfx/src/nsPoint.h index 4a621d4ceda7..88dacf6c448e 100644 --- a/gfx/src/nsPoint.h +++ b/gfx/src/nsPoint.h @@ -10,8 +10,12 @@ #include "mozilla/gfx/BaseSize.h" #include "mozilla/gfx/BasePoint.h" #include "nsSize.h" +#include "mozilla/gfx/Point.h" -struct nsIntPoint; +// nsIntPoint represents a point in one of the types of pixels. +// Uses of nsIntPoint should eventually be converted to CSSIntPoint, +// LayoutDeviceIntPoint, etc. (see layout/base/Units.h). +typedef mozilla::gfx::IntPoint nsIntPoint; // nsPoint represents a point in app units. @@ -35,19 +39,7 @@ struct nsPoint : public mozilla::gfx::BasePoint { ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const; }; -// nsIntPoint represents a point in one of the types of pixels. -// Uses of nsIntPoint should eventually be converted to CSSIntPoint, -// LayoutDeviceIntPoint, etc. (see layout/base/Units.h). - -struct nsIntPoint : public mozilla::gfx::BasePoint { - typedef mozilla::gfx::BasePoint Super; - - nsIntPoint() : Super() {} - nsIntPoint(const nsIntPoint& aPoint) : Super(aPoint) {} - nsIntPoint(int32_t aX, int32_t aY) : Super(aX, aY) {} - - inline nsPoint ToAppUnits(nscoord aAppUnitsPerPixel) const; -}; +inline nsPoint ToAppUnits(const nsIntPoint& aPoint, nscoord aAppUnitsPerPixel); inline nsIntPoint nsPoint::ScaleToNearestPixels(float aXScale, float aYScale, @@ -78,10 +70,10 @@ nsPoint::ScaleToOtherAppUnits(int32_t aFromAPP, int32_t aToAPP) const // app units are integer multiples of pixels, so no rounding needed inline nsPoint -nsIntPoint::ToAppUnits(nscoord aAppUnitsPerPixel) const +ToAppUnits(const nsIntPoint& aPoint, nscoord aAppUnitsPerPixel) { - return nsPoint(NSIntPixelsToAppUnits(x, aAppUnitsPerPixel), - NSIntPixelsToAppUnits(y, aAppUnitsPerPixel)); + return nsPoint(NSIntPixelsToAppUnits(aPoint.x, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(aPoint.y, aAppUnitsPerPixel)); } #endif /* NSPOINT_H */ diff --git a/gfx/src/nsRect.cpp b/gfx/src/nsRect.cpp index 41a031503942..d1a3dd63914b 100644 --- a/gfx/src/nsRect.cpp +++ b/gfx/src/nsRect.cpp @@ -15,6 +15,20 @@ static_assert((int(NS_SIDE_TOP) == 0) && (int(NS_SIDE_LEFT) == 3), "The mozilla::css::Side sequence must match the nsMargin nscoord sequence"); +nsRect +ToAppUnits(const nsIntRect& aRect, nscoord aAppUnitsPerPixel) +{ + return nsRect(NSIntPixelsToAppUnits(aRect.x, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(aRect.y, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(aRect.width, aAppUnitsPerPixel), + NSIntPixelsToAppUnits(aRect.height, aAppUnitsPerPixel)); +} + +const nsIntRect& GetMaxSizedIntRect() { + static const nsIntRect r(0, 0, INT32_MAX, INT32_MAX); + return r; +} + #ifdef DEBUG // Diagnostics diff --git a/gfx/src/nsRect.h b/gfx/src/nsRect.h index e424cefd1daa..c840386dc247 100644 --- a/gfx/src/nsRect.h +++ b/gfx/src/nsRect.h @@ -13,18 +13,18 @@ #include "nsDebug.h" // for NS_WARNING #include "gfxCore.h" // for NS_GFX #include "mozilla/Likely.h" // for MOZ_UNLIKELY -#include "mozilla/gfx/BaseRect.h" // for BaseRect -#include "mozilla/gfx/NumericTools.h" // for RoundUpToMultiple, RoundDownToMultiple +#include "mozilla/gfx/Rect.h" #include "nsCoord.h" // for nscoord, etc #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc #include "nsPoint.h" // for nsIntPoint, nsPoint #include "nsSize.h" // for nsIntSize, nsSize #include "nscore.h" // for NS_BUILD_REFCNT_LOGGING -struct nsIntRect; struct nsMargin; struct nsIntMargin; +typedef mozilla::gfx::IntRect nsIntRect; + struct NS_GFX nsRect : public mozilla::gfx::BaseRect { typedef mozilla::gfx::BaseRect Super; @@ -179,56 +179,6 @@ struct NS_GFX nsRect : } }; -struct NS_GFX nsIntRect : - public mozilla::gfx::BaseRect { - typedef mozilla::gfx::BaseRect Super; - - // Constructors - nsIntRect() : Super() - { - } - nsIntRect(const nsIntRect& aRect) : Super(aRect) - { - } - nsIntRect(const nsIntPoint& aOrigin, const nsIntSize &aSize) : Super(aOrigin, aSize) - { - } - nsIntRect(int32_t aX, int32_t aY, int32_t aWidth, int32_t aHeight) : - Super(aX, aY, aWidth, aHeight) - { - } - - MOZ_WARN_UNUSED_RESULT inline nsRect - ToAppUnits(nscoord aAppUnitsPerPixel) const; - - // Returns a special nsIntRect that's used in some places to signify - // "all available space". - static const nsIntRect& GetMaxSizedIntRect() { - static const nsIntRect r(0, 0, INT32_MAX, INT32_MAX); - return r; - } - - void InflateToMultiple(const nsIntSize& aTileSize) - { - int32_t xMost = XMost(); - int32_t yMost = YMost(); - - x = RoundDownToMultiple(x, aTileSize.width); - y = RoundDownToMultiple(y, aTileSize.height); - xMost = RoundUpToMultiple(xMost, aTileSize.width); - yMost = RoundUpToMultiple(yMost, aTileSize.height); - - width = xMost - x; - height = yMost - y; - } - - // This is here only to keep IPDL-generated code happy. DO NOT USE. - bool operator==(const nsIntRect& aRect) const - { - return IsEqualEdges(aRect); - } -}; - /* * App Unit/Pixel conversions */ @@ -335,15 +285,11 @@ nsRect::ToInsidePixels(nscoord aAppUnitsPerPixel) const return ScaleToInsidePixels(1.0f, 1.0f, aAppUnitsPerPixel); } +const nsIntRect& GetMaxSizedIntRect(); + // app units are integer multiples of pixels, so no rounding needed -inline nsRect -nsIntRect::ToAppUnits(nscoord aAppUnitsPerPixel) const -{ - return nsRect(NSIntPixelsToAppUnits(x, aAppUnitsPerPixel), - NSIntPixelsToAppUnits(y, aAppUnitsPerPixel), - NSIntPixelsToAppUnits(width, aAppUnitsPerPixel), - NSIntPixelsToAppUnits(height, aAppUnitsPerPixel)); -} +nsRect +ToAppUnits(const nsIntRect& aRect, nscoord aAppUnitsPerPixel); #ifdef DEBUG // Diagnostics diff --git a/gfx/src/nsRegion.h b/gfx/src/nsRegion.h index 632398d62eba..05dca175cac2 100644 --- a/gfx/src/nsRegion.h +++ b/gfx/src/nsRegion.h @@ -699,7 +699,7 @@ public: RectIterator rgnIter(*this); const Rect* currentRect; while ((currentRect = rgnIter.Next())) { - nsRect appRect = currentRect->ToAppUnits(aAppUnitsPerPixel); + nsRect appRect = ::ToAppUnits(*currentRect, aAppUnitsPerPixel); result.Or(result, appRect); } return result; diff --git a/gfx/thebes/gfx2DGlue.h b/gfx/thebes/gfx2DGlue.h index 8ed44c25d5e7..6215e1ea7b43 100644 --- a/gfx/thebes/gfx2DGlue.h +++ b/gfx/thebes/gfx2DGlue.h @@ -76,6 +76,16 @@ inline IntPoint ToIntPoint(const nsIntPoint &aPoint) return IntPoint(aPoint.x, aPoint.y); } +inline IntMargin ToIntMargin(const nsIntMargin& aMargin) +{ + return IntMargin(aMargin.top, aMargin.right, aMargin.bottom, aMargin.left); +} + +inline nsIntPoint ThebesIntPoint(const IntPoint &aPoint) +{ + return nsIntPoint(aPoint.x, aPoint.y); +} + inline Size ToSize(const gfxSize &aSize) { return Size(Float(aSize.width), Float(aSize.height)); diff --git a/gfx/thebes/gfxASurface.h b/gfx/thebes/gfxASurface.h index 42ffd44385f9..d61ee65adbd6 100644 --- a/gfx/thebes/gfxASurface.h +++ b/gfx/thebes/gfxASurface.h @@ -12,6 +12,7 @@ #include "gfxTypes.h" #include "nscore.h" #include "nsSize.h" +#include "mozilla/gfx/Rect.h" #ifdef MOZILLA_INTERNAL_API #include "nsStringFwd.h" @@ -20,8 +21,6 @@ #endif class gfxImageSurface; -struct nsIntPoint; -struct nsIntRect; struct gfxRect; struct gfxPoint; diff --git a/gfx/thebes/gfxAlphaRecovery.h b/gfx/thebes/gfxAlphaRecovery.h index 0122d9c83e22..9fed1681e954 100644 --- a/gfx/thebes/gfxAlphaRecovery.h +++ b/gfx/thebes/gfxAlphaRecovery.h @@ -8,9 +8,8 @@ #include "mozilla/SSE.h" #include "gfxTypes.h" -#include "nsRect.h" +#include "mozilla/gfx/Rect.h" -struct nsIntRect; class gfxImageSurface; class gfxAlphaRecovery { @@ -53,11 +52,11 @@ public: * * The returned rect is always a superset of |aRect|. */ - static nsIntRect AlignRectForSubimageRecovery(const nsIntRect& aRect, - gfxImageSurface* aSurface); + static mozilla::gfx::IntRect AlignRectForSubimageRecovery(const mozilla::gfx::IntRect& aRect, + gfxImageSurface* aSurface); #else - static nsIntRect AlignRectForSubimageRecovery(const nsIntRect& aRect, - gfxImageSurface*) + static mozilla::gfx::IntRect AlignRectForSubimageRecovery(const mozilla::gfx::IntRect& aRect, + gfxImageSurface*) { return aRect; } #endif diff --git a/gfx/thebes/gfxAlphaRecoverySSE2.cpp b/gfx/thebes/gfxAlphaRecoverySSE2.cpp index a395cee6b776..a65dc9a4458f 100644 --- a/gfx/thebes/gfxAlphaRecoverySSE2.cpp +++ b/gfx/thebes/gfxAlphaRecoverySSE2.cpp @@ -5,7 +5,6 @@ #include "gfxAlphaRecovery.h" #include "gfxImageSurface.h" -#include "nsRect.h" #include // This file should only be compiled on x86 and x64 systems. Additionally, @@ -137,8 +136,8 @@ ByteAlignment(int32_t aAlignToLog2, int32_t aX, int32_t aY=0, int32_t aStride=1) return (aX + aStride * aY) & ((1 << aAlignToLog2) - 1); } -/*static*/ nsIntRect -gfxAlphaRecovery::AlignRectForSubimageRecovery(const nsIntRect& aRect, +/*static*/ mozilla::gfx::IntRect +gfxAlphaRecovery::AlignRectForSubimageRecovery(const mozilla::gfx::IntRect& aRect, gfxImageSurface* aSurface) { NS_ASSERTION(gfxImageFormat::ARGB32 == aSurface->Format(), @@ -229,8 +228,8 @@ gfxAlphaRecovery::AlignRectForSubimageRecovery(const nsIntRect& aRect, return aRect; FOUND_SOLUTION: - nsIntRect solution = nsIntRect(x - dx, y - dy, w + dr + dx, h + dy); - MOZ_ASSERT(nsIntRect(0, 0, sw, surfaceSize.height).Contains(solution), + mozilla::gfx::IntRect solution = mozilla::gfx::IntRect(x - dx, y - dy, w + dr + dx, h + dy); + MOZ_ASSERT(mozilla::gfx::IntRect(0, 0, sw, surfaceSize.height).Contains(solution), "'Solution' extends outside surface bounds!"); return solution; } diff --git a/gfx/thebes/gfxD2DSurface.cpp b/gfx/thebes/gfxD2DSurface.cpp index 96f2a425f34a..6d37a7997ef2 100644 --- a/gfx/thebes/gfxD2DSurface.cpp +++ b/gfx/thebes/gfxD2DSurface.cpp @@ -57,7 +57,7 @@ gfxD2DSurface::Present() } void -gfxD2DSurface::Scroll(const nsIntPoint &aDelta, const nsIntRect &aClip) +gfxD2DSurface::Scroll(const nsIntPoint &aDelta, const mozilla::gfx::IntRect &aClip) { cairo_rectangle_t rect; rect.x = aClip.x; @@ -80,7 +80,7 @@ gfxD2DSurface::GetDC(bool aRetainContents) } void -gfxD2DSurface::ReleaseDC(const nsIntRect *aUpdatedRect) +gfxD2DSurface::ReleaseDC(const mozilla::gfx::IntRect *aUpdatedRect) { if (!aUpdatedRect) { return cairo_d2d_release_dc(CairoSurface(), nullptr); diff --git a/gfx/thebes/gfxD2DSurface.h b/gfx/thebes/gfxD2DSurface.h index 10687e640328..fccb25cbb168 100644 --- a/gfx/thebes/gfxD2DSurface.h +++ b/gfx/thebes/gfxD2DSurface.h @@ -12,7 +12,6 @@ #include struct ID3D10Texture2D; -struct nsIntRect; class gfxD2DSurface : public gfxASurface { public: @@ -32,14 +31,14 @@ public: virtual ~gfxD2DSurface(); void Present(); - void Scroll(const nsIntPoint &aDelta, const nsIntRect &aClip); + void Scroll(const nsIntPoint &aDelta, const mozilla::gfx::IntRect &aClip); - virtual const gfxIntSize GetSize() const; + virtual const mozilla::gfx::IntSize GetSize() const; ID3D10Texture2D *GetTexture(); HDC GetDC(bool aRetainContents); - void ReleaseDC(const nsIntRect *aUpdatedRect); + void ReleaseDC(const mozilla::gfx::IntRect *aUpdatedRect); }; #endif /* GFX_D2DSURFACE_H */ diff --git a/gfx/thebes/gfxQtNativeRenderer.h b/gfx/thebes/gfxQtNativeRenderer.h index da11d9f1c153..393ce4a710c6 100644 --- a/gfx/thebes/gfxQtNativeRenderer.h +++ b/gfx/thebes/gfxQtNativeRenderer.h @@ -9,9 +9,9 @@ #include "gfxColor.h" #include "gfxContext.h" #include "gfxXlibSurface.h" +#include "mozilla/gfx/Rect.h" class QRect; -struct nsIntRect; /** * This class lets us take code that draws into an Xlib surface drawable and lets us @@ -31,8 +31,9 @@ public: */ virtual nsresult DrawWithXlib(cairo_surface_t* surface, nsIntPoint offset, - nsIntRect* clipRects, uint32_t numClipRects) = 0; - + mozilla::gfx::IntRect* clipRects, + uint32_t numClipRects) = 0; + enum { // If set, then Draw() is opaque, i.e., every pixel in the intersection // of the clipRect and (offset.x,offset.y,bounds.width,bounds.height) diff --git a/gfx/thebes/gfxUtils.cpp b/gfx/thebes/gfxUtils.cpp index a38d8437490d..a45df24fdfd6 100644 --- a/gfx/thebes/gfxUtils.cpp +++ b/gfx/thebes/gfxUtils.cpp @@ -690,7 +690,7 @@ PathFromRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion) { aContext->NewPath(); nsIntRegionRectIterator iter(aRegion); - const nsIntRect* r; + const IntRect* r; while ((r = iter.Next()) != nullptr) { aContext->Rectangle(gfxRect(r->x, r->y, r->width, r->height)); } @@ -709,7 +709,7 @@ PathFromRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion) RefPtr pb = aTarget->CreatePathBuilder(); nsIntRegionRectIterator iter(aRegion); - const nsIntRect* r; + const IntRect* r; while ((r = iter.Next()) != nullptr) { pb->MoveTo(Point(r->x, r->y)); pb->LineTo(Point(r->XMost(), r->y)); @@ -725,7 +725,7 @@ static void ClipToRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion) { if (!aRegion.IsComplex()) { - nsIntRect rect = aRegion.GetBounds(); + IntRect rect = aRegion.GetBounds(); aTarget->PushClipRect(Rect(rect.x, rect.y, rect.width, rect.height)); return; } @@ -847,9 +847,9 @@ gfxUtils::TransformRectToRect(const gfxRect& aFrom, const IntPoint& aToTopLeft, * to ints then convert those ints back to doubles to make sure that * they equal the doubles that we got in. */ bool -gfxUtils::GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut) +gfxUtils::GfxRectToIntRect(const gfxRect& aIn, IntRect* aOut) { - *aOut = nsIntRect(int32_t(aIn.X()), int32_t(aIn.Y()), + *aOut = IntRect(int32_t(aIn.X()), int32_t(aIn.Y()), int32_t(aIn.Width()), int32_t(aIn.Height())); return gfxRect(aOut->x, aOut->y, aOut->width, aOut->height).IsEqualEdges(aIn); } @@ -995,7 +995,7 @@ gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData, } /* static */ void gfxUtils::ClearThebesSurface(gfxASurface* aSurface, - nsIntRect* aRect, + IntRect* aRect, const gfxRGBA& aColor) { if (aSurface->CairoStatus()) { @@ -1008,11 +1008,11 @@ gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData, cairo_t* ctx = cairo_create(surf); cairo_set_source_rgba(ctx, aColor.r, aColor.g, aColor.b, aColor.a); cairo_set_operator(ctx, CAIRO_OPERATOR_SOURCE); - nsIntRect bounds; + IntRect bounds; if (aRect) { bounds = *aRect; } else { - bounds = nsIntRect(nsIntPoint(0, 0), aSurface->GetSize()); + bounds = IntRect(nsIntPoint(0, 0), aSurface->GetSize()); } cairo_rectangle(ctx, bounds.x, bounds.y, bounds.width, bounds.height); cairo_fill(ctx); diff --git a/gfx/thebes/gfxUtils.h b/gfx/thebes/gfxUtils.h index d3d06c6856f6..908b7908bc28 100644 --- a/gfx/thebes/gfxUtils.h +++ b/gfx/thebes/gfxUtils.h @@ -14,14 +14,13 @@ #include "mozilla/RefPtr.h" #include "nsColor.h" #include "nsPrintfCString.h" +#include "mozilla/gfx/Rect.h" class gfxASurface; class gfxDrawable; class nsIntRegion; class nsIPresShell; -struct nsIntRect; - namespace mozilla { namespace layers { struct PlanarYCbCrData; @@ -121,11 +120,11 @@ public: const IntPoint& aToBottomRight); /** - * If aIn can be represented exactly using an nsIntRect (i.e. + * If aIn can be represented exactly using an gfx::IntRect (i.e. * integer-aligned edges and coordinates in the int32_t range) then we * set aOut to that rectangle, otherwise return failure. */ - static bool GfxRectToIntRect(const gfxRect& aIn, nsIntRect* aOut); + static bool GfxRectToIntRect(const gfxRect& aIn, mozilla::gfx::IntRect* aOut); /** * Return the smallest power of kScaleResolution (2) greater than or equal to @@ -163,7 +162,7 @@ public: * Clears surface to aColor (which defaults to transparent black). */ static void ClearThebesSurface(gfxASurface* aSurface, - nsIntRect* aRect = nullptr, + mozilla::gfx::IntRect* aRect = nullptr, const gfxRGBA& aColor = gfxRGBA(0.0, 0.0, 0.0, 0.0)); /** diff --git a/gfx/thebes/gfxXlibNativeRenderer.cpp b/gfx/thebes/gfxXlibNativeRenderer.cpp index 5dc8a723ae0c..c7f6cec50aeb 100644 --- a/gfx/thebes/gfxXlibNativeRenderer.cpp +++ b/gfx/thebes/gfxXlibNativeRenderer.cpp @@ -69,9 +69,9 @@ _convert_coord_to_int (double coord, int32_t *v) static bool _get_rectangular_clip (cairo_t *cr, - const nsIntRect& bounds, + const IntRect& bounds, bool *need_clip, - nsIntRect *rectangles, int max_rectangles, + IntRect *rectangles, int max_rectangles, int *num_rectangles) { cairo_rectangle_list_t *cliplist; @@ -90,8 +90,8 @@ _get_rectangular_clip (cairo_t *cr, clips = cliplist->rectangles; for (i = 0; i < cliplist->num_rectangles; ++i) { - - nsIntRect rect; + + IntRect rect; if (!_convert_coord_to_int (clips[i].x, &rect.x) || !_convert_coord_to_int (clips[i].y, &rect.y) || !_convert_coord_to_int (clips[i].width, &rect.width) || @@ -106,7 +106,7 @@ _get_rectangular_clip (cairo_t *cr, /* the bounds are entirely inside the clip region so we don't need to clip. */ *need_clip = false; goto FINISH; - } + } NS_ASSERTION(bounds.Contains(rect), "Was expecting to be clipped to bounds"); @@ -176,7 +176,7 @@ gfxXlibNativeRenderer::DrawCairo(cairo_t* cr, nsIntSize size, NS_ASSERTION(int32_t(device_offset_x) == device_offset_x && int32_t(device_offset_y) == device_offset_y, "Expected integer device offsets"); - nsIntPoint offset(NS_lroundf(matrix.x0 + device_offset_x), + IntPoint offset(NS_lroundf(matrix.x0 + device_offset_x), NS_lroundf(matrix.y0 + device_offset_y)); int max_rectangles = 0; @@ -189,14 +189,14 @@ gfxXlibNativeRenderer::DrawCairo(cairo_t* cr, nsIntSize size, /* The client won't draw outside the surface so consider this when analysing clip rectangles. */ - nsIntRect bounds(offset, size); + IntRect bounds(offset, size); bounds.IntersectRect(bounds, - nsIntRect(0, 0, + IntRect(0, 0, cairo_xlib_surface_get_width(target), cairo_xlib_surface_get_height(target))); bool needs_clip = true; - nsIntRect rectangles[MAX_STATIC_CLIP_RECTANGLES]; + IntRect rectangles[MAX_STATIC_CLIP_RECTANGLES]; int rect_count = 0; /* Check that the clip is rectangular and aligned on unit boundaries. */ @@ -360,7 +360,7 @@ CreateTempXlibSurface (cairo_surface_t* cairoTarget, } else { target_format = gfxXlibSurface::FindRenderFormat(dpy, imageFormat); - } + } } if (supportsAlternateVisual && @@ -436,7 +436,7 @@ CreateTempXlibSurface (cairo_surface_t* cairoTarget, bool gfxXlibNativeRenderer::DrawOntoTempSurface(cairo_surface_t *tempXlibSurface, - nsIntPoint offset) + IntPoint offset) { cairo_surface_flush(tempXlibSurface); /* no clipping is needed because the callback can't draw outside the native @@ -506,7 +506,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size, return; } - nsIntRect drawingRect(nsIntPoint(0, 0), size); + IntRect drawingRect(IntPoint(0, 0), size); // Drawing need only be performed within the clip extents // (and padding for the filter). if (!matrixIsIntegerTranslation) { @@ -516,7 +516,7 @@ gfxXlibNativeRenderer::Draw(gfxContext* ctx, nsIntSize size, } clipExtents.RoundOut(); - nsIntRect intExtents(int32_t(clipExtents.X()), + IntRect intExtents(int32_t(clipExtents.X()), int32_t(clipExtents.Y()), int32_t(clipExtents.Width()), int32_t(clipExtents.Height())); diff --git a/gfx/thebes/gfxXlibNativeRenderer.h b/gfx/thebes/gfxXlibNativeRenderer.h index e355fe62e451..4c3a08ef4e4c 100644 --- a/gfx/thebes/gfxXlibNativeRenderer.h +++ b/gfx/thebes/gfxXlibNativeRenderer.h @@ -8,6 +8,8 @@ #include "nsPoint.h" #include "nsRect.h" +#include "mozilla/gfx/Rect.h" +#include "mozilla/gfx/Point.h" #include namespace mozilla { @@ -18,8 +20,6 @@ namespace gfx { class gfxASurface; class gfxContext; -struct nsIntRect; -struct nsIntPoint; typedef struct _cairo cairo_t; typedef struct _cairo_surface cairo_surface_t; @@ -45,8 +45,9 @@ public: * no clipping is required. */ virtual nsresult DrawWithXlib(cairo_surface_t* surface, - nsIntPoint offset, - nsIntRect* clipRects, uint32_t numClipRects) = 0; + mozilla::gfx::IntPoint offset, + mozilla::gfx::IntRect* clipRects, + uint32_t numClipRects) = 0; enum { // If set, then Draw() is opaque, i.e., every pixel in the intersection @@ -93,11 +94,11 @@ private: void DrawFallback(mozilla::gfx::DrawTarget* dt, gfxContext* ctx, gfxASurface* aSurface, mozilla::gfx::IntSize& size, - nsIntRect& drawingRect, bool canDrawOverBackground, + mozilla::gfx::IntRect& drawingRect, bool canDrawOverBackground, uint32_t flags, Screen* screen, Visual* visual); bool DrawOntoTempSurface(cairo_surface_t *tempXlibSurface, - nsIntPoint offset); + mozilla::gfx::IntPoint offset); }; diff --git a/hal/sandbox/PHal.ipdl b/hal/sandbox/PHal.ipdl index f45d232ed249..829fc6421939 100644 --- a/hal/sandbox/PHal.ipdl +++ b/hal/sandbox/PHal.ipdl @@ -16,7 +16,7 @@ using mozilla::hal::WakeLockControl from "mozilla/HalTypes.h"; using mozilla::hal::SwitchState from "mozilla/HalTypes.h"; using mozilla::hal::SwitchDevice from "mozilla/HalTypes.h"; using mozilla::hal::ProcessPriority from "mozilla/HalTypes.h"; -using struct nsIntRect from "nsRect.h"; +using nsIntRect from "nsRect.h"; using PRTime from "prtime.h"; using mozilla::hal::FMRadioCountry from "mozilla/HalTypes.h"; using mozilla::hal::FMRadioOperation from "mozilla/HalTypes.h"; diff --git a/image/src/Decoder.cpp b/image/src/Decoder.cpp index d1bcdd8befb8..31e3adf5fb1f 100644 --- a/image/src/Decoder.cpp +++ b/image/src/Decoder.cpp @@ -628,7 +628,7 @@ Decoder::PostFrameStop(Opacity aFrameOpacity /* = Opacity::TRANSPARENT */, // here when the first frame is complete. if (!mSendPartialInvalidations && !mIsAnimated) { mInvalidRect.UnionRect(mInvalidRect, - nsIntRect(nsIntPoint(0, 0), GetSize())); + gfx::IntRect(gfx::IntPoint(0, 0), GetSize())); } } diff --git a/image/src/ImageOps.h b/image/src/ImageOps.h index 86e84921f04d..fd3a6536d4e2 100644 --- a/image/src/ImageOps.h +++ b/image/src/ImageOps.h @@ -8,10 +8,10 @@ #define mozilla_image_src_ImageOps_h #include "nsCOMPtr.h" +#include "nsRect.h" class gfxDrawable; class imgIContainer; -struct nsIntRect; namespace mozilla { namespace image { diff --git a/image/src/MultipartImage.cpp b/image/src/MultipartImage.cpp index 766beb096ada..ddfb6b7d5ab7 100644 --- a/image/src/MultipartImage.cpp +++ b/image/src/MultipartImage.cpp @@ -182,7 +182,7 @@ void MultipartImage::FinishTransition() // Finally, send all the notifications for the new current part and send a // FRAME_UPDATE notification so that observers know to redraw. mTracker->SyncNotifyProgress(newCurrentPartTracker->GetProgress(), - nsIntRect::GetMaxSizedIntRect()); + GetMaxSizedIntRect()); } already_AddRefed diff --git a/image/src/ProgressTracker.cpp b/image/src/ProgressTracker.cpp index a9baace18852..bc74730c8dac 100644 --- a/image/src/ProgressTracker.cpp +++ b/image/src/ProgressTracker.cpp @@ -393,7 +393,7 @@ ProgressTracker::SyncNotify(IProgressObserver* aObserver) if (NS_FAILED(mImage->GetWidth(&rect.width)) || NS_FAILED(mImage->GetHeight(&rect.height))) { // Either the image has no intrinsic size, or it has an error. - rect = nsIntRect::GetMaxSizedIntRect(); + rect = GetMaxSizedIntRect(); } } diff --git a/image/src/RasterImage.cpp b/image/src/RasterImage.cpp index 370558a30c23..194283af7284 100644 --- a/image/src/RasterImage.cpp +++ b/image/src/RasterImage.cpp @@ -122,7 +122,7 @@ class ScaleRunner : public nsRunnable public: ScaleRunner(RasterImage* aImage, uint32_t aImageFlags, - const nsIntSize& aSize, + const IntSize& aSize, RawAccessFrameRef&& aSrcRef) : mImage(aImage) , mSrcRef(Move(aSrcRef)) @@ -235,7 +235,7 @@ private: WeakPtr mImage; RawAccessFrameRef mSrcRef; RawAccessFrameRef mDstRef; - const nsIntSize mDstSize; + const IntSize mDstSize; uint32_t mImageFlags; ScaleState mState; }; @@ -504,7 +504,7 @@ RasterImage::LookupFrameInternal(uint32_t aFrameNum, DrawableFrameRef RasterImage::LookupFrame(uint32_t aFrameNum, - const nsIntSize& aSize, + const IntSize& aSize, uint32_t aFlags) { MOZ_ASSERT(NS_IsMainThread()); @@ -568,7 +568,7 @@ RasterImage::GetRequestedFrameIndex(uint32_t aWhichFrame) const return aWhichFrame == FRAME_FIRST ? 0 : GetCurrentFrameIndex(); } -nsIntRect +IntRect RasterImage::GetFirstFrameRect() { if (mAnim) { @@ -576,7 +576,7 @@ RasterImage::GetFirstFrameRect() } // Fall back to our size. This is implicitly zero-size if !mHasSize. - return nsIntRect(nsIntPoint(0,0), mSize); + return IntRect(IntPoint(0,0), mSize); } NS_IMETHODIMP_(bool) @@ -702,7 +702,7 @@ RasterImage::CopyFrame(uint32_t aWhichFrame, uint32_t aFlags) return nullptr; } - nsIntRect intFrameRect = frameRef->GetRect(); + IntRect intFrameRect = frameRef->GetRect(); Rect rect(intFrameRect.x, intFrameRect.y, intFrameRect.width, intFrameRect.height); if (frameRef->IsSinglePixel()) { @@ -761,7 +761,7 @@ RasterImage::GetFrameInternal(uint32_t aWhichFrame, uint32_t aFlags) // If this frame covers the entire image, we can just reuse its existing // surface. RefPtr frameSurf; - nsIntRect frameRect = frameRef->GetRect(); + IntRect frameRect = frameRef->GetRect(); if (frameRect.x == 0 && frameRect.y == 0 && frameRect.width == mSize.width && frameRect.height == mSize.height) { @@ -905,7 +905,7 @@ class OnAddedFrameRunnable : public nsRunnable public: OnAddedFrameRunnable(RasterImage* aImage, uint32_t aNewFrameCount, - const nsIntRect& aNewRefreshArea) + const IntRect& aNewRefreshArea) : mImage(aImage) , mNewFrameCount(aNewFrameCount) , mNewRefreshArea(aNewRefreshArea) @@ -922,12 +922,12 @@ public: private: nsRefPtr mImage; uint32_t mNewFrameCount; - nsIntRect mNewRefreshArea; + IntRect mNewRefreshArea; }; void RasterImage::OnAddedFrame(uint32_t aNewFrameCount, - const nsIntRect& aNewRefreshArea) + const IntRect& aNewRefreshArea) { if (!NS_IsMainThread()) { nsCOMPtr runnable = @@ -1147,8 +1147,8 @@ RasterImage::SetLoopCount(int32_t aLoopCount) } } -NS_IMETHODIMP_(nsIntRect) -RasterImage::GetImageSpaceInvalidationRect(const nsIntRect& aRect) +NS_IMETHODIMP_(IntRect) +RasterImage::GetImageSpaceInvalidationRect(const IntRect& aRect) { return aRect; } @@ -1333,7 +1333,7 @@ RasterImage::CanDiscard() { // Sets up a decoder for this image. already_AddRefed -RasterImage::CreateDecoder(const Maybe& aSize, uint32_t aFlags) +RasterImage::CreateDecoder(const Maybe& aSize, uint32_t aFlags) { // Make sure we actually get size before doing a full decode. if (aSize) { @@ -1472,7 +1472,7 @@ RasterImage::StartDecoding() } NS_IMETHODIMP -RasterImage::RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags) +RasterImage::RequestDecodeForSize(const IntSize& aSize, uint32_t aFlags) { MOZ_ASSERT(NS_IsMainThread()); @@ -1487,7 +1487,7 @@ RasterImage::RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags) // Fall back to our intrinsic size if we don't support // downscale-during-decode. - nsIntSize targetSize = mDownscaleDuringDecode ? aSize : mSize; + IntSize targetSize = mDownscaleDuringDecode ? aSize : mSize; // Decide whether to sync decode images we can decode quickly. Here we are // explicitly trading off flashing for responsiveness in the case that we're @@ -1507,7 +1507,7 @@ RasterImage::RequestDecodeForSize(const nsIntSize& aSize, uint32_t aFlags) } NS_IMETHODIMP -RasterImage::Decode(const Maybe& aSize, uint32_t aFlags) +RasterImage::Decode(const Maybe& aSize, uint32_t aFlags) { MOZ_ASSERT(!aSize || NS_IsMainThread()); @@ -1570,7 +1570,7 @@ RasterImage::Decode(const Maybe& aSize, uint32_t aFlags) } void -RasterImage::RecoverFromLossOfFrames(const nsIntSize& aSize, uint32_t aFlags) +RasterImage::RecoverFromLossOfFrames(const IntSize& aSize, uint32_t aFlags) { if (!mHasSize) { return; @@ -1595,7 +1595,7 @@ RasterImage::RecoverFromLossOfFrames(const nsIntSize& aSize, uint32_t aFlags) bool RasterImage::CanScale(GraphicsFilter aFilter, - const nsIntSize& aSize, + const IntSize& aSize, uint32_t aFlags) { #ifndef MOZ_ENABLE_SKIA @@ -1655,7 +1655,7 @@ RasterImage::CanScale(GraphicsFilter aFilter, } bool -RasterImage::CanDownscaleDuringDecode(const nsIntSize& aSize, uint32_t aFlags) +RasterImage::CanDownscaleDuringDecode(const IntSize& aSize, uint32_t aFlags) { // Check basic requirements: downscale-during-decode is enabled for this // image, we have all the source data and know our size, the flags allow us to @@ -1693,13 +1693,13 @@ RasterImage::NotifyNewScaledFrame() { // Send an invalidation so observers will repaint and can take advantage of // the new scaled frame if possible. - NotifyProgress(NoProgress, nsIntRect(0, 0, mSize.width, mSize.height)); + NotifyProgress(NoProgress, IntRect(0, 0, mSize.width, mSize.height)); } void RasterImage::RequestScale(imgFrame* aFrame, uint32_t aFlags, - const nsIntSize& aSize) + const IntSize& aSize) { // We don't scale frames which aren't fully decoded. if (!aFrame->IsImageComplete()) { @@ -1732,7 +1732,7 @@ RasterImage::RequestScale(imgFrame* aFrame, DrawResult RasterImage::DrawWithPreDownscaleIfNeeded(DrawableFrameRef&& aFrameRef, gfxContext* aContext, - const nsIntSize& aSize, + const IntSize& aSize, const ImageRegion& aRegion, GraphicsFilter aFilter, uint32_t aFlags) @@ -1798,14 +1798,14 @@ RasterImage::DrawWithPreDownscaleIfNeeded(DrawableFrameRef&& aFrameRef, * in gfxGraphicsFilter aFilter, * [const] in gfxMatrix aUserSpaceToImageSpace, * [const] in gfxRect aFill, - * [const] in nsIntRect aSubimage, - * [const] in nsIntSize aViewportSize, + * [const] in IntRect aSubimage, + * [const] in IntSize aViewportSize, * [const] in SVGImageContext aSVGContext, * in uint32_t aWhichFrame, * in uint32_t aFlags); */ NS_IMETHODIMP_(DrawResult) RasterImage::Draw(gfxContext* aContext, - const nsIntSize& aSize, + const IntSize& aSize, const ImageRegion& aRegion, uint32_t aWhichFrame, GraphicsFilter aFilter, @@ -2028,7 +2028,7 @@ RasterImage::GetFramesNotified(uint32_t* aFramesNotified) void RasterImage::NotifyProgress(Progress aProgress, - const nsIntRect& aInvalidRect /* = nsIntRect() */, + const IntRect& aInvalidRect /* = IntRect() */, uint32_t aFlags /* = DECODE_FLAGS_DEFAULT */) { MOZ_ASSERT(NS_IsMainThread()); @@ -2111,7 +2111,7 @@ RasterImage::Unwrap() return self.forget(); } -nsIntSize +IntSize RasterImage::OptimalImageSizeForDest(const gfxSize& aDest, uint32_t aWhichFrame, GraphicsFilter aFilter, uint32_t aFlags) { @@ -2120,10 +2120,10 @@ RasterImage::OptimalImageSizeForDest(const gfxSize& aDest, uint32_t aWhichFrame, "Unexpected destination size"); if (mSize.IsEmpty() || aDest.IsEmpty()) { - return nsIntSize(0, 0); + return IntSize(0, 0); } - nsIntSize destSize(ceil(aDest.width), ceil(aDest.height)); + IntSize destSize(ceil(aDest.width), ceil(aDest.height)); if (aFilter == GraphicsFilter::FILTER_GOOD && CanDownscaleDuringDecode(destSize, aFlags)) { diff --git a/image/src/SVGDocumentWrapper.cpp b/image/src/SVGDocumentWrapper.cpp index fa2ab130f716..f03c548f5385 100644 --- a/image/src/SVGDocumentWrapper.cpp +++ b/image/src/SVGDocumentWrapper.cpp @@ -85,7 +85,7 @@ SVGDocumentWrapper::UpdateViewportBounds(const nsIntSize& aViewportSize) // If the bounds have changed, we need to do a layout flush. if (currentBounds.Size() != aViewportSize) { - mViewer->SetBounds(nsIntRect(nsIntPoint(0, 0), aViewportSize)); + mViewer->SetBounds(IntRect(IntPoint(0, 0), aViewportSize)); FlushLayout(); } diff --git a/image/src/VectorImage.cpp b/image/src/VectorImage.cpp index 4372041db2a7..005fab0d7cd1 100644 --- a/image/src/VectorImage.cpp +++ b/image/src/VectorImage.cpp @@ -246,7 +246,7 @@ NS_IMPL_ISUPPORTS(SVGLoadEventListener, nsIDOMEventListener) class SVGDrawingCallback : public gfxDrawingCallback { public: SVGDrawingCallback(SVGDocumentWrapper* aSVGDocumentWrapper, - const nsIntRect& aViewport, + const IntRect& aViewport, const IntSize& aSize, uint32_t aImageFlags) : mSVGDocumentWrapper(aSVGDocumentWrapper) @@ -260,7 +260,7 @@ public: const gfxMatrix& aTransform); private: nsRefPtr mSVGDocumentWrapper; - const nsIntRect mViewport; + const IntRect mViewport; const IntSize mSize; uint32_t mImageFlags; }; @@ -539,12 +539,12 @@ VectorImage::SendInvalidationNotifications() if (mProgressTracker) { SurfaceCache::RemoveImage(ImageKey(this)); mProgressTracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE, - nsIntRect::GetMaxSizedIntRect()); + GetMaxSizedIntRect()); } } -NS_IMETHODIMP_(nsIntRect) -VectorImage::GetImageSpaceInvalidationRect(const nsIntRect& aRect) +NS_IMETHODIMP_(IntRect) +VectorImage::GetImageSpaceInvalidationRect(const IntRect& aRect) { return aRect; } @@ -854,7 +854,7 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams) nsRefPtr cb = new SVGDrawingCallback(mSVGDocumentWrapper, - nsIntRect(nsIntPoint(0, 0), aParams.viewportSize), + IntRect(IntPoint(0, 0), aParams.viewportSize), aParams.size, aParams.flags); @@ -916,7 +916,7 @@ VectorImage::CreateSurfaceAndShow(const SVGDrawingParameters& aParams) // Send out an invalidation so that surfaces that are still in use get // re-locked. See the discussion of the UnlockSurfaces call above. mProgressTracker->SyncNotifyProgress(FLAG_FRAME_COMPLETE, - nsIntRect::GetMaxSizedIntRect()); + GetMaxSizedIntRect()); } @@ -1177,7 +1177,7 @@ VectorImage::OnSVGDocumentLoaded() FLAG_FRAME_COMPLETE | FLAG_DECODE_COMPLETE | FLAG_ONLOAD_UNBLOCKED, - nsIntRect::GetMaxSizedIntRect()); + GetMaxSizedIntRect()); } EvaluateAnimation(); diff --git a/image/src/imgFrame.cpp b/image/src/imgFrame.cpp index ff9d75a9bc09..6614892d500f 100644 --- a/image/src/imgFrame.cpp +++ b/image/src/imgFrame.cpp @@ -695,7 +695,7 @@ imgFrame::ImageUpdatedInternal(const nsIntRect& aUpdateRect) // clamp to bounds, in case someone sends a bogus updateRect (I'm looking at // you, gif decoder) - nsIntRect boundsRect(mOffset, nsIntSize(mSize.width, mSize.height)); + nsIntRect boundsRect(gfx::ToIntPoint(mOffset), gfx::IntSize(mSize.width, mSize.height)); mDecoded.IntersectRect(mDecoded, boundsRect); // If the image is now complete, wake up anyone who's waiting. @@ -728,7 +728,7 @@ imgFrame::Finish(Opacity aFrameOpacity /* = Opacity::SOME_TRANSPARENCY */, nsIntRect imgFrame::GetRect() const { - return nsIntRect(mOffset, nsIntSize(mSize.width, mSize.height)); + return gfx::IntRect(gfx::ToIntPoint(mOffset), gfx::IntSize(mSize.width, mSize.height)); } int32_t diff --git a/image/src/imgRequestProxy.cpp b/image/src/imgRequestProxy.cpp index cf46bade85ac..a2d80605d612 100644 --- a/image/src/imgRequestProxy.cpp +++ b/image/src/imgRequestProxy.cpp @@ -840,7 +840,7 @@ NotificationTypeToString(int32_t aType) } void -imgRequestProxy::Notify(int32_t aType, const nsIntRect* aRect) +imgRequestProxy::Notify(int32_t aType, const mozilla::gfx::IntRect* aRect) { MOZ_ASSERT(aType != imgINotificationObserver::LOAD_COMPLETE, "Should call OnLoadComplete"); diff --git a/image/src/imgRequestProxy.h b/image/src/imgRequestProxy.h index 67a605f54846..34305154434c 100644 --- a/image/src/imgRequestProxy.h +++ b/image/src/imgRequestProxy.h @@ -17,6 +17,7 @@ #include "nsAutoPtr.h" #include "nsThreadUtils.h" #include "mozilla/TimeStamp.h" +#include "mozilla/gfx/Rect.h" #include "imgRequest.h" #include "IProgressObserver.h" @@ -31,7 +32,6 @@ class imgINotificationObserver; class imgStatusNotifyRunnable; -struct nsIntRect; class ProxyBehaviour; namespace mozilla { @@ -98,7 +98,7 @@ public: // imgINotificationObserver methods: virtual void Notify(int32_t aType, - const nsIntRect* aRect = nullptr) override; + const mozilla::gfx::IntRect* aRect = nullptr) override; virtual void OnLoadComplete(bool aLastPart) override; // imgIOnloadBlocker methods: diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 0eeabbee3197..59f07b0fd991 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -2218,7 +2218,7 @@ ContainerState::FindOpaqueBackgroundColorInLayer(const PaintedLayerData* aData, // Scan the candidate's display items. nsIntRect deviceRect = aRect; - nsRect appUnitRect = deviceRect.ToAppUnits(mAppUnitsPerDevPixel); + nsRect appUnitRect = ToAppUnits(deviceRect, mAppUnitsPerDevPixel); appUnitRect.ScaleInverseRoundOut(mParameters.mXScale, mParameters.mYScale); for (auto& assignedItem : Reversed(aData->mAssignedDisplayItems)) { @@ -4818,7 +4818,7 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, // we won't paint if (aChildren->IsOpaque() && !aChildren->NeedsTransparentSurface()) { bounds.ScaleRoundIn(scaleParameters.mXScale, scaleParameters.mYScale); - if (bounds.Contains(pixBounds.ToAppUnits(appUnitsPerDevPixel))) { + if (bounds.Contains(ToAppUnits(pixBounds, appUnitsPerDevPixel))) { // Clear CONTENT_COMPONENT_ALPHA and add CONTENT_OPAQUE instead. flags &= ~Layer::CONTENT_COMPONENT_ALPHA; flags |= Layer::CONTENT_OPAQUE; @@ -5066,7 +5066,7 @@ FrameLayerBuilder::PaintItems(nsTArray& aItems, DrawTarget& aDrawTarget = *aRC->GetDrawTarget(); int32_t appUnitsPerDevPixel = aPresContext->AppUnitsPerDevPixel(); - nsRect boundRect = aRect.ToAppUnits(appUnitsPerDevPixel); + nsRect boundRect = ToAppUnits(aRect, appUnitsPerDevPixel); boundRect.MoveBy(NSIntPixelsToAppUnits(aOffset.x, appUnitsPerDevPixel), NSIntPixelsToAppUnits(aOffset.y, appUnitsPerDevPixel)); boundRect.ScaleInverseRoundOut(aXScale, aYScale); diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h index ed6a924a7b4f..08001f5e8bf3 100644 --- a/layout/base/nsIPresShell.h +++ b/layout/base/nsIPresShell.h @@ -34,6 +34,7 @@ #include "nsColor.h" #include "nsCompatibility.h" #include "nsFrameManagerBase.h" +#include "nsRect.h" #include "mozFlushType.h" #include "nsWeakReference.h" #include // for FILE definition @@ -80,8 +81,6 @@ class nsDisplayListBuilder; class nsPIDOMWindow; struct nsPoint; class nsINode; -struct nsIntPoint; -struct nsIntRect; struct nsRect; class nsRegion; class nsRefreshDriver; diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 0559775d2229..d5780a4a4f43 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -5292,7 +5292,7 @@ PresShell::RenderNode(nsIDOMNode* aNode, // combine the area with the supplied region nsIntRect rrectPixels = aRegion->GetBounds(); - nsRect rrect = rrectPixels.ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()); + nsRect rrect = ToAppUnits(rrectPixels, nsPresContext::AppUnitsPerCSSPixel()); area.IntersectRect(area, rrect); nsPresContext* pc = GetPresContext(); diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 8fac28601526..114b673a30fb 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -16,6 +16,7 @@ #include "mozilla/DebugOnly.h" #include "mozilla/gfx/2D.h" #include "mozilla/gfx/PathHelpers.h" +#include "gfx2DGlue.h" #include "nsCOMPtr.h" #include "nsFrameList.h" @@ -4924,7 +4925,7 @@ nsIFrame::GetTransformMatrix(const nsIFrame* aStopAtAncestor, widget->GetClientBounds(screenBounds); nsIntRect toplevelScreenBounds; toplevel->GetClientBounds(toplevelScreenBounds); - nsIntPoint translation = screenBounds.TopLeft() - toplevelScreenBounds.TopLeft(); + nsIntPoint translation = gfx::ThebesIntPoint(screenBounds.TopLeft() - toplevelScreenBounds.TopLeft()); Matrix4x4 transformToTop; transformToTop._41 = translation.x; diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 648be173ed5e..8c33031caf16 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -614,7 +614,7 @@ nsImageFrame::OnFrameUpdate(imgIRequest* aRequest, const nsIntRect* aRect) ? mImage->GetImageSpaceInvalidationRect(*aRect) : *aRect; - if (layerInvalidRect.IsEqualInterior(nsIntRect::GetMaxSizedIntRect())) { + if (layerInvalidRect.IsEqualInterior(GetMaxSizedIntRect())) { // Invalidate our entire area. InvalidateSelf(nullptr, nullptr); return NS_OK; diff --git a/layout/svg/nsFilterInstance.cpp b/layout/svg/nsFilterInstance.cpp index 60a9dd2d9a01..858bfd8c1c34 100644 --- a/layout/svg/nsFilterInstance.cpp +++ b/layout/svg/nsFilterInstance.cpp @@ -368,7 +368,7 @@ nsFilterInstance::BuildSourcePaint(SourceInfo *aSource, gfx->Save(); gfx->Multiply(mPaintTransform * deviceToFilterSpace * - gfxMatrix::Translation(-neededRect.TopLeft())); + gfxMatrix::Translation(ThebesIntPoint(-neededRect.TopLeft()))); GeneralPattern pattern; if (aSource == &mFillPaint) { nsSVGUtils::MakeFillPatternFor(mTargetFrame, gfx, &pattern); @@ -445,7 +445,7 @@ nsFilterInstance::BuildSourceImage(DrawTarget* aTargetDT) } nsRefPtr ctx = new gfxContext(offscreenDT); ctx->SetMatrix( - ctx->CurrentMatrix().Translate(-neededRect.TopLeft()). + ctx->CurrentMatrix().Translate(ThebesIntPoint(-neededRect.TopLeft())). PreMultiply(deviceToFilterSpace)); mPaintCallback->Paint(*ctx, mTargetFrame, mPaintTransform, &dirty); diff --git a/layout/svg/nsISVGChildFrame.h b/layout/svg/nsISVGChildFrame.h index 3bc59a1632e4..380a58612f27 100644 --- a/layout/svg/nsISVGChildFrame.h +++ b/layout/svg/nsISVGChildFrame.h @@ -16,7 +16,6 @@ class SVGBBox; struct nsPoint; struct nsRect; -struct nsIntRect; namespace mozilla { class SVGAnimatedLengthList; diff --git a/layout/svg/nsSVGContainerFrame.h b/layout/svg/nsSVGContainerFrame.h index 567a65e688f6..759a61db41b0 100644 --- a/layout/svg/nsSVGContainerFrame.h +++ b/layout/svg/nsSVGContainerFrame.h @@ -23,7 +23,6 @@ class nsStyleContext; struct nsPoint; struct nsRect; -struct nsIntRect; typedef nsContainerFrame nsSVGContainerFrameBase; diff --git a/layout/svg/nsSVGFilterPaintCallback.h b/layout/svg/nsSVGFilterPaintCallback.h index 370e3cf2cc87..3320507c87ab 100644 --- a/layout/svg/nsSVGFilterPaintCallback.h +++ b/layout/svg/nsSVGFilterPaintCallback.h @@ -6,11 +6,11 @@ #ifndef __NS_SVGFILTERPAINTCALLBACK_H__ #define __NS_SVGFILTERPAINTCALLBACK_H__ +#include "nsRect.h" + class nsIFrame; class gfxContext; -struct nsIntRect; - class nsSVGFilterPaintCallback { public: /** diff --git a/layout/svg/nsSVGImageFrame.cpp b/layout/svg/nsSVGImageFrame.cpp index fb48f4388c93..22ab25516fa5 100644 --- a/layout/svg/nsSVGImageFrame.cpp +++ b/layout/svg/nsSVGImageFrame.cpp @@ -349,7 +349,7 @@ nsSVGImageFrame::PaintSVG(gfxContext& aContext, NS_ASSERTION(!NS_SVGDisplayListPaintingEnabled() || (mState & NS_FRAME_IS_NONDISPLAY), "Display lists handle dirty rect intersection test"); - dirtyRect = aDirtyRect->ToAppUnits(appUnitsPerDevPx); + dirtyRect = ToAppUnits(*aDirtyRect, appUnitsPerDevPx); // Adjust dirtyRect to match our local coordinate system. nsRect rootRect = nsSVGUtils::TransformFrameRectToOuterSVG(mRect, aTransform, diff --git a/layout/svg/nsSVGIntegrationUtils.h b/layout/svg/nsSVGIntegrationUtils.h index 5a2a4fe8799c..43a746f499e3 100644 --- a/layout/svg/nsSVGIntegrationUtils.h +++ b/layout/svg/nsSVGIntegrationUtils.h @@ -19,7 +19,6 @@ class nsIFrame; class nsIntRegion; struct nsRect; -struct nsIntRect; namespace mozilla { namespace gfx { diff --git a/layout/svg/nsSVGPathGeometryFrame.h b/layout/svg/nsSVGPathGeometryFrame.h index 9cd1af9e45fa..6f293f23626d 100644 --- a/layout/svg/nsSVGPathGeometryFrame.h +++ b/layout/svg/nsSVGPathGeometryFrame.h @@ -32,7 +32,6 @@ class nsSVGMarkerProperty; struct nsPoint; struct nsRect; -struct nsIntRect; typedef nsFrame nsSVGPathGeometryFrameBase; diff --git a/layout/svg/nsSVGUtils.h b/layout/svg/nsSVGUtils.h index c8d2b270c5a0..6d2d50e13857 100644 --- a/layout/svg/nsSVGUtils.h +++ b/layout/svg/nsSVGUtils.h @@ -49,7 +49,6 @@ class gfxTextContextPaint; struct nsStyleSVG; struct nsStyleSVGPaint; struct nsRect; -struct nsIntRect; struct nsPoint; namespace mozilla { diff --git a/layout/tables/nsCellMap.h b/layout/tables/nsCellMap.h index 5751de5a43d1..333892305061 100644 --- a/layout/tables/nsCellMap.h +++ b/layout/tables/nsCellMap.h @@ -12,6 +12,7 @@ #include "nsCOMPtr.h" #include "nsAlgorithm.h" #include "nsAutoPtr.h" +#include "nsRect.h" #include #undef DEBUG_TABLE_CELLMAP @@ -24,7 +25,6 @@ class nsTableFrame; class nsCellMap; class nsPresContext; class nsCellMapColumnIterator; -struct nsIntRect; struct nsColInfo { diff --git a/layout/xul/BoxObject.h b/layout/xul/BoxObject.h index c22705dd4688..1f7a7113e4e4 100644 --- a/layout/xul/BoxObject.h +++ b/layout/xul/BoxObject.h @@ -17,10 +17,10 @@ #include "nsInterfaceHashtable.h" #include "nsCycleCollectionParticipant.h" #include "nsWrapperCache.h" +#include "nsRect.h" class nsIFrame; class nsIDocShell; -struct nsIntRect; class nsIPresShell; namespace mozilla { diff --git a/layout/xul/PopupBoxObject.cpp b/layout/xul/PopupBoxObject.cpp index 56c657722e00..04a76360ef22 100644 --- a/layout/xul/PopupBoxObject.cpp +++ b/layout/xul/PopupBoxObject.cpp @@ -271,7 +271,7 @@ PopupBoxObject::GetOuterScreenRect() widget->GetScreenBounds(screenRect); int32_t pp = menuPopupFrame->PresContext()->AppUnitsPerDevPixel(); - rect->SetLayoutRect(screenRect.ToAppUnits(pp)); + rect->SetLayoutRect(ToAppUnits(screenRect, pp)); } } return rect.forget(); diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index d1a8db4990d5..9c00ebe6ffe3 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -1499,7 +1499,7 @@ nsMenuPopupFrame::GetConstraintRect(const nsRect& aAnchorRect, } } - nsRect screenRect = screenRectPixels.ToAppUnits(presContext->AppUnitsPerDevPixel()); + nsRect screenRect = ToAppUnits(screenRectPixels, presContext->AppUnitsPerDevPixel()); if (mInContentShell) { // for content shells, clip to the client area rather than the screen area screenRect.IntersectRect(screenRect, aRootScreenRect); diff --git a/layout/xul/nsResizerFrame.cpp b/layout/xul/nsResizerFrame.cpp index 4c72e9d3bfa4..ea353a7be0f0 100644 --- a/layout/xul/nsResizerFrame.cpp +++ b/layout/xul/nsResizerFrame.cpp @@ -238,7 +238,7 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext, // direction, don't allow the new size to be less that the resizer's // size. This ensures that content isn't resized too small as to make // the resizer invisible. - nsRect appUnitsRect = LayoutDevicePixel::ToUntyped(rect).ToAppUnits(aPresContext->AppUnitsPerDevPixel()); + nsRect appUnitsRect = ToAppUnits(LayoutDevicePixel::ToUntyped(rect), aPresContext->AppUnitsPerDevPixel()); if (appUnitsRect.width < mRect.width && mouseMove.x) appUnitsRect.width = mRect.width; if (appUnitsRect.height < mRect.height && mouseMove.y) diff --git a/layout/xul/nsSliderFrame.cpp b/layout/xul/nsSliderFrame.cpp index b437f472e069..ce06efc16bb6 100644 --- a/layout/xul/nsSliderFrame.cpp +++ b/layout/xul/nsSliderFrame.cpp @@ -691,7 +691,7 @@ nsSliderFrame::CurrentPositionChanged() // avoid putting the scroll thumb at subpixel positions which cause needless invalidations nscoord appUnitsPerPixel = PresContext()->AppUnitsPerDevPixel(); - nsRect snappedThumbRect = newThumbRect.ToNearestPixels(appUnitsPerPixel).ToAppUnits(appUnitsPerPixel); + nsRect snappedThumbRect = ToAppUnits(newThumbRect.ToNearestPixels(appUnitsPerPixel), appUnitsPerPixel); if (IsHorizontal()) { newThumbRect.x = snappedThumbRect.x; newThumbRect.width = snappedThumbRect.width; diff --git a/view/nsView.cpp b/view/nsView.cpp index 41703691011d..0777d2ce0bca 100644 --- a/view/nsView.cpp +++ b/view/nsView.cpp @@ -770,9 +770,9 @@ void nsView::List(FILE* out, int32_t aIndent) const nscoord p2a = mViewManager->AppUnitsPerDevPixel(); nsIntRect rect; mWindow->GetClientBounds(rect); - nsRect windowBounds = rect.ToAppUnits(p2a); + nsRect windowBounds = ToAppUnits(rect, p2a); mWindow->GetBounds(rect); - nsRect nonclientBounds = rect.ToAppUnits(p2a); + nsRect nonclientBounds = ToAppUnits(rect, p2a); nsrefcnt widgetRefCnt = mWindow.get()->AddRef() - 1; mWindow.get()->Release(); int32_t Z = mWindow->GetZIndex(); diff --git a/view/nsViewManager.cpp b/view/nsViewManager.cpp index fce226fe627e..c5d5eacabc97 100644 --- a/view/nsViewManager.cpp +++ b/view/nsViewManager.cpp @@ -475,7 +475,7 @@ void nsViewManager::FlushDirtyRegionToWidget(nsView* aView) // If we draw the frame counter we need to make sure we invalidate the area // for it to make it on screen if (gfxPrefs::DrawFrameCounter()) { - nsRect counterBounds = gfxPlatform::FrameCounterBounds().ToAppUnits(AppUnitsPerDevPixel()); + nsRect counterBounds = ToAppUnits(gfxPlatform::FrameCounterBounds(), AppUnitsPerDevPixel()); r = r.Or(r, counterBounds); } @@ -570,9 +570,8 @@ nsViewManager::InvalidateWidgetArea(nsView *aWidgetView, nsTArray clipRects; childWidget->GetWindowClipRegion(&clipRects); for (uint32_t i = 0; i < clipRects.Length(); ++i) { - nsRect rr = (clipRects[i] + bounds.TopLeft()). - ToAppUnits(AppUnitsPerDevPixel()); - children.Or(children, rr - aWidgetView->ViewToWidgetOffset()); + nsRect rr = ToAppUnits(clipRects[i] + bounds.TopLeft(), AppUnitsPerDevPixel()); + children.Or(children, rr - aWidgetView->ViewToWidgetOffset()); children.SimplifyInward(20); } #endif diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp index 716d639b0d78..e19f70e0cf7c 100644 --- a/widget/PuppetWidget.cpp +++ b/widget/PuppetWidget.cpp @@ -1132,7 +1132,7 @@ PuppetWidget::GetWindowPosition() NS_METHOD PuppetWidget::GetScreenBounds(nsIntRect &aRect) { - aRect.MoveTo(LayoutDeviceIntPoint::ToUntyped(WidgetToScreenOffset())); + aRect.MoveTo(gfx::ToIntPoint(LayoutDeviceIntPoint::ToUntyped(WidgetToScreenOffset()))); aRect.SizeTo(mBounds.Size()); return NS_OK; } diff --git a/widget/android/AndroidDirectTexture.h b/widget/android/AndroidDirectTexture.h index bf7a603b98d2..8582b8582f5f 100644 --- a/widget/android/AndroidDirectTexture.h +++ b/widget/android/AndroidDirectTexture.h @@ -9,8 +9,7 @@ #include "gfxTypes.h" #include "mozilla/Mutex.h" #include "AndroidGraphicBuffer.h" - -struct nsIntRect; +#include "nsRect.h" namespace mozilla { diff --git a/widget/android/AndroidGraphicBuffer.h b/widget/android/AndroidGraphicBuffer.h index a7af87bf8464..269f8680a00d 100644 --- a/widget/android/AndroidGraphicBuffer.h +++ b/widget/android/AndroidGraphicBuffer.h @@ -7,12 +7,11 @@ #define AndroidGraphicBuffer_h_ #include "gfxTypes.h" +#include "nsRect.h" typedef void* EGLImageKHR; typedef void* EGLClientBuffer; -struct nsIntRect; - namespace mozilla { /** diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index 169ec8095f19..ca7eb0669849 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -2655,7 +2655,7 @@ RectTextureImage::BeginUpdate(const nsIntSize& aNewSize, mUpdateRegion = aDirtyRegion; if (aNewSize != mUsedSize) { mUsedSize = aNewSize; - mUpdateRegion = nsIntRect(nsIntPoint(0, 0), aNewSize); + mUpdateRegion = gfx::IntRect(gfx::IntPoint(0, 0), aNewSize); } if (mUpdateRegion.IsEmpty()) { @@ -2698,7 +2698,7 @@ RectTextureImage::EndUpdate(bool aKeepSurface) } if (overwriteTexture || !CanUploadSubtextures()) { - updateRegion = nsIntRect(nsIntPoint(0, 0), mTextureSize); + updateRegion = gfx::IntRect(gfx::IntPoint(0, 0), mTextureSize); } RefPtr snapshot = mUpdateDrawTarget->Snapshot(); diff --git a/widget/gonk/HwcComposer2D.cpp b/widget/gonk/HwcComposer2D.cpp index 491bf4886745..58182d139d47 100644 --- a/widget/gonk/HwcComposer2D.cpp +++ b/widget/gonk/HwcComposer2D.cpp @@ -140,7 +140,7 @@ HwcComposer2D::HwcComposer2D() ANativeWindow *win = GetGonkDisplay()->GetNativeWindow(); win->query(win, NATIVE_WINDOW_WIDTH, &screenSize.width); win->query(win, NATIVE_WINDOW_HEIGHT, &screenSize.height); - mScreenRect = nsIntRect(nsIntPoint(0, 0), screenSize); + mScreenRect = gfx::IntRect(gfx::IntPoint(0, 0), screenSize); #if ANDROID_VERSION >= 17 int supported = 0; diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index a858d37ce62b..52e2f23e1814 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -161,7 +161,7 @@ nsWindow::nsWindow() win->query(win, NATIVE_WINDOW_HEIGHT, &screenSize.height)) { NS_RUNTIMEABORT("Failed to get native window size, aborting..."); } - gScreenBounds = nsIntRect(nsIntPoint(0, 0), screenSize); + gScreenBounds = gfx::IntRect(gfx::IntPoint(0, 0), screenSize); char propValue[PROPERTY_VALUE_MAX]; property_get("ro.sf.hwrotation", propValue, "0"); diff --git a/widget/gtk/nsNativeThemeGTK.cpp b/widget/gtk/nsNativeThemeGTK.cpp index 8d5001bd7339..a3595009cc22 100644 --- a/widget/gtk/nsNativeThemeGTK.cpp +++ b/widget/gtk/nsNativeThemeGTK.cpp @@ -7,6 +7,7 @@ #include "nsThemeConstants.h" #include "gtkdrawing.h" +#include "gfx2DGlue.h" #include "nsIObserverService.h" #include "nsIServiceManager.h" #include "nsIFrame.h" @@ -849,7 +850,7 @@ nsNativeThemeGTK::DrawWidgetBackground(nsRenderingContext* aContext, nsIntRect overflowRect(widgetRect); nsIntMargin extraSize; if (GetExtraSizeForWidget(aFrame, aWidgetType, &extraSize)) { - overflowRect.Inflate(extraSize); + overflowRect.Inflate(gfx::ToIntMargin(extraSize)); } // This is the rectangle that will actually be drawn, in gdk pixels diff --git a/widget/nsBaseDragService.cpp b/widget/nsBaseDragService.cpp index 53665f42f071..cbd023226d7e 100644 --- a/widget/nsBaseDragService.cpp +++ b/widget/nsBaseDragService.cpp @@ -516,7 +516,7 @@ nsBaseDragService::DrawDrag(nsIDOMNode* aDOMNode, if (rootFrame && *aPresContext) { nsIntRect dragRect; aRegion->GetBoundingBox(&dragRect.x, &dragRect.y, &dragRect.width, &dragRect.height); - dragRect = dragRect.ToAppUnits(nsPresContext::AppUnitsPerCSSPixel()). + dragRect = ToAppUnits(dragRect, nsPresContext::AppUnitsPerCSSPixel()). ToOutsidePixels((*aPresContext)->AppUnitsPerDevPixel()); nsIntRect screenRect = rootFrame->GetScreenRectExternal(); diff --git a/widget/nsIPluginWidget.h b/widget/nsIPluginWidget.h index 7f95a70b9825..3ddf79d39f2d 100644 --- a/widget/nsIPluginWidget.h +++ b/widget/nsIPluginWidget.h @@ -4,12 +4,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsISupports.h" +#include "nsPoint.h" #define NS_IPLUGINWIDGET_IID \ { 0xEB9207E0, 0xD8F1, 0x44B9, \ { 0xB7, 0x52, 0xAF, 0x8E, 0x9F, 0x8E, 0xBD, 0xF7 } } -struct nsIntPoint; class nsIPluginInstanceOwner; /** diff --git a/widget/nsIRollupListener.h b/widget/nsIRollupListener.h index efb8e331a417..83c2dd142671 100644 --- a/widget/nsIRollupListener.h +++ b/widget/nsIRollupListener.h @@ -8,10 +8,10 @@ #define __nsIRollupListener_h__ #include "nsTArray.h" +#include "nsPoint.h" class nsIContent; class nsIWidget; -struct nsIntPoint; class nsIRollupListener { public: diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index 3248932b91c7..4e040b76d00c 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -1499,7 +1499,7 @@ void find_first_visible_parent(QWindow* aItem, QWindow*& aVisibleItem) NS_IMETHODIMP nsWindow::GetScreenBounds(nsIntRect &aRect) { - aRect = nsIntRect(nsIntPoint(0, 0), mBounds.Size()); + aRect = gfx::IntRect(gfx::IntPoint(0, 0), mBounds.Size()); if (mIsTopLevel) { QPoint pos = mWidget->position(); aRect.MoveTo(pos.x(), pos.y()); diff --git a/widget/windows/WinMouseScrollHandler.h b/widget/windows/WinMouseScrollHandler.h index b7d8a179b961..dd8f1ca6b1aa 100644 --- a/widget/windows/WinMouseScrollHandler.h +++ b/widget/windows/WinMouseScrollHandler.h @@ -14,9 +14,9 @@ #include "mozilla/TimeStamp.h" #include "Units.h" #include +#include "nsPoint.h" class nsWindowBase; -struct nsIntPoint; namespace mozilla { namespace widget { diff --git a/widget/windows/WinUtils.h b/widget/windows/WinUtils.h index 6dc620740154..0a4ae9daa78f 100644 --- a/widget/windows/WinUtils.h +++ b/widget/windows/WinUtils.h @@ -22,6 +22,7 @@ #include "nsAutoPtr.h" #include "nsString.h" #include "nsRegion.h" +#include "nsRect.h" #include "nsIRunnable.h" #include "nsICryptoHash.h" @@ -75,7 +76,6 @@ public: class nsWindow; class nsWindowBase; struct KeyPair; -struct nsIntRect; namespace mozilla { namespace widget { diff --git a/widget/windows/nsIMM32Handler.h b/widget/windows/nsIMM32Handler.h index 20d1240caf10..5145636ed40d 100644 --- a/widget/windows/nsIMM32Handler.h +++ b/widget/windows/nsIMM32Handler.h @@ -13,9 +13,9 @@ #include "nsTArray.h" #include "nsIWidget.h" #include "mozilla/EventForwards.h" +#include "nsRect.h" class nsWindow; -struct nsIntRect; namespace mozilla { namespace widget { diff --git a/widget/windows/winrt/MetroInput.cpp b/widget/windows/winrt/MetroInput.cpp index 194efb9585e8..0212eb06f4d2 100644 --- a/widget/windows/winrt/MetroInput.cpp +++ b/widget/windows/winrt/MetroInput.cpp @@ -20,6 +20,7 @@ #include "mozilla/Preferences.h" // for Preferences #include "WinUtils.h" #include "nsIPresShell.h" +#include "nsPoint.h" // System headers (alphabetical) #include // ABI::Window::UI::Core namespace diff --git a/widget/windows/winrt/MetroInput.h b/widget/windows/winrt/MetroInput.h index 9e00039b097b..56c8105feacb 100644 --- a/widget/windows/winrt/MetroInput.h +++ b/widget/windows/winrt/MetroInput.h @@ -23,7 +23,6 @@ // Moz forward declarations class MetroWidget; -struct nsIntPoint; namespace mozilla { namespace dom { diff --git a/widget/windows/winrt/MetroUtils.h b/widget/windows/winrt/MetroUtils.h index ec1b650dbd00..97740b7d20d5 100644 --- a/widget/windows/winrt/MetroUtils.h +++ b/widget/windows/winrt/MetroUtils.h @@ -10,6 +10,7 @@ #include "nsString.h" #include "nsPoint.h" #include "WinUtils.h" +#include "nsRect.h" #include "mozwrlbase.h" @@ -40,7 +41,6 @@ class nsIBrowserDOMWindow; class nsIDOMWindow; -struct nsIntRect; namespace mozilla { namespace widget { diff --git a/xpfe/appshell/nsAppShellService.cpp b/xpfe/appshell/nsAppShellService.cpp index 0b52f29f4262..9375a097425d 100644 --- a/xpfe/appshell/nsAppShellService.cpp +++ b/xpfe/appshell/nsAppShellService.cpp @@ -393,7 +393,7 @@ nsAppShellService::CreateWindowlessBrowser(bool aIsChrome, nsIWebNavigation **aR NS_ERROR("Couldn't create instance of PuppetWidget"); return NS_ERROR_FAILURE; } - widget->Create(nullptr, 0, nsIntRect(nsIntPoint(0, 0), nsIntSize(0, 0)), + widget->Create(nullptr, 0, gfx::IntRect(gfx::IntPoint(0, 0), gfx::IntSize(0, 0)), nullptr); nsCOMPtr window = do_QueryInterface(navigation); window->InitWindow(0, widget, 0, 0, 0, 0);