Chromium Code Reviews| Index: ui/ios/uikit_util.mm |
| diff --git a/ui/ios/uikit_util.mm b/ui/ios/uikit_util.mm |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..a997c9e378fbae05252dc7f749e0a725fc955979 |
| --- /dev/null |
| +++ b/ui/ios/uikit_util.mm |
| @@ -0,0 +1,21 @@ |
| +// Copyright 2014 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. |
| + |
| +#include "ui/ios/uikit_util.h" |
| + |
| +#import <UIKit/UIKit.h> |
| + |
| +namespace ui { |
| + |
| +CGFloat alignValueToUpperPixel(CGFloat value) { |
| + CGFloat scale = [[UIScreen mainScreen] scale]; |
| + return ceil(value * scale) / scale; |
|
stuartmorgan
2014/09/04 22:16:11
std::ceil so it does the right thing with 64-bit?
lliabraa
2014/09/05 16:53:44
Done.
|
| +} |
| + |
| +CGSize alignSizeToUpperPixel(CGSize size) { |
| + return CGSizeMake(alignValueToUpperPixel(size.width), |
| + alignValueToUpperPixel(size.height)); |
|
stuartmorgan
2014/09/04 22:16:11
Should align inside the (
lliabraa
2014/09/05 16:53:45
Done.
|
| +} |
| + |
| +} // namespace ui |