Commit af2c8d1e authored by pdr's avatar pdr Committed by Commit bot

Inline LayoutRect::enclosingIntRect

Noticed this function was hot on blink_perf.paint's color-changes.html
microbenchmark. With this patch, color-changes.html runs 2.7% faster
(average -0.8ms) but that number should be taken with a grain of salt
since it's near the standard deviation of the test.

Manual profiling with and without the patch confirmed this function is
no longer hot.

Review-Url: https://codereview.chromium.org/2550083002
Cr-Commit-Position: refs/heads/master@{#436323}
parent 105c1207
......@@ -152,13 +152,6 @@ LayoutRect unionRectEvenIfEmpty(const Vector<LayoutRect>& rects) {
return result;
}
IntRect enclosingIntRect(const LayoutRect& rect) {
IntPoint location = flooredIntPoint(rect.minXMinYCorner());
IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner());
return IntRect(location, maxPoint - location);
}
LayoutRect enclosingLayoutRect(const FloatRect& rect) {
LayoutPoint location = flooredLayoutPoint(rect.minXMinYCorner());
LayoutPoint maxPoint = ceiledLayoutPoint(rect.maxXMaxYCorner());
......
......@@ -278,7 +278,12 @@ inline IntRect pixelSnappedIntRect(const LayoutRect& rect) {
snapSizeToPixel(rect.height(), rect.y())));
}
PLATFORM_EXPORT IntRect enclosingIntRect(const LayoutRect&);
inline IntRect enclosingIntRect(const LayoutRect& rect) {
IntPoint location = flooredIntPoint(rect.minXMinYCorner());
IntPoint maxPoint = ceiledIntPoint(rect.maxXMaxYCorner());
return IntRect(location, maxPoint - location);
}
PLATFORM_EXPORT LayoutRect enclosingLayoutRect(const FloatRect&);
inline IntRect pixelSnappedIntRect(LayoutUnit left,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment