Bug 18840 - [CAIRO] Clipping-support for SVG
Summary: [CAIRO] Clipping-support for SVG
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC All
: P2 Normal
Assignee: Nobody
URL:
Keywords: Cairo
Depends on:
Blocks:
 
Reported: 2008-05-02 05:57 PDT by Dirk Schulze
Modified: 2008-06-08 13:37 PDT (History)
1 user (show)

See Also:


Attachments
Clipping in SVG/Cairo (1.78 KB, patch)
2008-05-02 06:06 PDT, Dirk Schulze
no flags Details | Formatted Diff | Diff
Fixed transformation (1.30 KB, patch)
2008-05-04 01:31 PDT, Dirk Schulze
no flags Details | Formatted Diff | Diff
Clipping in SVG/Cairo (3.44 KB, patch)
2008-05-17 12:58 PDT, Dirk Schulze
eric: review-
Details | Formatted Diff | Diff
Clipping in SVG/Cairo (3.52 KB, patch)
2008-06-07 00:09 PDT, Dirk Schulze
eric: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dirk Schulze 2008-05-02 05:57:19 PDT
There is allready support for Clip in SVG/Cairo, with problems: 

1. If you have a clip with more than one path, GraphicsContextCairo makes a intersection instead of a union.
http://svg.tutorial.aptico.de/grafik_svg/kap14_1.svg

2. Wrong transformation of skewX and skewY (could be more problems).
http://apike.ca/prog_svg_clip.html

2. No animation-support for Clipping
Comment 1 Dirk Schulze 2008-05-02 06:06:43 PDT
Created attachment 20922 [details]
Clipping in SVG/Cairo

The first problem is caused by GraphicsContext. After each insertion of a path, the clip is created and directly drawn to cairo_t.

This patch draw the clipping at the end of insertion of paths.
Comment 2 Dirk Schulze 2008-05-04 01:31:25 PDT
Created attachment 20956 [details]
Fixed transformation

This patch fixes transformation of paths (first point 2).
Comment 3 Dirk Schulze 2008-05-12 10:51:50 PDT
The second point 2 is a problem of animation and localization and affects any animation, not only clipping. If you use e.g. en_US it works, with de_DE or it_IT as language-setting it won't work (export LANG="de_DE.UTF-8").
Comment 4 Dirk Schulze 2008-05-17 12:58:45 PDT
Created attachment 21216 [details]
Clipping in SVG/Cairo

This patch corrects a bug in the previous patch and combines the fixes on clipping and path-transformation.

Furthermore the code keeps with the Cg-implementation for a better code-reading.
Comment 5 Eric Seidel (no email) 2008-06-06 10:11:16 PDT
Comment on attachment 21216 [details]
Clipping in SVG/Cairo

I'm not sure I understand the matrix changes for path.

And why would you want to reset the clip every time you enter applyClip, even if there is no clip to apply?  Seems like the early-return when there is no clip could be before the clip-reset.
Comment 6 Dirk Schulze 2008-06-07 00:09:42 PDT
Created attachment 21546 [details]
Clipping in SVG/Cairo

Made the matrix changes more effective (the inverting is still necessary) and moved cairo_clip_reset() behind the return.
Comment 7 Eric Seidel (no email) 2008-06-07 03:37:35 PDT
Comment on attachment 21546 [details]
Clipping in SVG/Cairo

Looks fine.
Comment 8 Darin Adler 2008-06-08 13:37:25 PDT
Committed revision 34454.