Scaling the shadow blur worked fine until there were other elements, besides scale, in the canvas' transform matrix, like rotation. In the first example there's no actual scaling even applied to the canvas, only rotation (and translation, but that doesn't affect the matrix scale terms).
Luckily SkMatrix already had a way to get just the scaling value out of it, so I didn't even have to do any math... :)
After fix:
Added more visual tests. Probably should do an auto test as well, just need to sample some relevant part of the result I suppose (I think I saw a similar test in there already somewhere).
Breaking out the render_shadow() helper at the top was just because I couldn't help myself... there are no actual differences in there. All the meat is at the bottom of context/mod.rs.
To illustrate the issue...
Scaling the shadow blur worked fine until there were other elements, besides scale, in the canvas' transform matrix, like rotation. In the first example there's no actual scaling even applied to the canvas, only rotation (and translation, but that doesn't affect the matrix scale terms).
Luckily
SkMatrix
already had a way to get just the scaling value out of it, so I didn't even have to do any math... :)After fix:
Added more visual tests. Probably should do an auto test as well, just need to sample some relevant part of the result I suppose (I think I saw a similar test in there already somewhere).
Breaking out the
render_shadow()
helper at the top was just because I couldn't help myself... there are no actual differences in there. All the meat is at the bottom ofcontext/mod.rs
.Thanks, -Max
Related to: #172