aboutsummaryrefslogtreecommitdiffstats
path: root/components/net/image_cache.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/net/image_cache.rs')
-rw-r--r--components/net/image_cache.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/components/net/image_cache.rs b/components/net/image_cache.rs
index 920330008d1..e4401ac64a0 100644
--- a/components/net/image_cache.rs
+++ b/components/net/image_cache.rs
@@ -109,7 +109,8 @@ fn is_image_opaque(format: webrender_api::ImageFormat, bytes: &[u8]) -> bool {
fn premultiply(data: &mut [u8]) {
let length = data.len();
- for i in Iterator::step_by(0..length, 4) {
+ let mut i = 0;
+ while i < length {
let b = data[i + 0] as u32;
let g = data[i + 1] as u32;
let r = data[i + 2] as u32;
@@ -118,6 +119,8 @@ fn premultiply(data: &mut [u8]) {
data[i + 0] = (b * a / 255) as u8;
data[i + 1] = (g * a / 255) as u8;
data[i + 2] = (r * a / 255) as u8;
+
+ i += 4;
}
}