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 upStore scene scale instead of scene transform #107
Closed
+21
−16
Conversation
src/rendergl.rs
Outdated
| let scaled_content_offset = self.content_offset.borrow().to_untyped() / scale; | ||
| let layer_transform = cumulative_transform.translate(scaled_content_offset.x, | ||
| scaled_content_offset.y, | ||
| 1.0); |
This comment has been minimized.
This comment has been minimized.
zwarich
Sep 11, 2014
Contributor
This seems a bit undesirable. Is there a way that things can be refactored so the scale isn't applied and then unapplied?
This comment has been minimized.
This comment has been minimized.
mrobinson
Sep 11, 2014
Author
Member
Hrm. One thing we could do is to store the contents_scale in scaled units. The issue, I think is that we need to convert to unscaled units when calculating buffer requests. Perhaps that is a better approach...
This is necessary because the renderer pre-scales the scene when applying content offset. We also store a scene scale instead of a scene transformation, so that we know how to properly deal with device pixels. Also ensures that content offset is not accumulated when rendering layers.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
mrobinson commentedSep 11, 2014
This allows the renderer to compensate for scene scale when adjusting
tile position by content offset, which is stored in device pixels.
Since the offset must be done in scaled pixels (since all layer
positioning is done with a scaling transform), the offset must be
divided by the scale before translating the transformation matrix.
This also ensures that content offset is not accumulated when rendering
layers.