WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
5748
KCanvas needs to be redesigned to fill & stroke at once
https://bugs.webkit.org/show_bug.cgi?id=5748
Summary
KCanvas needs to be redesigned to fill & stroke at once
Eric Seidel (no email)
Reported
2005-11-15 00:47:38 PST
KCanvas needs to be redesigned to fill & stroke at once Currently KCanvas fills and strokes paths in separate operations. This makes for awkward code in the various draw() (or paint()) methods, and slower-than-necessary CG performance. Take for example this code from RenderPath::paint() (previously KCanvasItem::draw()): // Fill and stroke as needed. if(canvasStyle()->isFilled()) { CGContextAddPath(context, cgPath); canvasStyle()->fillPainter()->draw(quartzContext, args); } if(canvasStyle()->isStroked()) { CGContextAddPath(context, cgPath); // path is cleared when filled. canvasStyle()->strokePainter()->draw(quartzContext, args); }
Attachments
move paintserver/draw from fill/stroke painters into the callers
(19.69 KB, patch)
2006-01-06 15:02 PST
,
Alexander Kellett
eric
: review-
Details
Formatted Diff
Diff
broken patch
(23.79 KB, patch)
2006-01-07 21:09 PST
,
Alexander Kellett
eric
: review-
Details
Formatted Diff
Diff
new renderstyle refactor - compiling, taking in most of previous suggestions with exception of static's and shared solid/image painter
(29.04 KB, patch)
2006-01-08 12:30 PST
,
Alexander Kellett
eric
: review-
Details
Formatted Diff
Diff
take the time to cleanup the code while refactoring on suggestion from macdome
(31.46 KB, patch)
2006-01-08 14:26 PST
,
Alexander Kellett
eric
: review-
Details
Formatted Diff
Diff
renderstyle refactors, final patch
(32.23 KB, patch)
2006-01-09 02:46 PST
,
Alexander Kellett
eric
: review+
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Eric Seidel (no email)
Comment 1
2005-11-15 00:48:51 PST
This could be done by changing the fill and stroke painters to have "setup" and "teardown" methods instead of draw(), where you could just have them change the context state accordingly, and then actually do the drawing elsewhere.
Eric Seidel (no email)
Comment 2
2005-12-12 23:00:37 PST
Basically the fill and paint servers should be removed. The paint servers should have setup and tear-down methods. KCanvasRenderingStyle should also be killed at the same time.
Alexander Kellett
Comment 3
2006-01-06 15:02:37 PST
Created
attachment 5516
[details]
move paintserver/draw from fill/stroke painters into the callers
Eric Seidel (no email)
Comment 4
2006-01-06 19:08:19 PST
Comment on
attachment 5516
[details]
move paintserver/draw from fill/stroke painters into the callers We talked online. Although this is a good patch, I think that it makes more sense (in terms of process overhead) to go a bit further along the removal process first. I encoruaged Alexander to take the approache of just removing all the set* methods on KCanvasRenderingStyle and making all of the get methods dynamically compute/lookup, etc. all the necessary info. That way none of the callers have to change (more than they have in this patch), but KCanvasRenderingStyle becomes a complete no-op and we can get rid of more of this uncessary code in one fell swoop. I also encoruaged alexander to make sure that he posts layout test changes, and is sure to test with --leaks.
Alexander Kellett
Comment 5
2006-01-07 21:09:40 PST
Created
attachment 5536
[details]
broken patch
Eric Seidel (no email)
Comment 6
2006-01-07 22:32:04 PST
Comment on
attachment 5536
[details]
broken patch A few comments: RenderPath::setupForDraw() should now be part of draw. If something needs to fill, it fetches it's paint server, it sets the active client (that will go away after my next patch) and then paints with that paint server. fillPaintServer should be a static method: canvasStyle()->fillPaintServer(style(), this) KCanvasRenderingStyle::fillPaintServer(style(), getDocument()) fillPaintServer(), strokePaintServer() shoudl return *shared* instances for solid and image paint servers. In fact, PaintServerImage is slated to die, it just hasn't yet. disableFillPainter() and disableStrokePainter() should no longer be necessary.
Alexander Kellett
Comment 7
2006-01-08 12:30:30 PST
Created
attachment 5551
[details]
new renderstyle refactor - compiling, taking in most of previous suggestions with exception of static's and shared solid/image painter
Eric Seidel (no email)
Comment 8
2006-01-08 13:09:49 PST
Comment on
attachment 5551
[details]
new renderstyle refactor - compiling, taking in most of previous suggestions with exception of static's and shared solid/image painter We dicussed a few minor things over IRC. This patch in general looks fabulous. A couple reminders: 1. ChangeLog entry should be included in your final patch 2. Make sure you update the copyright on any files you touch. 3. Please post a (separate) patch containing the expected changes to the layout tests. 4. Also, if you think this could in any way affect normal rendering, please post (a) new layout test(s) demonstrating those changes.
Alexander Kellett
Comment 9
2006-01-08 14:26:46 PST
Created
attachment 5555
[details]
take the time to cleanup the code while refactoring on suggestion from macdome
Eric Seidel (no email)
Comment 10
2006-01-08 14:48:01 PST
Comment on
attachment 5555
[details]
take the time to cleanup the code while refactoring on suggestion from macdome Again, looks great. A couple comments: No need to check canvasStyle() or path() first, just have: KRenderingPaintServer *fillPaintServer = canvasStyle()->fillPaintServer(canvasStyle()->renderStyle(), this); and then check if non-null, if non-null, setActiveClient(this) and draw() overrideFillPaintServer overrideStrokePaintServer shoudl assume type IMAGE, and shoudl ASSERT that the passed in paint server is of that type. Also, I woudl encourage you to land a // FIXME: right next to those functions describing how they were going away. Otherwise this looks great. You had mentioned there was a laytou test regression wrt Images. We'll wait to land until that's fixed.
Alexander Kellett
Comment 11
2006-01-09 02:46:41 PST
Created
attachment 5565
[details]
renderstyle refactors, final patch
Eric Seidel (no email)
Comment 12
2006-01-09 02:57:58 PST
Comment on
attachment 5565
[details]
renderstyle refactors, final patch This patch is absolutely beyond words wonderful. Soooo much ugly code: all gone! r=me.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug