Replace repeated min/max calls with n-arg min/max calls.
Cleanup only, no functional change. Bug: 1000055 TBR: sadrul,kinuko,thestig, mthiesse, zmo, msarda, csharrison, jochen Change-Id: Idc3d434d6cd5a5d9125c5e00047cbc6219616769 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1790724 Commit-Queue: Peter Kasting <pkasting@chromium.org> Reviewed-by: Charlie Harrison <csharrison@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Reviewed-by: Michael Thiessen <mthiesse@chromium.org> Reviewed-by: danakj <danakj@chromium.org> Reviewed-by: Peter Kasting <pkasting@chromium.org> Cr-Commit-Position: refs/heads/master@{#696103}
This commit is contained in:

committed by
Commit Bot

parent
fda5fc8bca
commit
14eab5ccd1
cc
base
layers
paint
tiles
chrome/browser
components
content/renderer/accessibility
gpu/command_buffer/service
pdf/pdfium
printing
storage/browser/blob
ui/gfx
url
@ -162,8 +162,7 @@ static inline bool IsNearlyTheSame(float f, float g) {
|
||||
// for the base of the scale too.
|
||||
static const float epsilon_scale = 0.00001f;
|
||||
return std::abs(f - g) <
|
||||
epsilon_scale *
|
||||
std::max(std::max(std::abs(f), std::abs(g)), epsilon_scale);
|
||||
epsilon_scale * std::max({std::abs(f), std::abs(g), epsilon_scale});
|
||||
}
|
||||
|
||||
static inline bool IsNearlyTheSame(const gfx::PointF& lhs,
|
||||
|
@ -1277,12 +1277,12 @@ void PictureLayerImpl::CleanUpTilingsOnActiveLayer(
|
||||
|
||||
PictureLayerImpl* twin = GetPendingOrActiveTwinLayer();
|
||||
if (twin && twin->CanHaveTilings()) {
|
||||
min_acceptable_high_res_scale = std::min(
|
||||
min_acceptable_high_res_scale,
|
||||
std::min(twin->raster_contents_scale_, twin->ideal_contents_scale_));
|
||||
max_acceptable_high_res_scale = std::max(
|
||||
max_acceptable_high_res_scale,
|
||||
std::max(twin->raster_contents_scale_, twin->ideal_contents_scale_));
|
||||
min_acceptable_high_res_scale =
|
||||
std::min({min_acceptable_high_res_scale, twin->raster_contents_scale_,
|
||||
twin->ideal_contents_scale_});
|
||||
max_acceptable_high_res_scale =
|
||||
std::max({max_acceptable_high_res_scale, twin->raster_contents_scale_,
|
||||
twin->ideal_contents_scale_});
|
||||
}
|
||||
|
||||
PictureLayerTilingSet* twin_set = twin ? twin->tilings_.get() : nullptr;
|
||||
|
@ -1393,8 +1393,8 @@ void PushDrawDRRectOps(PaintOpBuffer* buffer) {
|
||||
}
|
||||
|
||||
void PushDrawImageOps(PaintOpBuffer* buffer) {
|
||||
size_t len = std::min(std::min(test_images.size(), test_flags.size()),
|
||||
test_floats.size() - 1);
|
||||
size_t len =
|
||||
std::min({test_images.size(), test_flags.size(), test_floats.size() - 1});
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
buffer->push<DrawImageOp>(test_images[i], test_floats[i],
|
||||
test_floats[i + 1], &test_flags[i]);
|
||||
@ -1408,8 +1408,8 @@ void PushDrawImageOps(PaintOpBuffer* buffer) {
|
||||
}
|
||||
|
||||
void PushDrawImageRectOps(PaintOpBuffer* buffer) {
|
||||
size_t len = std::min(std::min(test_images.size(), test_flags.size()),
|
||||
test_rects.size() - 1);
|
||||
size_t len =
|
||||
std::min({test_images.size(), test_flags.size(), test_rects.size() - 1});
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
PaintCanvas::SrcRectConstraint constraint =
|
||||
i % 2 ? PaintCanvas::kStrict_SrcRectConstraint
|
||||
@ -1529,8 +1529,8 @@ void PushDrawTextBlobOps(PaintOpBuffer* buffer) {
|
||||
return builder.make();
|
||||
}(),
|
||||
};
|
||||
size_t len = std::min(std::min(test_paint_blobs.size(), test_flags.size()),
|
||||
test_floats.size() - 1);
|
||||
size_t len = std::min(
|
||||
{test_paint_blobs.size(), test_flags.size(), test_floats.size() - 1});
|
||||
for (size_t i = 0; i < len; ++i) {
|
||||
buffer->push<DrawTextBlobOp>(test_paint_blobs[i], test_floats[i],
|
||||
test_floats[i + 1], test_flags[i]);
|
||||
|
@ -626,12 +626,11 @@ void PictureLayerTiling::SetTilePriorityRects(
|
||||
// since skewport.Contains(visible_rect) is always true.
|
||||
max_skewport_extent_in_screen_space_ =
|
||||
current_content_to_screen_scale_ *
|
||||
std::max(std::max(current_visible_rect_.x() - current_skewport_rect_.x(),
|
||||
current_skewport_rect_.right() -
|
||||
current_visible_rect_.right()),
|
||||
std::max(current_visible_rect_.y() - current_skewport_rect_.y(),
|
||||
current_skewport_rect_.bottom() -
|
||||
current_visible_rect_.bottom()));
|
||||
std::max(
|
||||
{current_visible_rect_.x() - current_skewport_rect_.x(),
|
||||
current_skewport_rect_.right() - current_visible_rect_.right(),
|
||||
current_visible_rect_.y() - current_skewport_rect_.y(),
|
||||
current_skewport_rect_.bottom() - current_visible_rect_.bottom()});
|
||||
}
|
||||
|
||||
void PictureLayerTiling::SetLiveTilesRect(
|
||||
|
@ -370,7 +370,7 @@ gfx::Image GetAvatarIconForTitleBar(const gfx::Image& image,
|
||||
if (!is_gaia_image && image.Height() <= kAvatarIconSize)
|
||||
return image;
|
||||
|
||||
int size = std::min(kAvatarIconSize, std::min(dst_width, dst_height));
|
||||
int size = std::min({kAvatarIconSize, dst_width, dst_height});
|
||||
gfx::Size dst_size(dst_width, dst_height);
|
||||
|
||||
// Source for a sized icon drawn at the bottom center of the canvas,
|
||||
|
@ -407,13 +407,12 @@ void StackedTabStripLayout::LayoutUsingCurrentAfter(int index) {
|
||||
|
||||
void StackedTabStripLayout::LayoutUsingCurrentBefore(int index) {
|
||||
for (int i = index - 1; i >= pinned_tab_count_; --i) {
|
||||
int x = std::max(ideal_x(i), ideal_x(i + 1) - tab_offset());
|
||||
int max_x = x_ + width_for_count(i - pinned_tab_count_);
|
||||
if (i > pinned_tab_count_)
|
||||
max_x -= overlap_;
|
||||
max_x = std::min(max_x, ideal_x(i + 1) - stacked_padding_);
|
||||
SetIdealBoundsAt(
|
||||
i, std::min(max_x,
|
||||
std::max(ideal_x(i), ideal_x(i + 1) - tab_offset())));
|
||||
SetIdealBoundsAt(i,
|
||||
std::min({x, ideal_x(i + 1) - stacked_padding_, max_x}));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,7 @@ struct CornerRadii {
|
||||
}
|
||||
|
||||
float MaxRadius() const {
|
||||
return std::max(upper_left,
|
||||
std::max(upper_right, std::max(lower_left, lower_right)));
|
||||
return std::max({upper_left, upper_right, lower_left, lower_right});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -17,7 +17,7 @@ double ConvertFontSizeChromeToAndroid(int default_size,
|
||||
// fixed font size we will want to take into account the adjustment.
|
||||
default_fixed_size += 3;
|
||||
int max_chrome_size =
|
||||
std::max(std::max(default_fixed_size, default_size), minimum_size);
|
||||
std::max({default_fixed_size, default_size, minimum_size});
|
||||
|
||||
double android_scale = kAndroidFontScaleSmall;
|
||||
if (max_chrome_size >= kChromeFontSizeVeryLarge) {
|
||||
|
@ -10,14 +10,6 @@
|
||||
|
||||
namespace webrtc_logging {
|
||||
|
||||
namespace {
|
||||
|
||||
inline uint32_t Min3(uint32_t a, uint32_t b, uint32_t c) {
|
||||
return std::min(a, std::min(b, c));
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
PartialCircularBuffer::PartialCircularBuffer(void* buffer, uint32_t buffer_size)
|
||||
: buffer_data_(reinterpret_cast<BufferData*>(buffer)),
|
||||
memory_buffer_size_(buffer_size),
|
||||
@ -74,7 +66,7 @@ uint32_t PartialCircularBuffer::Read(void* buffer, uint32_t buffer_size) {
|
||||
if (position_ < buffer_data_->wrap_position) {
|
||||
uint32_t to_wrap_pos = buffer_data_->wrap_position - position_;
|
||||
uint32_t to_eow = buffer_data_->total_written - total_read_;
|
||||
uint32_t to_read = Min3(buffer_size, to_wrap_pos, to_eow);
|
||||
uint32_t to_read = std::min({buffer_size, to_wrap_pos, to_eow});
|
||||
memcpy(buffer_uint8, buffer_data_->data + position_, to_read);
|
||||
position_ += to_read;
|
||||
total_read_ += to_read;
|
||||
@ -103,7 +95,7 @@ uint32_t PartialCircularBuffer::Read(void* buffer, uint32_t buffer_size) {
|
||||
uint32_t remaining_buffer_size = buffer_size - read;
|
||||
uint32_t to_eof = data_size_ - position_;
|
||||
uint32_t to_eow = buffer_data_->total_written - total_read_;
|
||||
uint32_t to_read = Min3(remaining_buffer_size, to_eof, to_eow);
|
||||
uint32_t to_read = std::min({remaining_buffer_size, to_eof, to_eow});
|
||||
memcpy(buffer_uint8 + read, buffer_data_->data + position_, to_read);
|
||||
position_ += to_read;
|
||||
total_read_ += to_read;
|
||||
@ -128,7 +120,7 @@ uint32_t PartialCircularBuffer::Read(void* buffer, uint32_t buffer_size) {
|
||||
uint32_t remaining_buffer_size = buffer_size - read;
|
||||
uint32_t to_eob = buffer_data_->end_position - position_;
|
||||
uint32_t to_eow = buffer_data_->total_written - total_read_;
|
||||
uint32_t to_read = Min3(remaining_buffer_size, to_eob, to_eow);
|
||||
uint32_t to_read = std::min({remaining_buffer_size, to_eob, to_eow});
|
||||
memcpy(buffer_uint8 + read, buffer_data_->data + position_, to_read);
|
||||
position_ += to_read;
|
||||
total_read_ += to_read;
|
||||
|
@ -1139,7 +1139,7 @@ void RenderAccessibilityImpl::RecordImageMetrics(AXContentTreeUpdate* update) {
|
||||
continue;
|
||||
// We log the min size in a histogram with a max of 10000, so set a ceiling
|
||||
// of 10000 on min_size.
|
||||
int min_size = std::min(std::min(width, height), 10000);
|
||||
int min_size = std::min({width, height, 10000});
|
||||
int max_size = std::max(width, height);
|
||||
// The ratio is always the smaller divided by the larger so as not to go
|
||||
// over 100%.
|
||||
|
@ -2589,11 +2589,9 @@ GLsizei TextureManager::ComputeMipMapCount(GLenum target,
|
||||
case GL_TEXTURE_RECTANGLE_ARB:
|
||||
return 1;
|
||||
case GL_TEXTURE_3D:
|
||||
return 1 +
|
||||
base::bits::Log2Floor(std::max(std::max(width, height), depth));
|
||||
return 1 + base::bits::Log2Floor(std::max({width, height, depth}));
|
||||
default:
|
||||
return 1 +
|
||||
base::bits::Log2Floor(std::max(width, height));
|
||||
return 1 + base::bits::Log2Floor(std::max(width, height));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3288,11 +3288,10 @@ void PDFiumEngine::DrawPageShadow(const pp::Rect& page_rc,
|
||||
|
||||
// Page drop shadow parameters.
|
||||
constexpr double factor = 0.5;
|
||||
uint32_t depth =
|
||||
std::max(std::max(page_rect.x() - shadow_rect.x(),
|
||||
page_rect.y() - shadow_rect.y()),
|
||||
std::max(shadow_rect.right() - page_rect.right(),
|
||||
shadow_rect.bottom() - page_rect.bottom()));
|
||||
uint32_t depth = std::max({page_rect.x() - shadow_rect.x(),
|
||||
page_rect.y() - shadow_rect.y(),
|
||||
shadow_rect.right() - page_rect.right(),
|
||||
shadow_rect.bottom() - page_rect.bottom()});
|
||||
depth = static_cast<uint32_t>(depth * 1.5) + 1;
|
||||
|
||||
// We need to check depth only to verify our copy of shadow matrix is correct.
|
||||
|
@ -155,15 +155,13 @@ void PageSetup::CalculateSizesWithinRect(const gfx::Rect& bounds,
|
||||
effective_margins_.footer = std::max(
|
||||
requested_margins_.footer, physical_size_.height() - bounds.bottom());
|
||||
effective_margins_.left = std::max(requested_margins_.left, bounds.x());
|
||||
effective_margins_.top =
|
||||
std::max(std::max(requested_margins_.top, bounds.y()),
|
||||
effective_margins_.header + text_height);
|
||||
effective_margins_.top = std::max({requested_margins_.top, bounds.y(),
|
||||
effective_margins_.header + text_height});
|
||||
effective_margins_.right = std::max(requested_margins_.right,
|
||||
physical_size_.width() - bounds.right());
|
||||
effective_margins_.bottom =
|
||||
std::max(std::max(requested_margins_.bottom,
|
||||
physical_size_.height() - bounds.bottom()),
|
||||
effective_margins_.footer + text_height);
|
||||
effective_margins_.bottom = std::max(
|
||||
{requested_margins_.bottom, physical_size_.height() - bounds.bottom(),
|
||||
effective_margins_.footer + text_height});
|
||||
|
||||
// Calculate the overlay area. If the margins are excessive, the overlay_area
|
||||
// size will be (0, 0).
|
||||
|
@ -644,8 +644,7 @@ int BlobReader::ComputeBytesToRead() const {
|
||||
uint64_t max_int_value = std::numeric_limits<int>::max();
|
||||
// Here we make sure we don't overflow 'max int'.
|
||||
uint64_t min = std::min(
|
||||
std::min(std::min(item_remaining, buf_remaining), remaining_bytes_),
|
||||
max_int_value);
|
||||
{item_remaining, buf_remaining, remaining_bytes_, max_int_value});
|
||||
|
||||
return static_cast<int>(min);
|
||||
}
|
||||
|
@ -151,8 +151,8 @@ void CubicBezier::InitRange(double p1y, double p2y) {
|
||||
if (0 < t2 && t2 < 1)
|
||||
sol2 = SampleCurveY(t2);
|
||||
|
||||
range_min_ = std::min(std::min(range_min_, sol1), sol2);
|
||||
range_max_ = std::max(std::max(range_max_, sol1), sol2);
|
||||
range_min_ = std::min({range_min_, sol1, sol2});
|
||||
range_max_ = std::max({range_max_, sol1, sol2});
|
||||
}
|
||||
|
||||
void CubicBezier::InitSpline() {
|
||||
|
@ -63,10 +63,10 @@ class GEOMETRY_EXPORT QuadF {
|
||||
// the quad may lie on the right/bottom edge of the resulting rectangle,
|
||||
// rather than being strictly inside it.
|
||||
RectF BoundingBox() const {
|
||||
float rl = std::min(std::min(p1_.x(), p2_.x()), std::min(p3_.x(), p4_.x()));
|
||||
float rr = std::max(std::max(p1_.x(), p2_.x()), std::max(p3_.x(), p4_.x()));
|
||||
float rt = std::min(std::min(p1_.y(), p2_.y()), std::min(p3_.y(), p4_.y()));
|
||||
float rb = std::max(std::max(p1_.y(), p2_.y()), std::max(p3_.y(), p4_.y()));
|
||||
float rl = std::min({p1_.x(), p2_.x(), p3_.x(), p4_.x()});
|
||||
float rr = std::max({p1_.x(), p2_.x(), p3_.x(), p4_.x()});
|
||||
float rt = std::min({p1_.y(), p2_.y(), p3_.y(), p4_.y()});
|
||||
float rb = std::max({p1_.y(), p2_.y(), p3_.y(), p4_.y()});
|
||||
return RectF(rl, rt, rr - rl, rb - rt);
|
||||
}
|
||||
|
||||
|
@ -150,12 +150,10 @@ void NineImagePainter::Paint(Canvas* canvas,
|
||||
i7h = std::min(i7h, height_in_pixels - i1h);
|
||||
i8h = std::min(i8h, height_in_pixels - i2h);
|
||||
|
||||
int i4x = std::min(std::min(i0w, i3w), i6w);
|
||||
int i4y = std::min(std::min(i0h, i1h), i2h);
|
||||
int i4w =
|
||||
std::max(width_in_pixels - i4x - std::min(std::min(i2w, i5w), i8w), 0);
|
||||
int i4h =
|
||||
std::max(height_in_pixels - i4y - std::min(std::min(i6h, i7h), i8h), 0);
|
||||
int i4x = std::min({i0w, i3w, i6w});
|
||||
int i4y = std::min({i0h, i1h, i2h});
|
||||
int i4w = std::max(width_in_pixels - i4x - std::min({i2w, i5w, i8w}), 0);
|
||||
int i4h = std::max(height_in_pixels - i4y - std::min({i6h, i7h, i8h}), 0);
|
||||
|
||||
cc::PaintFlags flags;
|
||||
flags.setAlpha(alpha);
|
||||
|
@ -287,9 +287,8 @@ bool DoResolveRelativePath(const char* base_url,
|
||||
// Canonical URLs always have a path, so we can use that offset. Reserve
|
||||
// enough room for the base URL, the new path, and some extra bytes for
|
||||
// possible escaped characters.
|
||||
output->ReserveSizeIfNeeded(
|
||||
base_parsed.path.begin +
|
||||
std::max(path.end(), std::max(query.end(), ref.end())));
|
||||
output->ReserveSizeIfNeeded(base_parsed.path.begin +
|
||||
std::max({path.end(), query.end(), ref.end()}));
|
||||
output->Append(base_url, base_parsed.path.begin);
|
||||
|
||||
if (path.len > 0) {
|
||||
|
Reference in New Issue
Block a user