Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd a ClearRectangle item type. #1929
Conversation
|
|
fdfac1e
to
a7af4aa
|
Somehow this change causes my back button's white fill to ignore the rounded clip. Will investigate. |
|
|
| @@ -385,7 +385,7 @@ impl FrameBuilder { | |||
| self.add_solid_rectangle( | |||
| clip_and_scroll, | |||
| &info, | |||
| &border.top.color, | |||
| &FillOrClear::Fill(border.top.color), | |||
This comment has been minimized.
This comment has been minimized.
kvark
Oct 26, 2017
Member
"XxxxOrYyy" pattern sounds a bit awkward to me. Perhaps, we could go with something like Fill::Color versus Fill::Clear ?
| return; | ||
| } | ||
| let prim = match operation { | ||
| &FillOrClear::Fill(ref color) => { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
mstange
Oct 28, 2017
Author
Contributor
I went with this suggestion, RectangleContent::Fill/Clear. Thanks!
| &FillOrClear::Fill(ref color) => { | ||
| // Don't add transparent rectangles to the draw list, but do consider them for hit | ||
| // testing. This allows specifying invisible hit testing areas. | ||
| if color.a == 0.0 { |
This comment has been minimized.
This comment has been minimized.
kvark
Oct 26, 2017
Member
should probably move this condition up into the matching, maybe even turn it into an if/let i.e.
if let &FillOrClear::Fill(ColorF{a: 0.0, ..}) = operation {
(something something return)
}
let prim = RectanglePrimitive { operation: *operation };|
I've addressed the comments. I added a TODO for the missing optimization but didn't address it. I suppose I could make r? @glennw |
|
A couple of minor changes, otherwise this looks great! |
| } | ||
| } | ||
| SpecificDisplayItem::ClearRectangle => { | ||
| if !self.try_to_add_rectangle_splitting_on_clip( |
This comment has been minimized.
This comment has been minimized.
glennw
Oct 29, 2017
Member
Let's not bother trying to split clear rectangles - we can just directly call add_solid_rectangle here.
| @@ -138,6 +138,7 @@ pub struct PrimitiveMetadata { | |||
| pub cpu_prim_index: SpecificPrimitiveIndex, | |||
| pub gpu_location: GpuCacheHandle, | |||
| pub clip_task_id: Option<RenderTaskId>, | |||
| pub is_clear: bool, | |||
This comment has been minimized.
This comment has been minimized.
glennw
Oct 29, 2017
Member
This should be in the RectanglePrimitive type since it's not common to all primitives.
This comment has been minimized.
This comment has been minimized.
mstange
Oct 29, 2017
Author
Contributor
How do I get access to the RectanglePrimitive inside get_blend_mode?
This comment has been minimized.
This comment has been minimized.
glennw
Oct 30, 2017
Member
Something like:
let rect = &self.cpu_rectangles[metadata.cpu_prim_index.0];
should work. The TextRun primitive in the same function does something similar.
This comment has been minimized.
This comment has been minimized.
|
|
|
I've addressed the comments. |
|
r? @glennw |
|
@bors-servo r+ I think the opacity type for a clear rectangle does work - we can easily change it if required, since this is a new interface. It would be good to add some wrench reftests as a follow up. |
|
|
|
|
|
|
|
Rebased. r? @glennw |
|
@bors-servo r+ |
|
|
Add a ClearRectangle item type. Fixes #1926. I haven't extensively tested this yet. This draws ClearRectangle items as Rectangle primitives with opaque black and operator destination out. I'm not really sure how to optimize the case where we don't need blending, because the color is set on the primitive before we decide how to blend it. But if there's no blending, we need to set the color to transparent black instead of opaque black. <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/webrender/1929) <!-- Reviewable:end -->
|
|
mstange commentedOct 24, 2017
•
edited by larsbergstrom
Fixes #1926.
I haven't extensively tested this yet. This draws ClearRectangle items as Rectangle primitives with opaque black and operator destination out.
I'm not really sure how to optimize the case where we don't need blending, because the color is set on the primitive before we decide how to blend it. But if there's no blending, we need to set the color to transparent black instead of opaque black.
This change is