WebKit icon indicating copy to clipboard operation
WebKit copied to clipboard

Account for CTM scale when deciding the image resampling algorithm

Open Ahmad-S792 opened this issue 2 years ago โ€ข 7 comments

Account for CTM scale when deciding the image resampling algorithm
https://bugs.webkit.org/show_bug.cgi?id=115158

Reviewed by NOBODY (OOPS!).

Merge - https://chromium.googlesource.com/chromium/blink/+/b772b4d7c24b66bebba703fd2ef89fbe73ea1935

ImageQualityController considers the image size and layout size when
computing which resampling algorithm to use, but did not account
for the current transform. This was noticeable as 'bouncing' when
scaling an image directly with a transform.

This patch incorporates the context's CTM (which includes scale
but not zoom) into the resampling calculation. Because the
ImageQualityController runs on a 500ms timer, a manual test
has been added.

* Source/WebCore/rendering/ImageQualityController.cpp
(ImageQualityController::interpolationQuality): Rename "size" to "layoutSize
(ImageQualityController::chooseInterpolationQuality): 
(1) Move "unzoomed" image below
(2) Moved up "AffineTransform" and "contextIsScaled" before resizing condition 
(3) Introduced "scaledImageSize" and "scaledLayoutSize" and replace usage of "size" with "scaleLayoutSize" 
(4) Replace use of 'size' with 'scaledLayoutSize'
* ManualTests/image-resampling-with-scale.html: Added Test

https://github.com/WebKit/WebKit/commit/caea033889bc1e428d9934547ddf514179eb877c

Misc iOS, tvOS & watchOS macOS Linux Windows
โœ… ๐Ÿงช style โŒ ๐Ÿ›  ios โŒ ๐Ÿ›  mac โŒ ๐Ÿ›  wpe โŒ ๐Ÿ›  ๐Ÿงช win
โœ… ๐Ÿงช bindings โŒ ๐Ÿ›  ios-sim โŒ ๐Ÿ›  mac-debug โŒ ๐Ÿ›  gtk โŒ ๐Ÿ›  wincairo
โœ… ๐Ÿงช webkitperl โŒ ๐Ÿงช ios-wk2 โŒ ๐Ÿ›  mac-AS-debug โŒ ๐Ÿงช gtk-wk2
โŒ ๐Ÿงช api-ios โŒ ๐Ÿงช api-mac โŒ ๐Ÿงช api-gtk
โŒ ๐Ÿ›  tv โŒ ๐Ÿงช mac-wk1
โŒ ๐Ÿ›  tv-sim โŒ ๐Ÿงช mac-wk2
โŒ ๐Ÿ›  watch โŒ ๐Ÿงช mac-AS-debug-wk2
โŒ ๐Ÿ›  watch-sim โŒ ๐Ÿงช mac-wk2-stress

Ahmad-S792 avatar Oct 06 '22 22:10 Ahmad-S792

So this optimization was removed later - https://chromium.googlesource.com/chromium/blink/+/59209c03f1ef165ca73f12f0527a0819309daefd%5E%21/#F0

Ahmad-S792 avatar Oct 31 '22 15:10 Ahmad-S792