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

Use signed arithmetic to avoid underflow when shrinking window. #243

Merged
merged 1 commit into from Mar 29, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -1137,8 +1137,8 @@ impl Renderer {
self.device.bind_render_target(layer.texture_id);

// TODO(gw): This may not be needed in all cases...
let layer_origin = Point2D::new((layer.origin.x * self.device_pixel_ratio).round() as u32,
(layer.origin.y * self.device_pixel_ratio).round() as u32);
let layer_origin = Point2D::new((layer.origin.x * self.device_pixel_ratio).round() as gl::GLint,
(layer.origin.y * self.device_pixel_ratio).round() as gl::GLint);

let layer_size = Size2D::new((layer.size.width * self.device_pixel_ratio).round() as u32,
(layer.size.height * self.device_pixel_ratio).round() as u32);
@@ -1148,21 +1148,21 @@ impl Renderer {
layer_origin
}
None => {
let inverted_y0 = render_context.framebuffer_size.height -
layer_size.height -
let inverted_y0 = render_context.framebuffer_size.height as gl::GLint -
layer_size.height as gl::GLint -
layer_origin.y;

Point2D::new(layer_origin.x, inverted_y0)
}
};

gl::scissor(layer_origin.x as gl::GLint,
layer_origin.y as gl::GLint,
gl::scissor(layer_origin.x,
layer_origin.y,
layer_size.width as gl::GLint,
layer_size.height as gl::GLint);

gl::viewport(layer_origin.x as gl::GLint,
layer_origin.y as gl::GLint,
gl::viewport(layer_origin.x,
layer_origin.y,
layer_size.width as gl::GLint,
layer_size.height as gl::GLint);
let clear_color = if layer.texture_id.is_some() {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.