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() ...@@ -53,13 +53,15 @@ void RegionTracker::reset()
IntRect RegionTracker::asRect() const IntRect RegionTracker::asRect() const
{ {
// Returns the largest enclosed rect. // 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 // epsilon is large enough to accommodate machine precision issues and
// and the ceil of right/bottom? // small enough to have a negligible effect on rendered results.
int left = SkScalarCeilToInt(m_opaqueRect.fLeft); const SkScalar epsilon = 1.0f / 512.0f;
int top = SkScalarCeilToInt(m_opaqueRect.fTop);
int right = SkScalarFloorToInt(m_opaqueRect.fRight); int left = SkScalarCeilToInt(m_opaqueRect.fLeft - epsilon);
int bottom = SkScalarFloorToInt(m_opaqueRect.fBottom); 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); 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