Bug 752799. Move image pattern translation within pixman's range. r=roc

--HG--
extra : rebase_source : 0b135838d189944b012e83ec8a225e27ab7dcdca
This commit is contained in:
Jeff Muizelaar 2012-05-27 21:11:18 -04:00
Родитель 4e84e782e5
Коммит 93743fee4c
1 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -478,10 +478,22 @@ gfxUtils::DrawPixelSnapped(gfxContext* aContext,
aFilter = ReduceResamplingFilter(aFilter, aImageRect.Width(), aImageRect.Height(), aSourceRect.Width(), aSourceRect.Height());
gfxMatrix userSpaceToImageSpace = aUserSpaceToImageSpace;
// On Mobile, we don't ever want to do this; it has the potential for
// allocating very large temporary surfaces, especially since we'll
// do full-page snapshots often (see bug 749426).
#ifndef MOZ_GFX_OPTIMIZE_MOBILE
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
// If the pattern translation is large we can get into trouble with pixman's
// 16 bit coordinate limits. For now, we only do this on platforms where
// we know we have the pixman limits. 16384.0 is a somewhat arbitrary
// large number to make sure we avoid the expensive fmod when we can, but
// still maintain a safe margin from the actual limit
if (doTile && (userSpaceToImageSpace.y0 > 16384.0 || userSpaceToImageSpace.x0 > 16384.0)) {
userSpaceToImageSpace.x0 = fmod(userSpaceToImageSpace.x0, aImageRect.width);
userSpaceToImageSpace.y0 = fmod(userSpaceToImageSpace.y0, aImageRect.height);
}
#else
// OK now, the hard part left is to account for the subimage sampling
// restriction. If all the transforms involved are just integer
// translations, then we assume no resampling will occur so there's
@ -511,7 +523,7 @@ gfxUtils::DrawPixelSnapped(gfxContext* aContext,
aContext->SetOperator(OptimalFillOperator());
}
drawable->Draw(aContext, aFill, doTile, aFilter, aUserSpaceToImageSpace);
drawable->Draw(aContext, aFill, doTile, aFilter, userSpaceToImageSpace);
aContext->SetOperator(op);
}