mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 633282 - Add ToNearestPixels to nsRegion. r=roc.
This commit is contained in:
parent
4a2e304d12
commit
87cc72d4a4
@ -1363,18 +1363,32 @@ nsRegion nsRegion::ConvertAppUnitsRoundIn (PRInt32 aFromAPP, PRInt32 aToAPP) con
|
||||
return region;
|
||||
}
|
||||
|
||||
nsIntRegion nsRegion::ToOutsidePixels (nscoord aAppUnitsPerPixel) const
|
||||
nsIntRegion nsRegion::ToPixels (nscoord aAppUnitsPerPixel, bool aOutsidePixels) const
|
||||
{
|
||||
nsIntRegion result;
|
||||
nsRegionRectIterator rgnIter(*this);
|
||||
const nsRect* currentRect;
|
||||
while ((currentRect = rgnIter.Next())) {
|
||||
nsIntRect deviceRect = currentRect->ToOutsidePixels(aAppUnitsPerPixel);
|
||||
nsIntRect deviceRect;
|
||||
if (aOutsidePixels)
|
||||
deviceRect = currentRect->ToOutsidePixels(aAppUnitsPerPixel);
|
||||
else
|
||||
deviceRect = currentRect->ToNearestPixels(aAppUnitsPerPixel);
|
||||
result.Or(result, deviceRect);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
nsIntRegion nsRegion::ToOutsidePixels (nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
return ToPixels(aAppUnitsPerPixel, true);
|
||||
}
|
||||
|
||||
nsIntRegion nsRegion::ToNearestPixels (nscoord aAppUnitsPerPixel) const
|
||||
{
|
||||
return ToPixels(aAppUnitsPerPixel, false);
|
||||
}
|
||||
|
||||
// A cell's "value" is a pair consisting of
|
||||
// a) the area of the subrectangle it corresponds to, if it's in
|
||||
// aContainingRect and in the region, 0 otherwise
|
||||
|
@ -186,6 +186,7 @@ public:
|
||||
nsRegion ConvertAppUnitsRoundIn (PRInt32 aFromAPP, PRInt32 aToAPP) const;
|
||||
nsRegion& ScaleRoundOut(float aXScale, float aYScale);
|
||||
nsIntRegion ToOutsidePixels (nscoord aAppUnitsPerPixel) const;
|
||||
nsIntRegion ToNearestPixels (nscoord aAppUnitsPerPixel) const;
|
||||
nsRegion& ExtendForScaling (float aXMult, float aYMult);
|
||||
|
||||
/**
|
||||
@ -262,6 +263,7 @@ private:
|
||||
void MoveInto (nsRegion& aDestRegion, const RgnRect* aStartRect);
|
||||
void MoveInto (nsRegion& aDestRegion)
|
||||
{ MoveInto (aDestRegion, mRectListHead.next); }
|
||||
nsIntRegion ToPixels(nscoord aAppUnitsPerPixel, bool aOutsidePixels) const;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user