aboutsummaryrefslogtreecommitdiffstats
path: root/components/gfx
diff options
context:
space:
mode:
Diffstat (limited to 'components/gfx')
-rw-r--r--components/gfx/Cargo.toml5
-rw-r--r--components/gfx/lib.rs5
-rw-r--r--components/gfx/text/glyph.rs12
3 files changed, 10 insertions, 12 deletions
diff --git a/components/gfx/Cargo.toml b/components/gfx/Cargo.toml
index 6ea0d21e2a4..ee0746fb01b 100644
--- a/components/gfx/Cargo.toml
+++ b/components/gfx/Cargo.toml
@@ -13,7 +13,7 @@ test = false
doctest = false
[features]
-unstable = ["simd"]
+unstable = []
[dependencies]
app_units = "0.6"
@@ -60,9 +60,6 @@ servo-fontconfig = "0.2.1"
[target.'cfg(target_os = "android")'.dependencies]
xml5ever = {version = "0.12"}
-[target.'cfg(any(target_feature = "sse2", target_feature = "neon"))'.dependencies]
-simd = {version = "0.2.0", optional = true}
-
[target.'cfg(target_os = "windows")'.dependencies]
dwrote = "0.4"
truetype = "0.26"
diff --git a/components/gfx/lib.rs b/components/gfx/lib.rs
index 9c3b9680f38..f0acfdfa084 100644
--- a/components/gfx/lib.rs
+++ b/components/gfx/lib.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// For SIMD
-#![cfg_attr(feature = "unstable", feature(cfg_target_feature))]
+#![cfg_attr(feature = "unstable", feature(cfg_target_feature, stdsimd))]
#![deny(unsafe_code)]
@@ -50,9 +50,6 @@ extern crate range;
extern crate servo_arc;
#[macro_use] extern crate servo_atoms;
extern crate servo_url;
-#[cfg(feature = "unstable")]
-#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
-extern crate simd;
extern crate smallvec;
extern crate style;
extern crate time;
diff --git a/components/gfx/text/glyph.rs b/components/gfx/text/glyph.rs
index 0c3386aca7d..66864d3db31 100644
--- a/components/gfx/text/glyph.rs
+++ b/components/gfx/text/glyph.rs
@@ -5,10 +5,10 @@
use app_units::Au;
use euclid::Point2D;
use range::{self, EachIndex, Range, RangeIndex};
-#[cfg(all(feature = "unstable", any(target_feature = "sse2", target_feature = "neon")))]
-use simd::u32x4;
use std::{fmt, mem, u16};
use std::cmp::{Ordering, PartialOrd};
+#[cfg(all(feature = "unstable", any(target_feature = "sse2", target_feature = "neon")))]
+use std::simd::u32x4;
use std::vec::Vec;
pub use gfx_traits::ByteIndex;
@@ -606,7 +606,8 @@ impl<'a> GlyphStore {
let buf = self.transmute_entry_buffer_to_u32_buffer();
for i in 0..num_simd_iterations {
- let v = u32x4::load(buf, begin + i * 4);
+ let offset = begin + i * 4;
+ let v = u32x4::load_unaligned(&buf[offset..]);
let advance = (v & advance_mask) >> GLYPH_ADVANCE_SHIFT;
let spaces = (v & space_flag_mask) >> FLAG_CHAR_IS_SPACE_SHIFT;
simd_advance = simd_advance + advance;
@@ -647,7 +648,10 @@ impl<'a> GlyphStore {
#[cfg(any(target_feature = "sse2", target_feature = "neon"))]
#[allow(unsafe_code)]
fn transmute_entry_buffer_to_u32_buffer(&self) -> &[u32] {
- unsafe { mem::transmute(self.entry_buffer.as_slice()) }
+ // Statically assert identical sizes
+ let _ = mem::transmute::<GlyphEntry, u32>;
+
+ unsafe { mem::transmute::<&[GlyphEntry], &[u32]>(self.entry_buffer.as_slice()) }
}
pub fn char_is_space(&self, i: ByteIndex) -> bool {