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 upImplement repetition and spacing for tiled images. #972
Conversation
|
r? @kvark |
|
Sadly the test tile-repeat-prim-or-decompose.yaml which I just added fails on travis (but not on my computer) due to rounding differences. It would be great to be able to fuzz tests (my attempt at using gecko's fuzzing syntax didn't work). |
|
I just added some basic support for fuzzy reftests in wrench using the same syntax as gecko. I'll move the commit into a separate PR but just pushing it here temporarily to check that it fixes the test. |
Did you find out what exactly those differences are? |
|
Specifically - the reftests are run with OSMesa, so if you're running the reftests locally with the headless.py script, they should match exactly - and if they don't we should find out why. I'm not against adding fuzzy tests (we will need them), but in this case it'd be good to know what the cause is - since I've come across several super subtle bugs recently that caused fuzzy results. |
|
|
||
| // Decompose each vertical repetition into rows. | ||
| let layout_stride = info.stretch_size.height + info.tile_spacing.height; | ||
| let num_repetitions = (item_rect.size.width / layout_stride).ceil() as u32; |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| item_rect.size.width, | ||
| info.stretch_size.height | ||
| ).intersection(&item_rect) { | ||
| self.decompose_image_row(scroll_layer_id, context, &row_rect, item_clip, info, image_size, tile_size); |
This comment has been minimized.
This comment has been minimized.
kvark
Mar 9, 2017
Member
it's a bit weird to see decompose_image_row called from inside of this loop, since it's supposed to handle image repetitions (which is not the case for this loop, is it?)
This comment has been minimized.
This comment has been minimized.
nical
Mar 10, 2017
Author
Collaborator
It is (or maybe I misunderstand your question). decompose_image_row handles horizontal repetition (of a given row) and this loop takes care of the vertical repetition by splitting the primitive into rows.
| let layout_stride = info.stretch_size.width + info.tile_spacing.width; | ||
| let num_repetitions = (item_rect.size.width / layout_stride).ceil() as u32; | ||
| for i in 0..num_repetitions { | ||
| if let Some(img_rect) = rect( |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
nical
Mar 10, 2017
Author
Collaborator
I find column_rect a bit misleading in the sense that the rect doesn't describe an entire column of the image but just a single repetition within the current row. Granted img_rect isn't great either since it is not the rect for the entire image.
|
For the fuzzy test, if you want to have a look the easiest is to copy paste the entire log in reftest analyzer. The max difference is 1 for a lot of pixels and you can see bands of differing pixels in lines perpendicular to the stretching direction. |
|
|
|
Thanks for moving the fuzzing out to a separate PR.
I guess that's the last point of concern then. Please confirm that your headless OSmesa tests match the Travis ones. |
|
Yep, OSMesa gives me the same result on my desktop as travis (unsurprisingly). |
|
Great, thanks! |
|
|
Implement repetition and spacing for tiled images. Followup of PR #897. This should cover the all of the remaining cases when rendering tiled images (image display item specifically). If the image is tiled and repeated along the same dimension it is decomposed into a primitive for each repetition, taking spacing into account. These primitives are then split in a per tile basis. <!-- 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/972) <!-- Reviewable:end -->
|
|
nical commentedMar 8, 2017
•
edited by larsbergstrom
Followup of PR #897. This should cover the all of the remaining cases when rendering tiled images (image display item specifically).
If the image is tiled and repeated along the same dimension it is decomposed into a primitive for each repetition, taking spacing into account. These primitives are then split in a per tile basis.
This change is