mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Move util::vec::byte_swap to canvas_traits
This commit is contained in:
parent
a5b524d559
commit
e77efb93c1
7 changed files with 19 additions and 25 deletions
|
@ -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> {
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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};
|
||||
|
||||
|
|
|
@ -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")]
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue