| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (c) 2012, Google Inc. All rights reserved. | 2 * Copyright (c) 2012, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 LayoutUnit(unsigned short value) { setValue(value); } | 67 LayoutUnit(unsigned short value) { setValue(value); } |
| 68 LayoutUnit(unsigned value) { setValue(value); } | 68 LayoutUnit(unsigned value) { setValue(value); } |
| 69 LayoutUnit(unsigned long value) { m_value = clampTo<int>(value * kFixedPoint
Denominator); } | 69 LayoutUnit(unsigned long value) { m_value = clampTo<int>(value * kFixedPoint
Denominator); } |
| 70 LayoutUnit(unsigned long long value) { m_value = clampTo<int>(value * kFixed
PointDenominator); } | 70 LayoutUnit(unsigned long long value) { m_value = clampTo<int>(value * kFixed
PointDenominator); } |
| 71 LayoutUnit(float value) { m_value = clampTo<int>(value * kFixedPointDenomina
tor); } | 71 LayoutUnit(float value) { m_value = clampTo<int>(value * kFixedPointDenomina
tor); } |
| 72 LayoutUnit(double value) { m_value = clampTo<int>(value * kFixedPointDenomin
ator); } | 72 LayoutUnit(double value) { m_value = clampTo<int>(value * kFixedPointDenomin
ator); } |
| 73 | 73 |
| 74 static LayoutUnit fromFloatCeil(float value) | 74 static LayoutUnit fromFloatCeil(float value) |
| 75 { | 75 { |
| 76 LayoutUnit v; | 76 LayoutUnit v; |
| 77 v.m_value = clampToInteger(ceilf(value * kFixedPointDenominator)); | 77 v.m_value = clampTo<int>(ceilf(value * kFixedPointDenominator)); |
| 78 return v; | 78 return v; |
| 79 } | 79 } |
| 80 | 80 |
| 81 static LayoutUnit fromFloatFloor(float value) | 81 static LayoutUnit fromFloatFloor(float value) |
| 82 { | 82 { |
| 83 LayoutUnit v; | 83 LayoutUnit v; |
| 84 v.m_value = clampToInteger(floorf(value * kFixedPointDenominator)); | 84 v.m_value = clampTo<int>(floorf(value * kFixedPointDenominator)); |
| 85 return v; | 85 return v; |
| 86 } | 86 } |
| 87 | 87 |
| 88 static LayoutUnit fromFloatRound(float value) | 88 static LayoutUnit fromFloatRound(float value) |
| 89 { | 89 { |
| 90 if (value >= 0) | 90 if (value >= 0) |
| 91 return clamp(value + epsilon() / 2.0f); | 91 return clamp(value + epsilon() / 2.0f); |
| 92 return clamp(value - epsilon() / 2.0f); | 92 return clamp(value - epsilon() / 2.0f); |
| 93 } | 93 } |
| 94 | 94 |
| (...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 if (value >= max) | 793 if (value >= max) |
| 794 return max; | 794 return max; |
| 795 if (value <= min) | 795 if (value <= min) |
| 796 return min; | 796 return min; |
| 797 return value; | 797 return value; |
| 798 } | 798 } |
| 799 | 799 |
| 800 } // namespace blink | 800 } // namespace blink |
| 801 | 801 |
| 802 #endif // LayoutUnit_h | 802 #endif // LayoutUnit_h |
| OLD | NEW |