Bug 1101020 - Add the ability to fall back to not snapping, if snapping results in a zero area rect r=roc
This commit is contained in:
@@ -8094,6 +8094,20 @@ Rect NSRectToSnappedRect(const nsRect& aRect, double aAppUnitsPerPixel,
|
||||
MaybeSnapToDevicePixels(rect, aSnapDT, true);
|
||||
return rect;
|
||||
}
|
||||
// Similar to a snapped rect, except an axis is left unsnapped if the snapping
|
||||
// process results in a length of 0.
|
||||
Rect NSRectToNonEmptySnappedRect(const nsRect& aRect, double aAppUnitsPerPixel,
|
||||
const gfx::DrawTarget& aSnapDT)
|
||||
{
|
||||
// Note that by making aAppUnitsPerPixel a double we're doing floating-point
|
||||
// division using a larger type and avoiding rounding error.
|
||||
Rect rect(Float(aRect.x / aAppUnitsPerPixel),
|
||||
Float(aRect.y / aAppUnitsPerPixel),
|
||||
Float(aRect.width / aAppUnitsPerPixel),
|
||||
Float(aRect.height / aAppUnitsPerPixel));
|
||||
MaybeSnapToDevicePixels(rect, aSnapDT, true, false);
|
||||
return rect;
|
||||
}
|
||||
|
||||
void StrokeLineWithSnapping(const nsPoint& aP1, const nsPoint& aP2,
|
||||
int32_t aAppUnitsPerDevPixel,
|
||||
|
||||
Reference in New Issue
Block a user