Bug 1073086. Remove broken snapping code. r=mwoodrow

We generate a Rect from integers and then round them to do the snapping.

-      Rect rect(r->x, r->y, r->width, r->height);
-
-      rect.Round();

This accomplishes nothing.

Just rip it out.

--HG--
extra : rebase_source : 620d4c9b4e6951e42441db336de2badb69c4a39c
This commit is contained in:
Jeff Muizelaar 2014-09-25 14:01:10 -04:00
parent 754c1af9cc
commit 91bc7be99d
3 changed files with 11 additions and 45 deletions

View File

@ -229,7 +229,7 @@ RotatedContentBuffer::DrawTo(PaintedLayer* aLayer,
// Bug 599189 if there is a non-integer-translation transform in aTarget,
// we might sample pixels outside GetEffectiveVisibleRegion(), which is wrong
// and may cause gray lines.
gfxUtils::ClipToRegionSnapped(aTarget, aLayer->GetEffectiveVisibleRegion());
gfxUtils::ClipToRegion(aTarget, aLayer->GetEffectiveVisibleRegion());
clipped = true;
}

View File

@ -664,50 +664,27 @@ ClipToRegionInternal(gfxContext* aContext, const nsIntRegion& aRegion,
}
static TemporaryRef<Path>
PathFromRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion,
bool aSnap)
PathFromRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion)
{
Matrix mat = aTarget->GetTransform();
const gfxFloat epsilon = 0.000001;
#define WITHIN_E(a,b) (fabs((a)-(b)) < epsilon)
// We're essentially duplicating the logic in UserToDevicePixelSnapped here.
bool shouldNotSnap = !aSnap || (WITHIN_E(mat._11,1.0) &&
WITHIN_E(mat._22,1.0) &&
WITHIN_E(mat._12,0.0) &&
WITHIN_E(mat._21,0.0));
#undef WITHIN_E
RefPtr<PathBuilder> pb = aTarget->CreatePathBuilder();
nsIntRegionRectIterator iter(aRegion);
const nsIntRect* r;
if (shouldNotSnap) {
while ((r = iter.Next()) != nullptr) {
pb->MoveTo(Point(r->x, r->y));
pb->LineTo(Point(r->XMost(), r->y));
pb->LineTo(Point(r->XMost(), r->YMost()));
pb->LineTo(Point(r->x, r->YMost()));
pb->Close();
}
} else {
while ((r = iter.Next()) != nullptr) {
Rect rect(r->x, r->y, r->width, r->height);
rect.Round();
pb->MoveTo(rect.TopLeft());
pb->LineTo(rect.TopRight());
pb->LineTo(rect.BottomRight());
pb->LineTo(rect.BottomLeft());
pb->Close();
}
while ((r = iter.Next()) != nullptr) {
pb->MoveTo(Point(r->x, r->y));
pb->LineTo(Point(r->XMost(), r->y));
pb->LineTo(Point(r->XMost(), r->YMost()));
pb->LineTo(Point(r->x, r->YMost()));
pb->Close();
}
RefPtr<Path> path = pb->Finish();
return path;
}
static void
ClipToRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion,
bool aSnap)
ClipToRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion)
{
if (!aRegion.IsComplex()) {
nsIntRect rect = aRegion.GetBounds();
@ -715,7 +692,7 @@ ClipToRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion,
return;
}
RefPtr<Path> path = PathFromRegionInternal(aTarget, aRegion, aSnap);
RefPtr<Path> path = PathFromRegionInternal(aTarget, aRegion);
aTarget->PushClip(path);
}
@ -728,7 +705,7 @@ gfxUtils::ClipToRegion(gfxContext* aContext, const nsIntRegion& aRegion)
/*static*/ void
gfxUtils::ClipToRegion(DrawTarget* aTarget, const nsIntRegion& aRegion)
{
ClipToRegionInternal(aTarget, aRegion, false);
ClipToRegionInternal(aTarget, aRegion);
}
/*static*/ void
@ -737,12 +714,6 @@ gfxUtils::ClipToRegionSnapped(gfxContext* aContext, const nsIntRegion& aRegion)
ClipToRegionInternal(aContext, aRegion, true);
}
/*static*/ void
gfxUtils::ClipToRegionSnapped(DrawTarget* aTarget, const nsIntRegion& aRegion)
{
ClipToRegionInternal(aTarget, aRegion, true);
}
/*static*/ gfxFloat
gfxUtils::ClampToScaleFactor(gfxFloat aVal)
{

View File

@ -99,11 +99,6 @@ public:
*/
static void ClipToRegionSnapped(gfxContext* aContext, const nsIntRegion& aRegion);
/**
* Clip aTarget to the region aRegion, snapping the rectangles.
*/
static void ClipToRegionSnapped(mozilla::gfx::DrawTarget* aTarget, const nsIntRegion& aRegion);
/**
* Create a path consisting of rectangles in |aRegion|.
*/