Bug 35544 - [OpenVG] Use masks to implement non-rectilinear clipping
Summary: [OpenVG] Use masks to implement non-rectilinear clipping
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 33987
  Show dependency treegraph
 
Reported: 2010-03-01 14:03 PST by Jakob Petsovits
Modified: 2010-03-12 23:02 PST (History)
4 users (show)

See Also:


Attachments
Patch (13.44 KB, patch)
2010-03-01 14:05 PST, Jakob Petsovits
krit: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jakob Petsovits 2010-03-01 14:03:51 PST
Rectilinear regions (a.k.a. upright rectangles) can be clipped in OpenVG using its scissoring functionality. For all other shapes (i.e. paths and rotated rectangles), we want mask clipping instead. Only OpenVG >= 1.1 provides the required functions for managing masks, so all the masking code in this patch is put into an #ifdef.

Mask layers (which are bitmaps of 1 or 8 bit depth per pixel) are a bit hairy because, unlike the other state that we're keeping track of, they can't easily be captured like colors, boolean enable-blah values, or stuff. Also, OpenVG implementations can optimize on the plain bitmap concept by storing masks and mask layers as set of paths. So we don't really want to read out mask layers in memory for context state storage, we keep them as native VGMaskLayer. That requires us to make sure the correct surface is current when the painter state is stored (which we didn't ensure before) so a bit of surface management code is added here as well.

vgRenderToMask() is affected by the current OpenVG path transformation, so we don't have to manually transform the path like we do for scissor rectangles. PainterOpenVG restricts the clipping modes to Intersect and Subtract, because additive clipping a.k.a. removing clip regions would require too much (and unnecessary) overhead for scissor rectangles which would need to be "unclipped" as well. Right now PainterOpenVG can only add clips but never remove them (except with restore()), and that's in line with GraphicsContext's functionality.
Comment 1 Jakob Petsovits 2010-03-01 14:05:54 PST
Created attachment 49749 [details]
Patch
Comment 2 Dirk Schulze 2010-03-09 11:21:27 PST
Comment on attachment 49749 [details]
Patch

lgtm r=me
Comment 3 Jakob Petsovits 2010-03-12 11:25:49 PST
Committed r55922: <http://trac.webkit.org/changeset/55922>
Comment 4 Eric Seidel (no email) 2010-03-12 18:17:29 PST
This appears to have broken the Gtk build:
http://build.webkit.org/builders/GTK%20Linux%2064-bit%20Debug/builds/3889
Comment 5 Dirk Schulze 2010-03-12 22:35:59 PST
(In reply to comment #4)
> This appears to have broken the Gtk build:
> http://build.webkit.org/builders/GTK%20Linux%2064-bit%20Debug/builds/3889

How? There is no core code touched and also no Gtk code. Only files in the openvg folder.
Comment 6 Dirk Schulze 2010-03-12 23:02:27 PST
(In reply to comment #4)
> This appears to have broken the Gtk build:
> http://build.webkit.org/builders/GTK%20Linux%2064-bit%20Debug/builds/3889

http://trac.webkit.org/changeset/55927 broke the gtk bots.