Bug 1376782 - Replace gfxSize with a typedef to SizeDouble. r=jrmuizel

Most of the changes in this patch are just using the explicit
constructor from gfx::IntSize to gfx::Size, since gfxSize did
that implicitly but gfx::Size doesn't.

MozReview-Commit-ID: CzikGjHEXje

--HG--
extra : rebase_source : 9d19977f2a774d9a2a653db923553a6c2e06f82a
This commit is contained in:
Kartikaya Gupta 2017-06-28 11:41:21 -04:00
parent 57f217254c
commit 7332c6da98
10 changed files with 12 additions and 24 deletions

View File

@ -34,7 +34,6 @@ include "mozilla/layers/LayersMessageUtils.h";
using class IPC::Principal from "mozilla/dom/PermissionMessageUtils.h";
using class mozilla::gfx::Matrix from "mozilla/gfx/Matrix.h";
using struct gfxSize from "gfxPoint.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::LayoutDevicePoint from "Units.h";
using mozilla::ScreenIntPoint from "Units.h";

View File

@ -33,7 +33,7 @@ void ImageLayer::ComputeEffectiveTransforms(const gfx::Matrix4x4& aTransformToSu
// Snap image edges to pixel boundaries
gfxRect sourceRect(0, 0, 0, 0);
if (mContainer) {
sourceRect.SizeTo(mContainer->GetCurrentSize());
sourceRect.SizeTo(SizeDouble(mContainer->GetCurrentSize()));
}
// Snap our local transform first, and snap the inherited transform as well.
// This makes our snapping equivalent to what would happen if our content

View File

@ -662,7 +662,7 @@ nsDeviceContext::FindScreen(nsIScreen** outScreen)
bool
nsDeviceContext::CalcPrintingSize()
{
gfxSize size = mPrintTarget->GetSize();
gfxSize size(mPrintTarget->GetSize());
// For printing, CSS inches and physical inches are identical
// so it doesn't matter which we use here
mWidth = NSToCoordRound(size.width * AppUnitsPerPhysicalInch()

View File

@ -10,18 +10,13 @@
#include "mozilla/gfx/BaseSize.h"
#include "mozilla/gfx/BasePoint.h"
#include "mozilla/gfx/Matrix.h"
#include "mozilla/gfx/Point.h"
#include "nsSize.h"
#include "nsPoint.h"
#include "gfxTypes.h"
struct gfxSize : public mozilla::gfx::BaseSize<gfxFloat, gfxSize> {
typedef mozilla::gfx::BaseSize<gfxFloat, gfxSize> Super;
gfxSize() : Super() {}
gfxSize(gfxFloat aWidth, gfxFloat aHeight) : Super(aWidth, aHeight) {}
MOZ_IMPLICIT gfxSize(const mozilla::gfx::IntSize& aSize) : Super(aSize.width, aSize.height) {}
};
typedef mozilla::gfx::SizeDouble gfxSize;
struct gfxPoint : public mozilla::gfx::BasePoint<gfxFloat, gfxPoint> {
typedef mozilla::gfx::BasePoint<gfxFloat, gfxPoint> Super;
@ -61,10 +56,4 @@ operator/(const gfxPoint& aPoint, const gfxSize& aSize)
return gfxPoint(aPoint.x / aSize.width, aPoint.y / aSize.height);
}
inline gfxSize
operator/(gfxFloat aValue, const gfxSize& aSize)
{
return gfxSize(aValue / aSize.width, aValue / aSize.height);
}
#endif /* GFX_POINT_H */

View File

@ -313,7 +313,7 @@ ClippedImage::GetFrameInternal(const nsIntSize& aSize,
new gfxCallbackDrawable(drawTileCallback, aSize);
// Actually draw. The callback will end up invoking DrawSingleTile.
gfxUtils::DrawPixelSnapped(ctx, drawable, aSize,
gfxUtils::DrawPixelSnapped(ctx, drawable, SizeDouble(aSize),
ImageRegion::Create(aSize),
SurfaceFormat::B8G8R8A8,
SamplingFilter::LINEAR,
@ -404,7 +404,7 @@ ClippedImage::Draw(gfxContext* aContext,
new gfxSurfaceDrawable(surface, aSize);
// Draw.
gfxUtils::DrawPixelSnapped(aContext, drawable, aSize, aRegion,
gfxUtils::DrawPixelSnapped(aContext, drawable, SizeDouble(aSize), aRegion,
SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity);

View File

@ -235,7 +235,7 @@ DynamicImage::Draw(gfxContext* aContext,
IntSize drawableSize(mDrawable->Size());
if (aSize == drawableSize) {
gfxUtils::DrawPixelSnapped(aContext, mDrawable, drawableSize, aRegion,
gfxUtils::DrawPixelSnapped(aContext, mDrawable, SizeDouble(drawableSize), aRegion,
SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity);
return DrawResult::SUCCESS;
@ -250,7 +250,7 @@ DynamicImage::Draw(gfxContext* aContext,
gfxContextMatrixAutoSaveRestore saveMatrix(aContext);
aContext->Multiply(gfxMatrix::Scaling(scale.width, scale.height));
gfxUtils::DrawPixelSnapped(aContext, mDrawable, drawableSize, region,
gfxUtils::DrawPixelSnapped(aContext, mDrawable, SizeDouble(drawableSize), region,
SurfaceFormat::B8G8R8A8, aSamplingFilter,
aOpacity);
return DrawResult::SUCCESS;

View File

@ -132,7 +132,7 @@ OrientedImage::GetFrame(uint32_t aWhichFrame,
RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(target);
MOZ_ASSERT(ctx); // already checked the draw target above
ctx->Multiply(OrientationMatrix(size));
gfxUtils::DrawPixelSnapped(ctx, drawable, size, ImageRegion::Create(size),
gfxUtils::DrawPixelSnapped(ctx, drawable, SizeDouble(size), ImageRegion::Create(size),
surfaceFormat, SamplingFilter::LINEAR);
return target->Snapshot();

View File

@ -1019,7 +1019,7 @@ VectorImage::Show(gfxDrawable* aDrawable, const SVGDrawingParameters& aParams)
{
MOZ_ASSERT(aDrawable, "Should have a gfxDrawable by now");
gfxUtils::DrawPixelSnapped(aParams.context, aDrawable,
aParams.size,
SizeDouble(aParams.size),
aParams.region,
SurfaceFormat::B8G8R8A8,
aParams.samplingFilter,

View File

@ -363,7 +363,7 @@ imgFrame::InitWithDrawable(gfxDrawable* aDrawable,
// Draw using the drawable the caller provided.
RefPtr<gfxContext> ctx = gfxContext::CreateOrNull(target);
MOZ_ASSERT(ctx); // Already checked the draw target above.
gfxUtils::DrawPixelSnapped(ctx, aDrawable, mFrameRect.Size(),
gfxUtils::DrawPixelSnapped(ctx, aDrawable, SizeDouble(mFrameRect.Size()),
ImageRegion::Create(ThebesRect(mFrameRect)),
mFormat, aSamplingFilter, aImageFlags);

View File

@ -345,7 +345,7 @@ UpdateNeededBounds(const nsIntRegion& aRegion, nsIntRect& aBounds)
bool overflow;
IntSize surfaceSize =
nsSVGUtils::ConvertToSurfaceSize(aBounds.Size(), &overflow);
nsSVGUtils::ConvertToSurfaceSize(SizeDouble(aBounds.Size()), &overflow);
if (overflow) {
aBounds.SizeTo(surfaceSize);
}