зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1360415 - Enable smoothing in canvas.drawImage when down-scaling, even with imageSmoothingEnabled=false. r=bzbarsky
This commit is contained in:
Родитель
babc61461a
Коммит
f83cf1506c
|
@ -5361,10 +5361,18 @@ CanvasRenderingContext2D::DrawImage(const CanvasImageSource& aImage,
|
|||
return;
|
||||
}
|
||||
|
||||
// Per spec, the smoothing setting applies only to scaling up a bitmap image.
|
||||
// When down-scaling the user agent is free to choose whether or not to smooth
|
||||
// the image. Nearest sampling when down-scaling is rarely desirable and
|
||||
// smoothing when down-scaling matches chromium's behavior.
|
||||
// If any dimension is up-scaled, we consider the image as being up-scaled.
|
||||
auto scale = mTarget->GetTransform().ScaleFactors(true);
|
||||
bool isDownScale = aDw * Abs(scale.width) < aSw && aDh * Abs(scale.height) < aSh;
|
||||
|
||||
SamplingFilter samplingFilter;
|
||||
AntialiasMode antialiasMode;
|
||||
|
||||
if (CurrentState().imageSmoothingEnabled) {
|
||||
if (CurrentState().imageSmoothingEnabled || isDownScale) {
|
||||
samplingFilter = gfx::SamplingFilter::LINEAR;
|
||||
antialiasMode = AntialiasMode::DEFAULT;
|
||||
} else {
|
||||
|
|
Загрузка…
Ссылка в новой задаче