Closed
Bug 1345907
Opened 8 years ago
Closed 8 years ago
Add WebRender bindings for ClipRegion
Categories
(Core :: Graphics: WebRender, enhancement)
Core
Graphics: WebRender
Tracking
()
RESOLVED
FIXED
mozilla55
People
(Reporter: rhunt, Assigned: rhunt)
References
Details
(Whiteboard: [gfx-noted])
Attachments
(2 files)
12.13 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
38.34 KB,
patch
|
kats
:
review+
|
Details | Diff | Splinter Review |
Only simple ClipRegions are supported by bindings. We should expose the full ClipRegion interface.
Assignee | ||
Comment 1•8 years ago
|
||
This adds ClipRegion to the bindings, but doesn't hook it up for DisplayList construction.
An ugly part of this patch that I am up for suggestions on is the representation of Option<ImageMask> in the ClipRegion bindings. I don't think that Maybe<T> is guaranteed to be compatible with Option<T>, so I chose to use a bool flag explictly.
Attachment #8845508 -
Flags: review?(bugmail)
Assignee | ||
Comment 2•8 years ago
|
||
This patch switches DisplayList construction to use WrClipRegion instead of a WrRect.
The only two parts that weren't converted were PushStackingContext and PushScrollLayer as they aren't trivial conversions.
Attachment #8845511 -
Flags: review?(bugmail)
Assignee | ||
Comment 3•8 years ago
|
||
Comment 4•8 years ago
|
||
Comment on attachment 8845508 [details] [diff] [review]
clip_region-1.patch
Review of attachment 8845508 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/webrender_bindings/WebRenderAPI.cpp
@@ +583,5 @@
> +{
> + return wr_dp_new_clip_region(mWrState,
> + aMain,
> + nullptr, 0,
> + nullptr);
This last nullptr should be aMask
::: gfx/webrender_bindings/src/bindings.rs
@@ +918,5 @@
> + start: self.start,
> + length: self.length,
> + }
> + }
> + fn from_item_range(item_range: ItemRange) -> WrItemRange
This doesn't matter much but I think it would be more idiomatic Rust to implement these "from" methods as From trait implementations - https://doc.rust-lang.org/std/convert/trait.From.html
So you'd do:
impl From<ItemRange> for WrItemRange {
pub fn from(item_range: ItemRange) -> Self {
...
}
}
That should allow you to implicitly convert from ItemRange to WrItemRange in places, without having to explicitly call from_item_range.
Attachment #8845508 -
Flags: review?(bugmail) → review+
Comment 5•8 years ago
|
||
(In reply to Ryan Hunt [:rhunt] from comment #1)
> An ugly part of this patch that I am up for suggestions on is the
> representation of Option<ImageMask> in the ClipRegion bindings. I don't
> think that Maybe<T> is guaranteed to be compatible with Option<T>, so I
> chose to use a bool flag explictly.
I think the way you did it is good (and safe). I agree that we shouldn't assume Maybe<T> is compatible with Option<T>.
Comment 6•8 years ago
|
||
Comment on attachment 8845511 [details] [diff] [review]
clip_region-2.patch
Review of attachment 8845511 [details] [diff] [review]:
-----------------------------------------------------------------
::: gfx/webrender_bindings/WebRenderAPI.cpp
@@ +582,5 @@
> {
> return wr_dp_new_clip_region(mWrState,
> aMain,
> nullptr, 0,
> + aMask);
Oh here it is :)
Attachment #8845511 -
Flags: review?(bugmail) → review+
Pushed by rhunt@eqrion.net:
https://hg.mozilla.org/projects/graphics/rev/b5e63c017148
Add bindings for ClipRegion r=kats
https://hg.mozilla.org/projects/graphics/rev/e659fa15902a
Use clip region instead of clip rect r=kats
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 8•8 years ago
|
||
(In reply to Kartikaya Gupta (email:kats@mozilla.com) from comment #6)
> Comment on attachment 8845511 [details] [diff] [review]
> clip_region-2.patch
>
> Review of attachment 8845511 [details] [diff] [review]:
> -----------------------------------------------------------------
>
> ::: gfx/webrender_bindings/WebRenderAPI.cpp
> @@ +582,5 @@
> > {
> > return wr_dp_new_clip_region(mWrState,
> > aMain,
> > nullptr, 0,
> > + aMask);
>
> Oh here it is :)
Ah, histedit fail. I fixed this in the patch I push.
Comment 9•8 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/b5e63c017148
https://hg.mozilla.org/mozilla-central/rev/e659fa15902a
Target Milestone: --- → mozilla55
You need to log in
before you can comment on or make changes to this bug.
Description
•