RESOLVED FIXED77582
[Chromium] Use the current clip when marking paints as opaque
https://bugs.webkit.org/show_bug.cgi?id=77582
Summary [Chromium] Use the current clip when marking paints as opaque
Dana Jansens
Reported 2012-02-01 16:26:19 PST
[Chromium] Use the current clip when marking paints as opaque
Attachments
Patch (8.56 KB, patch)
2012-02-01 16:30 PST, Dana Jansens
no flags
Patch (8.52 KB, patch)
2012-02-02 23:28 PST, Dana Jansens
no flags
Dana Jansens
Comment 1 2012-02-01 16:30:05 PST
Dana Jansens
Comment 2 2012-02-01 16:31:54 PST
Dana Jansens
Comment 3 2012-02-01 16:35:04 PST
Summary: gmail was painting the rounded box with drop shadow by applying a complex clip and filling a rect. The clip was not being considered and the opaque rect was being tracked without it. Solution: for rect clips, intersect the paint rect with the clip. for more complex clips, it's not worth doing anything so don't track the paint.
Stephen White
Comment 4 2012-02-02 10:17:08 PST
Comment on attachment 125040 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=125040&action=review > Source/WebCore/platform/graphics/skia/PlatformContextSkia.h:154 > + SkCanvas* canvas() const { return m_canvas; } I'm a fan of constness being transitive, if possible (although it's not in the WebKit coding style). If you can deal with a const SkCanvas* at your call site, you should provide two accessors here: one const method that returns a const SkCanvas*, and one non-const accessor that returns a non-const SkCanvas*. Then constness is transitively preserved.
Dana Jansens
Comment 5 2012-02-02 13:01:04 PST
Yep that should be fine. I like the idea too.
Dana Jansens
Comment 6 2012-02-02 23:28:18 PST
Created attachment 125272 [details] Patch - const the canvas pointer with a 2nd accessor @senorblanco can you be reviewer for this?
Stephen White
Comment 7 2012-02-03 07:07:46 PST
Comment on attachment 125272 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=125272&action=review Looks good as-is; the FYI is optional. r=me > Source/WebCore/platform/graphics/skia/OpaqueRegionSkia.cpp:260 > + SkIRect deviceClip; > + context->canvas()->getClipDeviceBounds(&deviceClip); > + SkRect rect = paintRect; > + if (!rect.intersect(SkIntToScalar(deviceClip.fLeft), SkIntToScalar(deviceClip.fTop), SkIntToScalar(deviceClip.fRight), SkIntToScalar(deviceClip.fBottom))) FYI, you could also do something like this: SkIRect deviceIClip; context->canvas()->getClipDeviceBounds(&deviceIClip); SkRect deviceClip; deviceClip.set(deviceIClip); if (!rect.intersect(deviceClip)) ... Not shorter in line count, but it does save you doing all those SkIntToScalars yourself.
Dana Jansens
Comment 8 2012-02-03 07:12:50 PST
Comment on attachment 125272 [details] Patch thanks! i thought about doing the set() but opted for skipping another local variable in this case.
WebKit Review Bot
Comment 9 2012-02-03 08:28:15 PST
Comment on attachment 125272 [details] Patch Clearing flags on attachment: 125272 Committed r106663: <http://trac.webkit.org/changeset/106663>
WebKit Review Bot
Comment 10 2012-02-03 08:28:22 PST
All reviewed patches have been landed. Closing bug.
Antoine Labour
Comment 11 2012-02-03 13:32:08 PST
Note You need to log in before you can comment on or make changes to this bug.