RESOLVED FIXED 44091
[Qt] Reduce the size of the shadow buffer to the clip region
https://bugs.webkit.org/show_bug.cgi?id=44091
Summary [Qt] Reduce the size of the shadow buffer to the clip region
Ariya Hidayat
Reported 2010-08-16 21:59:43 PDT
http://trac.webkit.org/changeset/65425 (from https://bugs.webkit.org/show_bug.cgi?id=44025) adds blur support to the shadow. The buffer image for the shadow is however slightly larger than the rectangle that casts the shadow. This becomes a problem if the rectangle is e.g. a very big <div> in a web page. Technically the shadow buffer needs to be as large as the viewport or the current clipping region only.
Attachments
Patch (2.78 KB, patch)
2010-08-16 22:12 PDT, Ariya Hidayat
no flags
Patch (3.13 KB, patch)
2010-08-17 00:36 PDT, Ariya Hidayat
no flags
Patch (3.13 KB, patch)
2010-08-17 01:12 PDT, Ariya Hidayat
no flags
Ariya Hidayat
Comment 1 2010-08-16 22:12:07 PDT
Dirk Schulze
Comment 2 2010-08-16 22:24:36 PDT
I wounder if the clipping should be applied before adjusting the shadow rect. Doesn't your shadow have some blurring on the sides of the screen, if the shadowed rect is bigger than the current viewport?
Ariya Hidayat
Comment 3 2010-08-16 22:49:03 PDT
(In reply to comment #2) > I wounder if the clipping should be applied before adjusting the shadow rect. In that case, we might miss the case where the clip is adjacent to the shadow rect, and the shadow has a large blur radius. But I see your point. I guess when the clip region can not fully contain the enlarged shadow rect (thus, they are intersecting or reverse contained), we need to expand the resulting rect once again. I'll update the patch to reflect this situation.
Ariya Hidayat
Comment 4 2010-08-17 00:36:34 PDT
Kenneth Rohde Christiansen
Comment 5 2010-08-17 01:04:01 PDT
Comment on attachment 64556 [details] Patch Is there any performance difference with this?WebCore/platform/graphics/qt/ContextShadow.cpp:212 + why a new line here?
Ariya Hidayat
Comment 6 2010-08-17 01:07:39 PDT
(In reply to comment #5) > (From update of attachment 64556 [details]) > Is there any performance difference with this? Definitely. Some sites, e.g. http://sueddeutsche.de/ has superlarge div, several thousand pixels height, with drop shadow and blur. Without this patch, we keep using QImage as large as that while a much smaller one will do the job just fine. > WebCore/platform/graphics/qt/ContextShadow.cpp:212 > + > why a new line here? Not necessary.
Kenneth Rohde Christiansen
Comment 7 2010-08-17 01:11:10 PDT
Can this be slower in some cases as well? or is that neglectable?
Ariya Hidayat
Comment 8 2010-08-17 01:12:59 PDT
Dirk Schulze
Comment 9 2010-08-17 01:16:01 PDT
Not sure how this is called. But doesn't Qt store the current drawing of the page? So that the page doesn't need to draw on scrolling? That would mean, you just need to calculate the shadow once, and not over and over again?
Ariya Hidayat
Comment 10 2010-08-17 01:18:51 PDT
(In reply to comment #7) > Can this be slower in some cases as well? or is that neglectable? The shadow blur area is guaranteed to be the same or smaller with this patch, vs without this patch. The only possible slowdown is the clipRegion().boundingRect() calculation. But this is really nothing (=negligible) compared to the blur operations itself (the most expensive part!), thus the extra cost is really worth the benefit.
Ariya Hidayat
Comment 11 2010-08-17 01:20:35 PDT
(In reply to comment #9) > Not sure how this is called. But doesn't Qt store the current drawing of the page? So that the page doesn't need to draw on scrolling? That would mean, you just need to calculate the shadow once, and not over and over again? Do you mean the tiled backing store? It's just an optimization to reduce the painting operations, but the shadow (as with other primitives) still needs be drawn once.
Dirk Schulze
Comment 12 2010-08-17 01:23:27 PDT
(In reply to comment #11) > Do you mean the tiled backing store? It's just an optimization to reduce the painting operations, but the shadow (as with other primitives) still needs be drawn once. Yes I mean tiled backing store. But what do you mean with "still needs be drawn once.", this wouldn't affect scrolling right? Means you just have a longer calculation of the effect once? (I'm just curious)
Ariya Hidayat
Comment 13 2010-08-17 01:30:33 PDT
> Yes I mean tiled backing store. But what do you mean with "still needs be drawn once.", this wouldn't affect scrolling right? Means you just have a longer calculation of the effect once? (I'm just curious) It's just caching the page onto a set of pixmaps (=tiles) with the coverage slightly larger than the viewport. When you scroll a bit and the tiles still cover the new viewport entirely, only bitmap blit is necessary. When you scroll farther and the newly exposed area in the viewport are not covered by any of the tiles, then new tiles are generated (this is where the page is drawn, to the tiles).
Ariya Hidayat
Comment 14 2010-08-17 01:33:10 PDT
Comment on attachment 64564 [details] Patch Clearing flags on attachment: 64564 Committed r65488: <http://trac.webkit.org/changeset/65488>
Ariya Hidayat
Comment 15 2010-08-17 01:33:25 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.