diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-09 23:17:35 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-09 23:17:35 +0000 |
commit | 4b01b9680e67ba802e8a16027ffe4b4d435fc1e8 (patch) | |
tree | 675aa1ca07fa8f0d3bb1f0f4249822a6bf4e817d /ui/gfx/size_conversions.h | |
parent | 0c77646718f41510a03905f1ed31cd382109a6c4 (diff) | |
download | chromium_src-4b01b9680e67ba802e8a16027ffe4b4d435fc1e8.zip chromium_src-4b01b9680e67ba802e8a16027ffe4b4d435fc1e8.tar.gz chromium_src-4b01b9680e67ba802e8a16027ffe4b4d435fc1e8.tar.bz2 |
Remove implicit flooring Scale() method from Point and Size.
When scaling an integer point or size, return a floating point
result. Implicitly flooring hides design problems and bugs. Add
conversion functions to floor or ceil a SizeF or PointF
into an integer format again.
All existing behaviour has been preserved by replacing uses of
foo.Scale() with ToFlooredFoo(foo.Scale()).
R=sky
BUG=147395
Review URL: https://chromiumcodereview.appspot.com/11081007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160970 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gfx/size_conversions.h')
-rw-r--r-- | ui/gfx/size_conversions.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ui/gfx/size_conversions.h b/ui/gfx/size_conversions.h new file mode 100644 index 0000000..03197b3 --- /dev/null +++ b/ui/gfx/size_conversions.h @@ -0,0 +1,21 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef UI_GFX_SIZE_CONVERSIONS_H_ +#define UI_GFX_SIZE_CONVERSIONS_H_ + +#include "ui/gfx/size.h" +#include "ui/gfx/size_f.h" + +namespace gfx { + +// Returns a Size with each component from the input SizeF floored. +UI_EXPORT Size ToFlooredSize(const SizeF& size); + +// Returns a Size with each component from the input SizeF ceiled. +UI_EXPORT Size ToCeiledSize(const SizeF& size); + +} // namespace gfx + +#endif // UI_GFX_RECT_CONVERSIONS_H_ |