diff options
author | krb <krb@chromium.org> | 2016-03-14 07:37:44 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-03-14 14:39:52 +0000 |
commit | 8f981ab4bfe7cbedccacdc9df5bd908915e36e51 (patch) | |
tree | 31f56e13c0a23a4c1f5771e24eb7edfc23100f66 /printing | |
parent | 04e1b2e7d54c290c2d8aa5570949cded14e2fd5f (diff) | |
download | chromium_src-8f981ab4bfe7cbedccacdc9df5bd908915e36e51.zip chromium_src-8f981ab4bfe7cbedccacdc9df5bd908915e36e51.tar.gz chromium_src-8f981ab4bfe7cbedccacdc9df5bd908915e36e51.tar.bz2 |
Use std::min/max to make intent more clear
The one-line conditionals when calculating the bounding box are unclear, particularly with the loose definition of "top". Use std::min/max to make it obvious.
Review URL: https://codereview.chromium.org/1777323002
Cr-Commit-Position: refs/heads/master@{#380974}
Diffstat (limited to 'printing')
-rw-r--r-- | printing/pdf_transform.cc | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/printing/pdf_transform.cc b/printing/pdf_transform.cc index f13a639..35dd1df 100644 --- a/printing/pdf_transform.cc +++ b/printing/pdf_transform.cc @@ -58,13 +58,10 @@ ClipBox CalculateClipBoxBoundary(const ClipBox& media_box, // Clip |media_box| to the size of |crop_box|, but ignore |crop_box| if it is // bigger than |media_box|. - clip_box.left = - (crop_box.left < media_box.left) ? media_box.left : crop_box.left; - clip_box.right = - (crop_box.right > media_box.right) ? media_box.right : crop_box.right; - clip_box.top = (crop_box.top > media_box.top) ? media_box.top : crop_box.top; - clip_box.bottom = - (crop_box.bottom < media_box.bottom) ? media_box.bottom : crop_box.bottom; + clip_box.left = std::max(crop_box.left, media_box.left); + clip_box.right = std::min(crop_box.right, media_box.right); + clip_box.top = std::min(crop_box.top, media_box.top); + clip_box.bottom = std::max(crop_box.bottom, media_box.bottom); return clip_box; } |