Bug 796174 - Only use the high-quality downscaler on downscales, not 1.0 scales. r=jlebar

This commit is contained in:
Joe Drew 2012-10-03 13:27:46 -04:00
Родитель 9b48805329
Коммит 65398a1c60
1 изменённых файлов: 14 добавлений и 2 удалений

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

@ -2801,6 +2801,19 @@ RasterImage::ScaleRequest::Stop(RasterImage* aImg)
request->stopped = true;
}
static inline bool
IsDownscale(const gfxSize& scale)
{
if (scale.width > 1.0)
return false;
if (scale.height > 1.0)
return false;
if (scale.width == 1.0 && scale.height == 1.0)
return false;
return true;
}
bool
RasterImage::CanScale(gfxPattern::GraphicsFilter aFilter,
gfxSize aScale)
@ -2808,8 +2821,7 @@ RasterImage::CanScale(gfxPattern::GraphicsFilter aFilter,
// The high-quality scaler requires Skia.
#ifdef MOZ_ENABLE_SKIA
if (gHQDownscaling && aFilter == gfxPattern::FILTER_GOOD &&
!mAnim && mDecoded &&
(aScale.width <= 1.0 && aScale.height <= 1.0)) {
!mAnim && mDecoded && IsDownscale(aScale)) {
gfxFloat factor = gHQDownscalingMinFactor / 1000.0;
return (aScale.width < factor || aScale.height < factor);
}