Bug 1067588 - Don't draw images with a sampling rect if the rect covers the entire image. r=Bas

--HG--
extra : rebase_source : 1c6aebe49a6168953413f60d97d8d53135298e77
This commit is contained in:
Matt Woodrow 2014-10-03 13:49:08 +13:00
Родитель 493252838e
Коммит 409fe287eb
1 изменённых файлов: 16 добавлений и 17 удалений

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

@ -593,17 +593,6 @@ gfxUtils::DrawPixelSnapped(gfxContext* aContext,
imageRect.Width(), imageRect.Height(),
region.Width(), region.Height());
if (aRegion.IsRestricted() &&
aContext->CurrentMatrix().HasNonIntegerTranslation() &&
drawable->DrawWithSamplingRect(aContext, aRegion.Rect(), aRegion.Restriction(),
doTile, aFilter, aOpacity)) {
return;
}
// 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
// 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
@ -611,19 +600,29 @@ gfxUtils::DrawPixelSnapped(gfxContext* aContext,
// XXX if only we had source-clipping in cairo!
if (aContext->CurrentMatrix().HasNonIntegerTranslation()) {
if (doTile || !aRegion.RestrictionContains(imageRect)) {
if (drawable->DrawWithSamplingRect(aContext, aRegion.Rect(), aRegion.Restriction(),
doTile, aFilter, aOpacity)) {
return;
}
// 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
nsRefPtr<gfxDrawable> restrictedDrawable =
CreateSamplingRestrictedDrawable(aDrawable, aContext,
aRegion, aFormat);
if (restrictedDrawable) {
drawable.swap(restrictedDrawable);
}
}
// We no longer need to tile: Either we never needed to, or we already
// filled a surface with the tiled pattern; this surface can now be
// drawn without tiling.
doTile = false;
}
// We no longer need to tile: Either we never needed to, or we already
// filled a surface with the tiled pattern; this surface can now be
// drawn without tiling.
doTile = false;
#endif
}
}
drawable->Draw(aContext, aRegion.Rect(), doTile, aFilter, aOpacity);
}