Navigation Menu

Skip to content

Commit

Permalink
Fix warnings: use clone_from_slice instead of copy_memory
Browse files Browse the repository at this point in the history
  • Loading branch information
tetsuharuohzeki committed Dec 11, 2015
1 parent bccb46c commit 7267163
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
1 change: 1 addition & 0 deletions components/canvas/lib.rs
Expand Up @@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#![feature(clone_from_slice)]
#![feature(nonzero)]
#![feature(slice_bytes)]
#![feature(plugin)]
Expand Down
3 changes: 1 addition & 2 deletions components/canvas/webgl_paint_task.rs
Expand Up @@ -13,7 +13,6 @@ use ipc_channel::router::ROUTER;
use layers::platform::surface::NativeSurface;
use offscreen_gl_context::{ColorAttachmentType, GLContext, GLContextAttributes};
use std::borrow::ToOwned;
use std::slice::bytes::copy_memory;
use std::sync::mpsc::{Sender, channel};
use util::task::spawn_named;
use util::vec::byte_swap;
Expand Down Expand Up @@ -365,7 +364,7 @@ impl WebGLPaintTask {
let dst_start = y * stride;
let src_start = (height - y - 1) * stride;
let src_slice = &orig_pixels[src_start .. src_start + stride];
copy_memory(&src_slice[..stride], &mut pixels[dst_start .. dst_start + stride]);
(&mut pixels[dst_start .. dst_start + stride]).clone_from_slice(&src_slice[..stride]);
}

// rgba -> bgra
Expand Down
4 changes: 1 addition & 3 deletions components/compositing/compositor.rs
Expand Up @@ -44,7 +44,6 @@ use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::mem as std_mem;
use std::rc::Rc;
use std::slice::bytes::copy_memory;
use std::sync::mpsc::Sender;
use style_traits::viewport::ViewportConstraints;
use surface_map::SurfaceMap;
Expand Down Expand Up @@ -1913,8 +1912,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let dst_start = y * stride;
let src_start = (height - y - 1) * stride;
let src_slice = &orig_pixels[src_start .. src_start + stride];
copy_memory(&src_slice[..stride],
&mut pixels[dst_start .. dst_start + stride]);
(&mut pixels[dst_start .. dst_start + stride]).clone_from_slice(&src_slice[..stride]);
}
RgbImage::from_raw(width as u32, height as u32, pixels).unwrap()
}
Expand Down
1 change: 1 addition & 0 deletions components/compositing/lib.rs
Expand Up @@ -3,6 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#![feature(box_syntax)]
#![feature(clone_from_slice)]
#![feature(custom_derive)]
#![feature(plugin)]
#![feature(slice_bytes)]
Expand Down

0 comments on commit 7267163

Please sign in to comment.