Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store scene scale instead of scene transform #107

Closed
wants to merge 1 commit into from

Conversation

@mrobinson
Copy link
Member

mrobinson commented Sep 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.

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.

@zwarich

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.

@mrobinson

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.
@mrobinson mrobinson force-pushed the mrobinson:scrolling branch from a16adb3 to 755f2b8 Sep 12, 2014
@mrobinson mrobinson closed this Sep 12, 2014
@mrobinson mrobinson deleted the mrobinson:scrolling branch Sep 12, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.