Bug 115743

Summary: shrink repaint rectangle when clip was applied to canvas.
Product: WebKit Reporter: arno. <a.renevier>
Component: CanvasAssignee: arno. <a.renevier>
Status: NEW ---    
Severity: Normal CC: bfulgham, buildbot, dino, etienne, krit, rniwa, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
patch proposal
none
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion
none
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2
none
updated patch: update test expectation for mac platform beidson: review-

Description arno. 2013-05-07 11:15:10 PDT
Hi,
currently, when an operation is performed on the canvas, the enclosing rect is repainted.
But when a clip is applied to the canvas, we could shrink the rectangle to the clipped area, and decrease the repainted area.
We have GraphicsContext::clipBounds which returns us the an enclosing rectangle of the clipped area. So we could use that rectangle, and intersect it with the dirtyRect in CanvasRenderingContext2D::didDraw
Comment 1 arno. 2013-05-07 11:36:33 PDT
Created attachment 200949 [details]
patch proposal

In order to avoid creating an IntRect, converting it to FloatRect with enclosingIntRect and converting it back to a FloatRect, I implemented intClipBounds and floatClipBounds. I was wondering if it would be better to use templates to define two methods: <IntRect>clipBounds and <FloatRect>clipBounds, but then it would have forced us to write stuffs such as IntRect r = context->clipBounds<IntRect>()
Comment 2 Build Bot 2013-05-07 15:08:33 PDT
Comment on attachment 200949 [details]
patch proposal

Attachment 200949 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/338203

New failing tests:
fast/repaint/canvas-clip.html
Comment 3 Build Bot 2013-05-07 15:08:34 PDT
Created attachment 200984 [details]
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-04  Port: mac-mountainlion  Platform: Mac OS X 10.8.2
Comment 4 Build Bot 2013-05-07 16:42:18 PDT
Comment on attachment 200949 [details]
patch proposal

Attachment 200949 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.appspot.com/results/339221

New failing tests:
fast/repaint/canvas-clip.html
css3/filters/custom/filter-fallback-to-software.html
Comment 5 Build Bot 2013-05-07 16:42:19 PDT
Created attachment 200993 [details]
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: webkit-ews-16  Port: mac-mountainlion-wk2  Platform: Mac OS X 10.8.2
Comment 6 arno. 2013-05-07 16:54:49 PDT
Created attachment 200996 [details]
updated patch: update test expectation for mac platform
Comment 7 Brady Eidson 2016-05-24 21:38:22 PDT
Comment on attachment 200996 [details]
updated patch: update test expectation for mac platform

r- to clear stale patches from the review queue
Comment 8 Radar WebKit Bug Importer 2022-07-18 15:17:49 PDT
<rdar://problem/97222964>