-
Notifications
You must be signed in to change notification settings - Fork 804
Fix some rendering issues that were causing #2095. #2117
Conversation
| pos.size.width = (img_height / _scale); | ||
| pos.size.height = (img_width / _scale); | ||
| pos.size.height = (img_height / _scale); | ||
| pos.size.width = (img_width / _scale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aballway might like this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: position is a very silly name for a rect 😝
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: oh well :)
| // |0 -1 0| | ||
| // |0 h 1| | ||
| CGContextSaveGState(ctx); | ||
| CGContextConcatCTM(ctx, CGAffineTransformMake(1, 0, 0, -1, 0, destRect.size.height)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CGAffineTransformMake [](start = 32, length = 21)
mind adding a comment calling out why this this transform is needed so that other people without the context can understand the reasoning behind. Thx!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@yiyang-msft done
|
|
1 similar comment
|
|
| pos.size.width = (img_height / _scale); | ||
| pos.size.height = (img_width / _scale); | ||
| pos.size.height = (img_height / _scale); | ||
| pos.size.width = (img_width / _scale); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: position is a very silly name for a rect 😝
| // |1 0 0| is the transformation matrix for flipping a rect anchored at 0,0 about its Y midpoint. | ||
| // |0 -1 0| | ||
| // |0 h 1| | ||
| CGContextSaveGState(ctx); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is saving/popping g-state relatively free? we should be able to get away with just reverting the CTM if not.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's very cheap.
b08769b to
b331749
Compare
|
This is in CI build; git-lfs is being particularly slow today. |
|
@rajsesh-msft if you end up being the one to merge this (I'll try to monitor the build status!), would you mind copying the Pull Request body into the squash message body? Thanks :) |
…#2117) * `-[CALayer renderInContext:]` has the ability to render a cached version of itself; it was doing so upside-down because it was using a Cairo implementation detail. * `-[UIImage drawAtPoint:]` squashed every image it rendered because it switched width & height. The bug in UIImage dates back to the Cairo implementation as well; the invalid size was passed to a function that ignored it. When our refactor made use of that parameter, things rapidly went south. We did not catch the second regression because all the images we drew with it were square. Fixes microsoft#2095.
-[CALayer renderInContext:]has the ability to render a cached version of itself; it was doing so upside-down because it was using a Cairo implementation detail.-[UIImage drawAtPoint:]squashed every image it rendered because it switched width & height.The bug in UIImage dates back to the Cairo implementation as well; the invalid size was passed to a function that ignored it. When our refactor made use of that parameter, things rapidly went south.
We did not catch the second regression because all the images we drew with it were square.