On 31 August 2017 at 14:00, Nikolay Sivov nsivov@codeweavers.com wrote:
That's fine in principle, but please do it in a separate commit, and please follow the existing conventions. E.g.:
if (transform && FAILED(hr = d2d_point_transform_inverse(&point, transform, point.x, point.y))) return hr;
I think that looks a little more complicated than it needs to be. How about:
D2D1_POINT_2F d, s; ... s.x = rect.right - rect.left; s.y = rect.bottom - rect.top; d.x = fabsf((rect.right + rect.left) * 0.5f - point.x); d.y = fabsf((rect.bottom + rect.top) * 0.5f - point.y);
if (d.x < (s.x - stroke_width) * 0.5f - tolerance && d.y < (s.y - stroke_width) * 0.5f - tolerance) { *contains = FALSE; return S_OK; }
d.x = max(d.x - (s.x + stroke_width) * 0.5f, 0.0f); d.y = max(d.y - (s.y + stroke_width) * 0.5f, 0.0f); *contains = (d.x * d.x + d.y * d.y) < tolerance * tolerance;
I notice you don't have any tests with transformations, is that intentional? I think you'd need to transform the stroke width with the transformation matrix.
On 01.09.2017 1:25, Henri Verbeet wrote:
Sure.
Ok, I'll take a look.
No particular reason, but it's a good point. Also we don't have any tests for non-invertible case apparently, I'll add some.