Bug 120346 - [cairo] ShadowBlur is extremely slow when canvas's scale is very small.
Summary: [cairo] ShadowBlur is extremely slow when canvas's scale is very small.
Status: UNCONFIRMED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-08-27 01:49 PDT by Yonggeol Jung
Modified: 2018-08-11 03:33 PDT (History)
5 users (show)

See Also:


Attachments
testcase (736 bytes, text/html)
2013-08-27 01:57 PDT, Yonggeol Jung
no flags Details
Patch (5.38 KB, patch)
2013-08-27 02:15 PDT, Yonggeol Jung
no flags Details | Formatted Diff | Diff
Patch (5.38 KB, application/octet-stream)
2013-08-27 02:22 PDT, Yonggeol Jung
no flags Details
Patch (5.38 KB, patch)
2013-08-27 02:26 PDT, Yonggeol Jung
no flags Details | Formatted Diff | Diff
Patch (5.38 KB, patch)
2013-08-27 02:30 PDT, Yonggeol Jung
no flags Details | Formatted Diff | Diff
Patch (5.38 KB, patch)
2013-08-27 02:41 PDT, Yonggeol Jung
no flags Details | Formatted Diff | Diff
Offset issue is fixed. (5.48 KB, patch)
2013-09-11 21:55 PDT, Yonggeol Jung
noam: review-
Details | Formatted Diff | Diff
Patch (5.85 KB, patch)
2013-10-17 00:30 PDT, Yonggeol Jung
beidson: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yonggeol Jung 2013-08-27 01:49:19 PDT
ShadowBlur drawing is too slow if scale of canvas is set to very small value such as 0.01.
Comment 1 Yonggeol Jung 2013-08-27 01:57:12 PDT
Created attachment 209729 [details]
testcase

This is test file for this problem.

It draws (10000 X 10000) size rectangle with shadowblur(100).
And canvas's scale is set to 0.01.

You can see this problem at 5'th test of "http://www.kevs3d.co.uk/dev/canvasmark/" also.
Comment 2 Yonggeol Jung 2013-08-27 02:15:30 PDT
Created attachment 209730 [details]
Patch
Comment 3 WebKit Commit Bot 2013-08-27 02:17:35 PDT
Attachment 209730 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/graphics/ShadowBlur.cpp', u'Source/WebCore/platform/graphics/ShadowBlur.h']" exit_code: 1
Source/WebCore/ChangeLog:11:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Yonggeol Jung 2013-08-27 02:22:30 PDT
Created attachment 209733 [details]
Patch
Comment 5 WebKit Commit Bot 2013-08-27 02:25:12 PDT
Attachment 209733 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/graphics/ShadowBlur.cpp', u'Source/WebCore/platform/graphics/ShadowBlur.h']" exit_code: 1
Source/WebCore/ChangeLog:11:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Yonggeol Jung 2013-08-27 02:26:04 PDT
Created attachment 209735 [details]
Patch
Comment 7 WebKit Commit Bot 2013-08-27 02:28:15 PDT
Attachment 209735 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/graphics/ShadowBlur.cpp', u'Source/WebCore/platform/graphics/ShadowBlur.h']" exit_code: 1
Source/WebCore/ChangeLog:11:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Yonggeol Jung 2013-08-27 02:30:17 PDT
Created attachment 209736 [details]
Patch
Comment 9 WebKit Commit Bot 2013-08-27 02:33:05 PDT
Attachment 209736 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCore/platform/graphics/ShadowBlur.cpp', u'Source/WebCore/platform/graphics/ShadowBlur.h']" exit_code: 1
Source/WebCore/ChangeLog:11:  Line contains tab character.  [whitespace/tab] [5]
Total errors found: 1 in 3 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Yonggeol Jung 2013-08-27 02:41:17 PDT
Created attachment 209738 [details]
Patch
Comment 11 Yonggeol Jung 2013-09-11 21:55:21 PDT
Created attachment 211396 [details]
Offset issue is fixed.
Comment 12 Noam Rosenthal 2013-10-16 09:10:05 PDT
Comment on attachment 211396 [details]
Offset issue is fixed.

View in context: https://bugs.webkit.org/attachment.cgi?id=211396&action=review

This is a good catch, but the patch is hard to understand and needs to be a lot clearer.

> Source/WebCore/ChangeLog:11
> +        ShadowBlur drawing is too slow if scale of canvas is set to very small value such as 0.01.
> +        The main reason is blurRadius gets huge value if scale is small.
> +        If shadow value is 100 with 0.01 scale value, blurRadius will be 10000.
> +        Almost time is consumed to make blurred-layer.

This ChangeLog is written with poor English. Please improve.
Also though you're describing the problem, you're not at all describing the solution.

> Source/WebCore/platform/graphics/ShadowBlur.cpp:402
> +    const AffineTransform transform = context->getCTM();

No need for const

> Source/WebCore/platform/graphics/ShadowBlur.cpp:403
> +    if (m_shadowsIgnoreTransforms && !transform.isIdentity() && transform.xScale() < 1 && transform.yScale() < 1)

We should exit early on m_shadowsIgnoreTransforms before we get the CTM from the context.

> Source/WebCore/platform/graphics/ShadowBlur.cpp:420
> +        if (scaledBlurLayer)
> +            transform.scale(1 / transform.xScale(), 1 / transform.yScale());

What does this do? maybe a comment is in place? at least the changelog should describe this.
Comment 13 Yonggeol Jung 2013-10-17 00:30:26 PDT
Created attachment 214427 [details]
Patch
Comment 14 Yonggeol Jung 2013-10-17 00:34:12 PDT
(In reply to comment #12)
> (From update of attachment 211396 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=211396&action=review
> 
> This is a good catch, but the patch is hard to understand and needs to be a lot clearer.

Thanks for review.

> 
> > Source/WebCore/ChangeLog:11
> > +        ShadowBlur drawing is too slow if scale of canvas is set to very small value such as 0.01.
> > +        The main reason is blurRadius gets huge value if scale is small.
> > +        If shadow value is 100 with 0.01 scale value, blurRadius will be 10000.
> > +        Almost time is consumed to make blurred-layer.
> 
> This ChangeLog is written with poor English. Please improve.
> Also though you're describing the problem, you're not at all describing the solution.

done.
 
> > Source/WebCore/platform/graphics/ShadowBlur.cpp:402
> > +    const AffineTransform transform = context->getCTM();
> 
> No need for const
> 

done.

> > Source/WebCore/platform/graphics/ShadowBlur.cpp:403
> > +    if (m_shadowsIgnoreTransforms && !transform.isIdentity() && transform.xScale() < 1 && transform.yScale() < 1)
> 
> We should exit early on m_shadowsIgnoreTransforms before we get the CTM from the context.
> 

done.

> > Source/WebCore/platform/graphics/ShadowBlur.cpp:420
> > +        if (scaledBlurLayer)
> > +            transform.scale(1 / transform.xScale(), 1 / transform.yScale());
> 
> What does this do? maybe a comment is in place? at least the changelog should describe this.

Before drawing the shadows, the scale factor of context is 1.
So, the positions and sizes of rectangles should be calculated as considering the scale factor is 1. (I added comment.)
Comment 15 Brady Eidson 2016-05-24 22:03:25 PDT
Comment on attachment 214427 [details]
Patch

Assuming that patches for review since 2013 are stale, r-
Comment 16 Michael Catanzaro 2017-06-07 19:45:58 PDT
Reassigning some EFL bugs that are likely shared with GTK/WPE to the GTK component.