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 upFix drop-shadow render incorrectly on viewport's edge. #2243
Conversation
|
Gecko try here, the long-chain.html get fixed after apply this patch. We can replace the fails-if in long-chain.html with fuzzy value. |
|
Nice fix! |
| @@ -232,7 +234,7 @@ impl PicturePrimitive { | |||
| let local_content_rect = prim_run_rect.local_rect_in_actual_parent_space; | |||
|
|
|||
| match self.kind { | |||
| PictureKind::Image { composite_mode, ref mut real_local_rect, .. } => { | |||
| PictureKind::Image { composite_mode, ref mut real_local_rect, ref mut content_rect, .. } => { | |||
This comment has been minimized.
This comment has been minimized.
kvark
Dec 20, 2017
Member
would it (possibly, in the future) make sense outside of FilterOp::DropShadow? If not, we may move it inside the DropShadow variant for clarity.
| @@ -350,13 +353,20 @@ impl PicturePrimitive { | |||
| let blur_render_task_id = render_tasks.add(blur_render_task); | |||
| self.render_task_id = Some(blur_render_task_id); | |||
| } | |||
| Some(PictureCompositeMode::Filter(FilterOp::DropShadow(offset, blur_radius, color))) => { | |||
| Some(PictureCompositeMode::Filter(FilterOp::DropShadow(_, blur_radius, color))) => { | |||
| let content_width = | |||
This comment has been minimized.
This comment has been minimized.
kvark
Dec 20, 2017
Member
perhaps, we can just do this one liner instead?
let rect = (content_rect * TypedScale::<_, DevicePixel>::new(prim_context.device_pixel_ratio).round().to_i32();@glennw btw, I think it would make sense to just store the device_pixel_ratio as that TypedScale in the first place
| local_content_rect.inflate(inflate_size, inflate_size) | ||
| .translate(&offset) | ||
| *content_rect = local_content_rect.inflate(inflate_size, inflate_size); | ||
| content_rect.translate(&offset) |
This comment has been minimized.
This comment has been minimized.
kvark
Dec 20, 2017
Member
Note that technically you can apply the translation later, at the last moment.
This would allow you to merge those match arms, since you only need the blur_radius out of both to inflate the rect
| @@ -775,17 +776,19 @@ fn add_to_batch( | |||
| secondary_textures, | |||
| ); | |||
| let batch = batch_list.get_suitable_batch(key, &item_bounding_rect); | |||
| let device_offset_x = device_length(offset.x, ctx.device_pixel_ratio); | |||
| let device_offset_y = device_length(offset.y, ctx.device_pixel_ratio); | |||
| let content_origin_x = device_length(content_rect.origin.x, ctx.device_pixel_ratio); | |||
This comment has been minimized.
This comment has been minimized.
|
Looks good to me once @kvark 's concerns are addressed. |
|
Review status: 0 of 9 files reviewed at latest revision, 4 unresolved discussions. webrender/src/picture.rs, line 237 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/picture.rs, line 248 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/picture.rs, line 357 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. webrender/src/tiling.rs, line 779 at r1 (raw file): Previously, kvark (Dzmitry Malyshau) wrote…
Done. Comments from Reviewable |
|
Reviewed 3 of 5 files at r1, 6 of 6 files at r2. webrender/src/picture.rs, line 248 at r1 (raw file): Previously, mephisto41 (Morris Tseng) wrote…
Sorry for being unclear, this is not exactly what I meant. By "later" I mean at the time where it's used (in webrender/src/picture.rs, line 357 at r1 (raw file): Previously, mephisto41 (Morris Tseng) wrote…
Please note that I went and refactored most of the device/pixel ratio logic to have some type safety in #2246. Sorry about the need for rebase on that! If this PR was ready, I'd gladly yield and rebase on top. Comments from Reviewable |
|
|
|
I think this is ready to merge once rebased @kvark @mephisto41 ? |
|
It has 1 nit should be fixed. I'll fix it today. |
233becd
to
5cc0b8a
|
Reviewed 4 of 4 files at r3. webrender/src/prim_store.rs, line 1750 at r3 (raw file):
can this be done inside Comments from Reviewable |
|
I made some significant change here. Since I realized that the |
|
|
|
Reviewed 3 of 7 files at r4. Comments from Reviewable |
|
Thank you! |
|
|
Fix drop-shadow render incorrectly on viewport's edge. Initially, I apply the drop-shadow's offset before render the blur result. This has problem if the blur is close to edge of viewport because the blur result might be crop by the viewport. This patch apply the offset after the blur result generated. Fix #2197. <!-- 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/2243) <!-- Reviewable:end -->
|
|
|
Ah, since the PR got largely rewritten, could you fire up another try push please? |
|
|
Initially, I apply the drop-shadow's offset before render the blur result. This has problem if the blur is close to edge of viewport because the blur result might be crop by the viewport. This patch apply the offset after the blur result generated.
|
There is an R7 in |
|
See the comment 1 for explanation. Before this patch, the long-chain test is completely wrong so we set fails-if for it. After this patch, you can see that I removed the fails-if annotation in the try and the long-chain result is correct although we need tweak some fuzzy value for it. So the long-chain failure is expected. Just some fuzzy value change is fine. |
|
Thanks! |
|
|
Fix drop-shadow render incorrectly on viewport's edge. Initially, I apply the drop-shadow's offset before render the blur result. This has problem if the blur is close to edge of viewport because the blur result might be crop by the viewport. This patch apply the offset after the blur result generated. Fix #2197. <!-- 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/2243) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
Fix drop-shadow render incorrectly on viewport's edge. Initially, I apply the drop-shadow's offset before render the blur result. This has problem if the blur is close to edge of viewport because the blur result might be crop by the viewport. This patch apply the offset after the blur result generated. Fix #2197. <!-- 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/2243) <!-- Reviewable:end -->
|
|
|
@bors-servo retry |
Fix drop-shadow render incorrectly on viewport's edge. Initially, I apply the drop-shadow's offset before render the blur result. This has problem if the blur is close to edge of viewport because the blur result might be crop by the viewport. This patch apply the offset after the blur result generated. Fix #2197. <!-- 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/2243) <!-- Reviewable:end -->
|
|
mephisto41 commentedDec 20, 2017
•
edited by larsbergstrom
Initially, I apply the drop-shadow's offset before render the blur
result. This has problem if the blur is close to edge of
viewport because the blur result might be crop by the viewport.
This patch apply the offset after the blur result generated.
Fix #2197.
This change is