Bug 115743 - shrink repaint rectangle when clip was applied to canvas.
Summary: shrink repaint rectangle when clip was applied to canvas.
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: arno.
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-07 11:15 PDT by arno.
Modified: 2016-05-24 21:38 PDT (History)
5 users (show)

See Also:


Attachments
patch proposal (13.75 KB, patch)
2013-05-07 11:36 PDT, arno.
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-04 for mac-mountainlion (864.98 KB, application/zip)
2013-05-07 15:08 PDT, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-16 for mac-mountainlion-wk2 (534.81 KB, application/zip)
2013-05-07 16:42 PDT, Build Bot
no flags Details
updated patch: update test expectation for mac platform (14.33 KB, patch)
2013-05-07 16:54 PDT, arno.
beidson: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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