[Webkit-unassigned] [Bug 48738] GraphicsContext: Don't do full save/restore when painting with low quality scaling

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Nov 4 06:00:30 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=48738





--- Comment #6 from Nikolas Zimmermann <zimmermann at kde.org>  2010-11-04 06:00:30 PST ---
(From update of attachment 72500)
View in context: https://bugs.webkit.org/attachment.cgi?id=72500&action=review

> WebCore/platform/graphics/GraphicsContext.cpp:415
> +    InterpolationQuality previousInterpolationQuality = InterpolationDefault;
>      if (useLowQualityScale) {
> -        save();
> +        previousInterpolationQuality = imageInterpolationQuality();
>          setImageInterpolationQuality(InterpolationNone);
>      }
> +
>      image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);
> +
>      if (useLowQualityScale)
> -        restore();
> +        setImageInterpolationQuality(previousInterpolationQuality);

Hm, I think we could do better, and avoid the temporary variable, if !useLowQualityScale is used:
if (useLowQualityScale) {
    InterpolationQuality previousInterpolationQuality = imageInterpolationQuality();
    setImageInterpolationQuality(InterpolationLow); // NOTE: The InterpolationNone looks wrong to me.
    image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);
    setImageInterpolationQuality(previousInterpolationQuality);
} else
    image->draw(this, FloatRect(dest.location(), FloatSize(tw, th)), FloatRect(src.location(), FloatSize(tsw, tsh)), styleColorSpace, op);

etc.
What do you think?

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list