Commit a16f3448 authored by v.paturi's avatar v.paturi Committed by Commit Bot

Use float equality check function from cc/base/math_util.h

In render_widget_host_view_android.cc FloatEquals() function is
implemented. This implementaion already exists in cc/base/math_util
as IsFloatNearlyTheSame(). So the FloatEquals() implementation is
removed and is replaced with IsFloatNearlyTheSame() in the calling
functions.

Bug: None
Change-Id: I84dd6fc29475e59cbbac6e953c8f0093f9f972c5
Reviewed-on: https://chromium-review.googlesource.com/1177218Reviewed-by: default avatarEric Karl <ericrk@chromium.org>
Commit-Queue: Prashant Nevase <prashant.n@samsung.com>
Cr-Commit-Position: refs/heads/master@{#586195}
parent cf3c7c9e
......@@ -21,6 +21,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/sys_info.h"
#include "base/threading/thread_task_runner_handle.h"
#include "cc/base/math_util.h"
#include "cc/layers/layer.h"
#include "cc/layers/surface_layer.h"
#include "cc/trees/latency_info_swap_promise.h"
......@@ -148,10 +149,6 @@ void RecordToolTypeForActionDown(const ui::MotionEventAndroid& event) {
}
}
bool FloatEquals(float a, float b) {
return std::abs(a - b) < FLT_EPSILON;
}
void WakeUpGpu(GpuProcessHost* host) {
if (host && host->wake_up_gpu_before_drawing()) {
host->gpu_service()->WakeUpGpu();
......@@ -1344,7 +1341,8 @@ bool RenderWidgetHostViewAndroid::UpdateControls(
float top_content_offset = top_controls_height * top_controls_shown_ratio;
float top_shown_pix = top_content_offset * to_pix;
float top_translate = top_shown_pix - top_controls_pix;
bool top_changed = !FloatEquals(top_shown_pix, prev_top_shown_pix_);
bool top_changed =
!cc::MathUtil::IsFloatNearlyTheSame(top_shown_pix, prev_top_shown_pix_);
// TODO(mthiesse, https://crbug.com/853686): Remove the IsInVR check once
// there are no use cases for ignoring the initial update.
if (top_changed || (!controls_initialized_ && IsInVR()))
......@@ -1354,7 +1352,8 @@ bool RenderWidgetHostViewAndroid::UpdateControls(
float bottom_controls_pix = bottom_controls_height * to_pix;
float bottom_shown_pix = bottom_controls_pix * bottom_controls_shown_ratio;
bool bottom_changed = !FloatEquals(bottom_shown_pix, prev_bottom_shown_pix_);
bool bottom_changed = !cc::MathUtil::IsFloatNearlyTheSame(
bottom_shown_pix, prev_bottom_shown_pix_);
float bottom_translate = bottom_controls_pix - bottom_shown_pix;
if (bottom_changed || (!controls_initialized_ && IsInVR()))
view_.OnBottomControlsChanged(bottom_translate, bottom_shown_pix);
......
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