Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upCanvas's don't necessarily draw right-side-up. #252
Comments
icefoxen
added
bug
Type-CODE
labels
Jan 10, 2018
icefoxen
added
the
*GOOD FIRST ISSUE*
label
Feb 24, 2018
This comment has been minimized.
This comment has been minimized.
|
They totally don't draw right-side up, sigh. And fixing that means they flip on awkward axes for some stupid reason. I suspect the exciting stuff happens on The following code makes impl Drawable for Canvas {
fn draw_ex(&self, ctx: &mut Context, param: DrawParam) -> GameResult<()> {
let mut flipped_param = param;
flipped_param.scale.y *= -1.0;
flipped_param.dest.y += self.image.height() as f32 / 2.0;
self.image.draw_ex(ctx, flipped_param)
}
...
} |
This comment has been minimized.
This comment has been minimized.
|
Hmm. I think this could be caused by a coordinate transformation happening twice. IIRC: we do the first coordinate transformation when we draw onto the canvas by making it have "top left = 0,0 with pixel coordinates", then we apply that same transformation again when drawing the canvas onto the main render target. Perhaps we should disable the first set of coordinate transformations for canvases. I've only thought about this for a couple minutes and haven't been in the ggez world for a little while but this is what I suspect is the root cause of the issue. |
LaylConway
referenced this issue
Mar 9, 2018
Closed
Weird behavior when enabling anti aliasing on canvases #300
This comment has been minimized.
This comment has been minimized.
|
Started working on this in commit d6ef5b7 I hate coordinate transforms so so much. augh. |
icefoxen commentedJan 10, 2018
See https://github.com/ggez/ggez/blob/master/examples/shadows.rs#L375-L383 for an example of such.
This is Yet Another Little Coordinate Goof that needs to be fixed. Once you fix it, make sure that things drawn on canvases such as text and images get drawn right-side-up still!