# [Webkit-unassigned] [Bug 200456] [results.webkit.org Timeline] Performance improvement - Skip render offscreen canvas

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 13 07:59:24 PDT 2019

```https://bugs.webkit.org/show_bug.cgi?id=200456

--- Comment #6 from Jonathan Bedard <jbedard at apple.com> ---
Comment on attachment 376100
--> https://bugs.webkit.org/attachment.cgi?id=376100
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=376100&action=review

> Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js:53
> +* Detact if point right ray have a collision with a line segment

Should be: 'Detect a collision between a right-pointing ray and a line segment

> Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js:60
> +function pointRightRayLineSegmentCollisionDetect(point, lineStart, lineEnd) {

I like the first ray-intersecting point comment, the rest seem unhelpful. Especially if we can reduce this entire function by using point-slope.

> Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js:67
> +        return false;

What if the point y position matches the line y position?

> Tools/resultsdbpy/resultsdbpy/view/static/library/js/components/TimelineComponents.js:102
> +}

Feels like we have more if statements here than we need. I think if you just use the inverse of point-slope, we'll have everything we need.

Equations:
m = (y1 - y0) / (x1 - x0)
y = m * (x - x1) + y1

m^(-1) = (x1 - x0) / (y1 - y0)
x = m^(-1) * (y - y1) + x1

Code:

if (lineEnd.y - lineStart.y == 0)
return lineEnd.y == point.y && (lineStart.x >= point.x || lineEnd.x >= point.x);
const invertedSlope = (lineEnd.x - lineStart.x) / (lineEnd.y - lineStart.y);
const xForY = invertedSlope * (point.y - lineStart.y) + lineStart.x;
return xForY >= point.x;

That code is totally untested, but I think we're looking for something closer to that.

--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20190813/98733fb6/attachment.html>
```