Skip to content

Commit ed96df5

Browse files
author
bors-servo
authored
Auto merge of #35 - servo:pub-clamp, r=emilio
Mark clamp_from_f64_au as public Would be useful to reduce some redundant code in servo. r? @emilio
2 parents d2f4977 + 2e3eaca commit ed96df5

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "app_units"
3-
version = "0.5.4"
3+
version = "0.5.5"
44
authors = ["The Servo Project Developers"]
55
description = "Servo app units type (Au)"
66
documentation = "http://doc.servo.org/app_units/"

src/app_unit.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -195,18 +195,18 @@ impl Au {
195195
#[inline]
196196
pub fn scale_by(self, factor: f32) -> Au {
197197
let new_float = ((self.0 as f64) * factor as f64).round();
198-
Au::clamp_from_f64_au(new_float)
198+
Au::from_f64_au(new_float)
199199
}
200200

201201
#[inline]
202202
/// Scale, but round down (useful for viewport-relative units)
203203
pub fn scale_by_trunc(self, factor: f32) -> Au {
204204
let new_float = ((self.0 as f64) * factor as f64).floor();
205-
Au::clamp_from_f64_au(new_float)
205+
Au::from_f64_au(new_float)
206206
}
207207

208208
#[inline]
209-
fn clamp_from_f64_au(float: f64) -> Self {
209+
pub fn from_f64_au(float: f64) -> Self {
210210
// We *must* operate in f64. f32 isn't precise enough
211211
// to handle MAX_AU
212212
Au(float.min(MAX_AU.0 as f64)
@@ -254,13 +254,13 @@ impl Au {
254254
#[inline]
255255
pub fn from_f32_px(px: f32) -> Au {
256256
let float = (px * AU_PER_PX as f32).round();
257-
Au::clamp_from_f64_au(float as f64)
257+
Au::from_f64_au(float as f64)
258258
}
259259

260260
#[inline]
261261
pub fn from_f64_px(px: f64) -> Au {
262262
let float = (px * AU_PER_PX as f64).round();
263-
Au::clamp_from_f64_au(float)
263+
Au::from_f64_au(float)
264264
}
265265

266266
#[inline]

0 commit comments

Comments
 (0)