Commit 8765f3f1 authored by p.sergey@samsung.com's avatar p.sergey@samsung.com

When tracking regions, treat sub-pixel areas as belonging to the region.

It is critical to display list canvases, due to the fact, that we fallback from
rendering on impl thread, when the canvas is not fully redrawn inside each
frame. On Browsermark 2 it is actually messed up due to floating point rounding.
The area in SkScalar is {0.00061, 0.00061, 1599.99997, 999.99998}, rounded down
to {1,1,1599,999} and the entire canvas area seems to be not redrawn.

BUG=386601

Review URL: https://codereview.chromium.org/666253003

git-svn-id: svn://svn.chromium.org/blink/trunk@184327 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent b67e5141
......@@ -53,13 +53,15 @@ void RegionTracker::reset()
IntRect RegionTracker::asRect() const
{
// Returns the largest enclosed rect.
// TODO: actually, this logic looks like its returning the smallest.
// to return largest, shouldn't we take floor of left/top
// and the ceil of right/bottom?
int left = SkScalarCeilToInt(m_opaqueRect.fLeft);
int top = SkScalarCeilToInt(m_opaqueRect.fTop);
int right = SkScalarFloorToInt(m_opaqueRect.fRight);
int bottom = SkScalarFloorToInt(m_opaqueRect.fBottom);
// epsilon is large enough to accommodate machine precision issues and
// small enough to have a negligible effect on rendered results.
const SkScalar epsilon = 1.0f / 512.0f;
int left = SkScalarCeilToInt(m_opaqueRect.fLeft - epsilon);
int top = SkScalarCeilToInt(m_opaqueRect.fTop - epsilon);
int right = SkScalarFloorToInt(m_opaqueRect.fRight + epsilon);
int bottom = SkScalarFloorToInt(m_opaqueRect.fBottom + epsilon);
return IntRect(left, top, right-left, bottom-top);
}
......
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