Skip to content

Commit

Permalink
Fix 3d transform primitives where the task offset is non-zero.
Browse files Browse the repository at this point in the history
Fixes servo#2133.
  • Loading branch information
gw3583 committed Jan 3, 2018
1 parent 3c71e4c commit cacd654
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion webrender/res/prim_shared.glsl
Expand Up @@ -648,7 +648,7 @@ VertexInfo write_transform_vertex(RectWithSize local_segment_rect,
// We also want that to apply to any interpolators. However, we
// want a constant Z across the primitive, since we're using it
// for draw ordering - so scale by the W coord to ensure this.
vec4 final_pos = vec4(world_pos.xy * uDevicePixelRatio + task_offset,
vec4 final_pos = vec4((device_pos + task_offset) * world_pos.w,
z * world_pos.w,
world_pos.w);
gl_Position = uTransform * final_pos;
Expand Down
Binary file added wrench/reftests/transforms/content-offset.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
16 changes: 16 additions & 0 deletions wrench/reftests/transforms/content-offset.yaml
@@ -0,0 +1,16 @@
---
root:
items:
-
type: "stacking-context"
perspective: 1000
items:
-
type: "stacking-context"
transform: rotate-x(45) translate(100, 100, 0)
"transform-style": "preserve-3d"
items:
-
bounds: [0, 0, 200, 200]
type: rect
color: red
Binary file modified wrench/reftests/transforms/perspective.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion wrench/reftests/transforms/reftest.list
Expand Up @@ -5,6 +5,8 @@
# but fails when all the tests are run
fuzzy(1,2) == rotated-image.yaml rotated-image.png
== singular.yaml singular-ref.yaml
fuzzy(1,82) == perspective.yaml perspective.png
fuzzy(1,88) == perspective.yaml perspective.png
== prim-suite.yaml prim-suite.png
== segments-bug.yaml segments-bug-ref.yaml
== content-offset.yaml content-offset.png

0 comments on commit cacd654

Please sign in to comment.