RESOLVED FIXED 226916
[CG] Create a sub-image when drawing an image only if the destination image will be enlarged, rotated or sheared
https://bugs.webkit.org/show_bug.cgi?id=226916
Summary [CG] Create a sub-image when drawing an image only if the destination image w...
Said Abou-Hallawa
Reported 2021-06-11 01:39:18 PDT
Creating a sub-image using CGImageCreateWithImageInRect() is expensive. But the cost of its creation will be worthy, if it is referenced multiple times. So we should postpone creating and caching the sub-image until it is referenced twice.
Attachments
Patch (7.00 KB, patch)
2021-06-11 01:44 PDT, Said Abou-Hallawa
no flags
Patch (15.02 KB, patch)
2021-06-13 02:08 PDT, Said Abou-Hallawa
no flags
Patch (15.11 KB, patch)
2021-06-13 19:56 PDT, Said Abou-Hallawa
no flags
Patch (16.59 KB, patch)
2021-06-13 23:45 PDT, Said Abou-Hallawa
simon.fraser: review+
ews-feeder: commit-queue-
Patch for landing (16.17 KB, patch)
2021-06-14 19:30 PDT, Said Abou-Hallawa
no flags
Said Abou-Hallawa
Comment 1 2021-06-11 01:39:58 PDT
Said Abou-Hallawa
Comment 2 2021-06-11 01:44:05 PDT
Said Abou-Hallawa
Comment 3 2021-06-13 02:08:15 PDT
Said Abou-Hallawa
Comment 4 2021-06-13 19:56:12 PDT
Said Abou-Hallawa
Comment 5 2021-06-13 23:45:20 PDT
Said Abou-Hallawa
Comment 6 2021-06-13 23:49:50 PDT
This patch fixes the following: 1. The perf problem in the emoji dropdown of twitter.com editor because no sub-images are created to display the emoji images. 2. The perf problem in the http://www.antutu.com/html5/collision.html because sub-images are created to display the rotated balls. 3. The display of the canvas in the layout test: fast/canvas/drawImage-with-negative-source-destination.html which has been broken for sometime.
Simon Fraser (smfr)
Comment 7 2021-06-14 14:39:32 PDT
Comment on attachment 431303 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=431303&action=review > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:230 > +static inline bool shouldUseSubimage(CGInterpolationQuality interpolationQuality, const FloatRect& destRect, const FloatRect& srcRect, const AffineTransform& transform) This could be a lambda function. > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:241 > +static inline RetainPtr<CGImageRef> getSubimage(CGImageRef image, const FloatSize& imageSize, const FloatRect& subimageRect, const ImagePaintingOptions& options) This could be a lambda function. > Source/WebCore/platform/graphics/cg/GraphicsContextCG.cpp:259 > +static inline FloatSize imageLogicalSize(CGImageRef image, const ImagePaintingOptions& options) This could be a lambda function.
Said Abou-Hallawa
Comment 8 2021-06-14 19:30:06 PDT
Created attachment 431396 [details] Patch for landing
EWS
Comment 9 2021-06-15 00:40:51 PDT
Committed r278863 (238807@main): <https://commits.webkit.org/238807@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 431396 [details].
Note You need to log in before you can comment on or make changes to this bug.