diff options
-rw-r--r-- | components/canvas/canvas_paint_thread.rs | 1 | ||||
-rw-r--r-- | components/canvas/webgl_paint_thread.rs | 4 | ||||
-rw-r--r-- | components/canvas_traits/lib.rs | 13 | ||||
-rw-r--r-- | components/script/dom/canvasrenderingcontext2d.rs | 6 | ||||
-rw-r--r-- | components/script/dom/webglrenderingcontext.rs | 3 | ||||
-rw-r--r-- | components/util/lib.rs | 1 | ||||
-rw-r--r-- | components/util/vec.rs | 16 |
7 files changed, 19 insertions, 25 deletions
diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs index 1faf41a9aed..c69b2039c44 100644 --- a/components/canvas/canvas_paint_thread.rs +++ b/components/canvas/canvas_paint_thread.rs @@ -19,7 +19,6 @@ use std::borrow::ToOwned; use std::mem; use util::opts; use util::thread::spawn_named; -use util::vec::byte_swap; use webrender_traits; impl<'a> CanvasPaintThread<'a> { diff --git a/components/canvas/webgl_paint_thread.rs b/components/canvas/webgl_paint_thread.rs index a9fe55a848a..2c77f63b82b 100644 --- a/components/canvas/webgl_paint_thread.rs +++ b/components/canvas/webgl_paint_thread.rs @@ -2,7 +2,8 @@ * 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/. */ -use canvas_traits::{CanvasCommonMsg, CanvasMsg, CanvasPixelData, CanvasData, FromLayoutMsg}; +use canvas_traits::{CanvasCommonMsg, CanvasData, CanvasMsg, CanvasPixelData}; +use canvas_traits::{FromLayoutMsg, byte_swap}; use euclid::size::Size2D; use gleam::gl; use ipc_channel::ipc::{self, IpcSender, IpcSharedMemory}; @@ -10,7 +11,6 @@ use offscreen_gl_context::{ColorAttachmentType, GLContext, GLLimits, GLContextAt use std::borrow::ToOwned; use std::sync::mpsc::channel; use util::thread::spawn_named; -use util::vec::byte_swap; use webrender_traits; enum WebGLPaintTaskData { diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs index 98eaa159077..db945750a0c 100644 --- a/components/canvas_traits/lib.rs +++ b/components/canvas_traits/lib.rs @@ -539,3 +539,16 @@ impl ToAzColor for RGBA { self.alpha as AzFloat) } } + +// TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this. +pub fn byte_swap(data: &mut [u8]) { + let length = data.len(); + // FIXME(rust #27741): Range::step_by is not stable yet as of this writing. + let mut i = 0; + while i < length { + let r = data[i + 2]; + data[i + 2] = data[i + 0]; + data[i + 0] = r; + i += 4; + } +} diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs index fc6afdc2b25..1c6f83651d1 100644 --- a/components/script/dom/canvasrenderingcontext2d.rs +++ b/components/script/dom/canvasrenderingcontext2d.rs @@ -3,8 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ use canvas_traits::{Canvas2dMsg, CanvasCommonMsg, CanvasMsg}; -use canvas_traits::{CompositionOrBlending, LineCapStyle, LineJoinStyle}; -use canvas_traits::{FillOrStrokeStyle, FillRule, LinearGradientStyle, RadialGradientStyle, RepetitionStyle}; +use canvas_traits::{CompositionOrBlending, FillOrStrokeStyle, FillRule}; +use canvas_traits::{LineCapStyle, LineJoinStyle, LinearGradientStyle}; +use canvas_traits::{RadialGradientStyle, RepetitionStyle, byte_swap}; use cssparser::Color as CSSColor; use cssparser::{Parser, RGBA}; use dom::bindings::cell::DOMRefCell; @@ -46,7 +47,6 @@ use std::str::FromStr; use std::{cmp, fmt}; use unpremultiplytable::UNPREMULTIPLY_TABLE; use url::Url; -use util::vec::byte_swap; #[must_root] #[derive(JSTraceable, Clone, HeapSizeOf)] diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs index 686bf43178f..4cacb9a761d 100644 --- a/components/script/dom/webglrenderingcontext.rs +++ b/components/script/dom/webglrenderingcontext.rs @@ -2,7 +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/. */ -use canvas_traits::{CanvasCommonMsg, CanvasMsg}; +use canvas_traits::{CanvasCommonMsg, CanvasMsg, byte_swap}; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextConstants as constants; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::WebGLRenderingContextMethods; use dom::bindings::codegen::Bindings::WebGLRenderingContextBinding::{self, WebGLContextAttributes}; @@ -40,7 +40,6 @@ use net_traits::image_cache_thread::ImageResponse; use offscreen_gl_context::{GLContextAttributes, GLLimits}; use script_traits::ScriptMsg as ConstellationMsg; use std::cell::Cell; -use util::vec::byte_swap; use webrender_traits::WebGLError::*; use webrender_traits::{WebGLCommand, WebGLError, WebGLFramebufferBindingRequest, WebGLParameter}; diff --git a/components/util/lib.rs b/components/util/lib.rs index 3a5c362f443..215f8e999cc 100644 --- a/components/util/lib.rs +++ b/components/util/lib.rs @@ -46,7 +46,6 @@ pub mod str; pub mod thread; pub mod thread_state; pub mod tid; -pub mod vec; #[allow(unsafe_code)] pub mod workqueue; #[cfg(feature = "servo")] diff --git a/components/util/vec.rs b/components/util/vec.rs deleted file mode 100644 index 2aa6b7d4a41..00000000000 --- a/components/util/vec.rs +++ /dev/null @@ -1,16 +0,0 @@ -/* This Source Code Form is subject to the terms of the Mozilla Public - * 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/. */ - -// TODO(pcwalton): Speed up with SIMD, or better yet, find some way to not do this. -pub fn byte_swap(data: &mut [u8]) { - let length = data.len(); - // FIXME(rust #27741): Range::step_by is not stable yet as of this writing. - let mut i = 0; - while i < length { - let r = data[i + 2]; - data[i + 2] = data[i + 0]; - data[i + 0] = r; - i += 4; - } -} |