mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
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 : 3194652ca83f2e66ae1cbd02573ab86c444bd2fb
This commit is contained in:
parent
0ee6fc3ed1
commit
673f3a21d4
@ -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;
|
||||
}
|
||||
|
||||
|
@ -665,50 +665,25 @@ 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();
|
||||
@ -716,7 +691,7 @@ ClipToRegionInternal(DrawTarget* aTarget, const nsIntRegion& aRegion,
|
||||
return;
|
||||
}
|
||||
|
||||
RefPtr<Path> path = PathFromRegionInternal(aTarget, aRegion, aSnap);
|
||||
RefPtr<Path> path = PathFromRegionInternal(aTarget, aRegion);
|
||||
aTarget->PushClip(path);
|
||||
}
|
||||
|
||||
@ -729,7 +704,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
|
||||
@ -738,12 +713,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)
|
||||
{
|
||||
|
@ -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|.
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user