Commit 737c56be authored by Brian Osman's avatar Brian Osman Committed by Commit Bot

Stop using Skia's specialized min/max/clamp functions

Change-Id: I90a2e27df04b88fb49a0bf93d54b6391ed73fdf5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2039312Reviewed-by: default avatarScott Violet <sky@chromium.org>
Commit-Queue: Brian Osman <brianosman@google.com>
Cr-Commit-Position: refs/heads/master@{#738947}
parent 2b921c43
......@@ -591,10 +591,11 @@ void HeadsUpDisplayLayerImpl::DrawHudContents(PaintCanvas* canvas) {
SkRect area =
DrawFPSDisplay(canvas, layer_tree_impl()->frame_rate_counter(), 0, 0);
area = DrawGpuRasterizationStatus(canvas, 0, area.bottom(),
SkMaxScalar(area.width(), 150));
std::max<SkScalar>(area.width(), 150));
if (debug_state.ShowMemoryStats() && memory_entry_.total_bytes_used)
DrawMemoryDisplay(canvas, 0, area.bottom(), SkMaxScalar(area.width(), 150));
DrawMemoryDisplay(canvas, 0, area.bottom(),
std::max<SkScalar>(area.width(), 150));
canvas->restore();
}
......
......@@ -793,7 +793,7 @@ void GraphicsContext::DrawLineForText(const FloatPoint& pt, float width) {
case kNoStroke:
case kSolidStroke:
case kDoubleStroke: {
int thickness = SkMax32(static_cast<int>(StrokeThickness()), 1);
int thickness = std::max(static_cast<int>(StrokeThickness()), 1);
SkRect r;
r.fLeft = WebCoreFloatToSkScalar(pt.X());
// Avoid anti-aliasing lines. Currently, these are always horizontal.
......
......@@ -691,7 +691,7 @@ SkRect NativeThemeBase::PaintCheckboxRadioCommon(
// No other browser seems to support non-square widget, so accidentally
// having non-square sizes is common (eg. amazon and webkit dev tools).
if (skrect.width() != skrect.height()) {
SkScalar size = SkMinScalar(skrect.width(), skrect.height());
SkScalar size = std::min(skrect.width(), skrect.height());
skrect.inset((skrect.width() - size) / 2, (skrect.height() - size) / 2);
}
......@@ -747,7 +747,7 @@ SkRect NativeThemeBase::PaintCheckboxRadioCommon(
// No other browser seems to support non-square widget, so accidentally
// having non-square sizes is common (eg. amazon and webkit dev tools).
if (skrect.width() != skrect.height()) {
SkScalar size = SkMinScalar(skrect.width(), skrect.height());
SkScalar size = std::min(skrect.width(), skrect.height());
skrect.inset((skrect.width() - size) / 2, (skrect.height() - size) / 2);
}
......
......@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/numerics/ranges.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
......@@ -285,8 +286,8 @@ void ColorChooserView::SaturationValueView::ProcessEventAtLocation(
SkScalar scalar_size = SkIntToScalar(kSaturationValueSize - 1);
SkScalar saturation = (point.x() - kBorderWidth) / scalar_size;
SkScalar value = SK_Scalar1 - (point.y() - kBorderWidth) / scalar_size;
saturation = SkScalarPin(saturation, 0, SK_Scalar1);
value = SkScalarPin(value, 0, SK_Scalar1);
saturation = base::ClampToRange(saturation, 0.0f, SK_Scalar1);
value = base::ClampToRange(value, 0.0f, SK_Scalar1);
OnSaturationValueChanged(saturation, value);
chooser_view_->OnSaturationValueChosen(saturation, value);
}
......
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