Commit d85e91cc authored by F#m's avatar F#m Committed by Commit Bot

Increases the threshold to check for pixel snapping

With display zoom a wide range of device scale factors can now be set as
for a given device. Sometimes a value can lead to a failure in the pixel
snapping check. This patch increases the threshold for these checks.

Bug: 790723
Change-Id: I21ae6711f608b9f6bc99efd47d0c8466f03722eb
Component: Dip Util, Pixel Snapping,
Reviewed-on: https://chromium-review.googlesource.com/884361
Commit-Queue: Malay Keshav <malaykeshav@chromium.org>
Reviewed-by: default avatarScott Violet <sky@chromium.org>
Cr-Commit-Position: refs/heads/master@{#531966}
parent b3cde71e
...@@ -66,7 +66,10 @@ gfx::Rect ConvertRectToPixel(const Layer* layer, ...@@ -66,7 +66,10 @@ gfx::Rect ConvertRectToPixel(const Layer* layer,
namespace { namespace {
void CheckSnapped(float snapped_position) { void CheckSnapped(float snapped_position) {
const float kEplison = 0.0003f; // The acceptable error epsilon should be small enough to detect visible
// artifacts as well as large enough to not cause false crashes when an
// uncommon device scale factor is applied.
const float kEplison = 0.003f;
float diff = std::abs(snapped_position - gfx::ToRoundedInt(snapped_position)); float diff = std::abs(snapped_position - gfx::ToRoundedInt(snapped_position));
DCHECK_LT(diff, kEplison); DCHECK_LT(diff, kEplison);
} }
......
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