aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
Diffstat (limited to 'components')
-rw-r--r--components/gfx/paint_context.rs2
-rw-r--r--components/gfx/platform/freetype/font.rs22
-rw-r--r--components/gfx/platform/freetype/font_context.rs2
-rw-r--r--components/gfx/platform/freetype/font_list.rs4
-rw-r--r--components/gfx/text/shaping/harfbuzz.rs22
5 files changed, 25 insertions, 27 deletions
diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs
index 4866a7aed00..fc8834c5239 100644
--- a/components/gfx/paint_context.rs
+++ b/components/gfx/paint_context.rs
@@ -1149,7 +1149,7 @@ impl ScaledFontExtensionMethods for ScaledFont {
let target = rctx.get_draw_target();
let pattern = ColorPattern::new(color);
let azure_pattern = pattern.azure_color_pattern;
- assert!(azure_pattern.is_not_null());
+ assert!(!azure_pattern.is_null());
let fields = if antialias {
0x0200
diff --git a/components/gfx/platform/freetype/font.rs b/components/gfx/platform/freetype/font.rs
index e2a5525aea0..f34f158c39d 100644
--- a/components/gfx/platform/freetype/font.rs
+++ b/components/gfx/platform/freetype/font.rs
@@ -59,7 +59,7 @@ pub struct FontHandle {
#[unsafe_destructor]
impl Drop for FontHandle {
fn drop(&mut self) {
- assert!(self.face.is_not_null());
+ assert!(!self.face.is_null());
unsafe {
if !FT_Done_Face(self.face).succeeded() {
panic!("FT_Done_Face failed");
@@ -136,7 +136,7 @@ impl FontHandleMethods for FontHandle {
} else {
unsafe {
let os2 = FT_Get_Sfnt_Table(self.face, ft_sfnt_os2) as *mut TT_OS2;
- let valid = os2.is_not_null() && (*os2).version != 0xffff;
+ let valid = !os2.is_null() && (*os2).version != 0xffff;
if valid {
let weight =(*os2).usWeightClass;
match weight {
@@ -158,9 +158,8 @@ impl FontHandleMethods for FontHandle {
}
}
- fn glyph_index(&self,
- codepoint: char) -> Option<GlyphId> {
- assert!(self.face.is_not_null());
+ fn glyph_index(&self, codepoint: char) -> Option<GlyphId> {
+ assert!(!self.face.is_null());
unsafe {
let idx = FT_Get_Char_Index(self.face, codepoint as FT_ULong);
return if idx != 0 as FT_UInt {
@@ -173,8 +172,8 @@ impl FontHandleMethods for FontHandle {
}
fn glyph_h_kerning(&self, first_glyph: GlyphId, second_glyph: GlyphId)
- -> FractionalPixel {
- assert!(self.face.is_not_null());
+ -> FractionalPixel {
+ assert!(!self.face.is_null());
let mut delta = struct_FT_Vector_ { x: 0, y: 0 };
unsafe {
FT_Get_Kerning(self.face, first_glyph, second_glyph, FT_KERNING_DEFAULT, &mut delta);
@@ -182,15 +181,14 @@ impl FontHandleMethods for FontHandle {
fixed_to_float_ft(delta.x as i32)
}
- fn glyph_h_advance(&self,
- glyph: GlyphId) -> Option<FractionalPixel> {
- assert!(self.face.is_not_null());
+ fn glyph_h_advance(&self, glyph: GlyphId) -> Option<FractionalPixel> {
+ assert!(!self.face.is_null());
unsafe {
let res = FT_Load_Glyph(self.face, glyph as FT_UInt, 0);
if res.succeeded() {
let void_glyph = (*self.face).glyph;
let slot: FT_GlyphSlot = mem::transmute(void_glyph);
- assert!(slot.is_not_null());
+ assert!(!slot.is_null());
let advance = (*slot).metrics.horiAdvance;
debug!("h_advance for {} is {}", glyph, advance);
let advance = advance as i32;
@@ -227,7 +225,7 @@ impl FontHandleMethods for FontHandle {
let mut x_height = geometry::from_pt(0.0);
unsafe {
let os2 = FT_Get_Sfnt_Table(face, ft_sfnt_os2) as *mut TT_OS2;
- let valid = os2.is_not_null() && (*os2).version != 0xffff;
+ let valid = !os2.is_null() && (*os2).version != 0xffff;
if valid {
strikeout_size = self.font_units_to_au((*os2).yStrikeoutSize as f64);
strikeout_offset = self.font_units_to_au((*os2).yStrikeoutPosition as f64);
diff --git a/components/gfx/platform/freetype/font_context.rs b/components/gfx/platform/freetype/font_context.rs
index 7ff3b136189..e978cfd48cd 100644
--- a/components/gfx/platform/freetype/font_context.rs
+++ b/components/gfx/platform/freetype/font_context.rs
@@ -49,7 +49,7 @@ pub struct FontContextHandle {
impl Drop for FreeTypeLibraryHandle {
fn drop(&mut self) {
- assert!(self.ctx.is_not_null());
+ assert!(!self.ctx.is_null());
unsafe { FT_Done_FreeType(self.ctx) };
}
}
diff --git a/components/gfx/platform/freetype/font_list.rs b/components/gfx/platform/freetype/font_list.rs
index bd62b725d9e..4c061e88b13 100644
--- a/components/gfx/platform/freetype/font_list.rs
+++ b/components/gfx/platform/freetype/font_list.rs
@@ -53,14 +53,14 @@ pub fn get_variations_for_family(family_name: &str, callback: |String|) {
let mut font_set = FcConfigGetFonts(config, FcSetSystem);
let font_set_array_ptr = &mut font_set;
let pattern = FcPatternCreate();
- assert!(pattern.is_not_null());
+ assert!(!pattern.is_null());
let mut family_name_c = family_name.to_c_str();
let family_name = family_name_c.as_mut_ptr();
let ok = FcPatternAddString(pattern, FC_FAMILY.as_ptr() as *mut i8, family_name as *mut FcChar8);
assert!(ok != 0);
let object_set = FcObjectSetCreate();
- assert!(object_set.is_not_null());
+ assert!(!object_set.is_null());
FcObjectSetAdd(object_set, FC_FILE.as_ptr() as *mut i8);
FcObjectSetAdd(object_set, FC_INDEX.as_ptr() as *mut i8);
diff --git a/components/gfx/text/shaping/harfbuzz.rs b/components/gfx/text/shaping/harfbuzz.rs
index fb5d83b6457..e02f15bdc45 100644
--- a/components/gfx/text/shaping/harfbuzz.rs
+++ b/components/gfx/text/shaping/harfbuzz.rs
@@ -78,11 +78,11 @@ impl ShapedGlyphData {
let mut glyph_count = 0;
let glyph_infos = RUST_hb_buffer_get_glyph_infos(buffer, &mut glyph_count);
let glyph_count = glyph_count as int;
- assert!(glyph_infos.is_not_null());
+ assert!(!glyph_infos.is_null());
let mut pos_count = 0;
let pos_infos = RUST_hb_buffer_get_glyph_positions(buffer, &mut pos_count);
let pos_count = pos_count as int;
- assert!(pos_infos.is_not_null());
+ assert!(!pos_infos.is_null());
assert!(glyph_count == pos_count);
ShapedGlyphData {
@@ -160,13 +160,13 @@ pub struct Shaper {
impl Drop for Shaper {
fn drop(&mut self) {
unsafe {
- assert!(self.hb_face.is_not_null());
+ assert!(!self.hb_face.is_null());
RUST_hb_face_destroy(self.hb_face);
- assert!(self.hb_font.is_not_null());
+ assert!(!self.hb_font.is_null());
RUST_hb_font_destroy(self.hb_font);
- assert!(self.hb_funcs.is_not_null());
+ assert!(!self.hb_funcs.is_null());
RUST_hb_font_funcs_destroy(self.hb_funcs);
}
}
@@ -536,7 +536,7 @@ extern fn glyph_func(_: *mut hb_font_t,
_: *mut c_void)
-> hb_bool_t {
let font: *const Font = font_data as *const Font;
- assert!(font.is_not_null());
+ assert!(!font.is_null());
unsafe {
match (*font).glyph_index(char::from_u32(unicode).unwrap()) {
@@ -555,7 +555,7 @@ extern fn glyph_h_advance_func(_: *mut hb_font_t,
_: *mut c_void)
-> hb_position_t {
let font: *mut Font = font_data as *mut Font;
- assert!(font.is_not_null());
+ assert!(!font.is_null());
unsafe {
let advance = (*font).glyph_h_advance(glyph as GlyphId);
@@ -570,7 +570,7 @@ extern fn glyph_h_kerning_func(_: *mut hb_font_t,
_: *mut c_void)
-> hb_position_t {
let font: *mut Font = font_data as *mut Font;
- assert!(font.is_not_null());
+ assert!(!font.is_null());
unsafe {
let advance = (*font).glyph_h_kerning(first_glyph as GlyphId, second_glyph as GlyphId);
@@ -587,8 +587,8 @@ extern fn get_font_table_func(_: *mut hb_face_t,
// NB: These asserts have security implications.
let font_and_shaping_options: *const FontAndShapingOptions =
user_data as *const FontAndShapingOptions;
- assert!(font_and_shaping_options.is_not_null());
- assert!((*font_and_shaping_options).font.is_not_null());
+ assert!(!font_and_shaping_options.is_null());
+ assert!(!(*font_and_shaping_options).font.is_null());
// TODO(Issue #197): reuse font table data, which will change the unsound trickery here.
match (*(*font_and_shaping_options).font).get_table_for_tag(tag as FontTableTag) {
@@ -606,7 +606,7 @@ extern fn get_font_table_func(_: *mut hb_face_t,
destroy_blob_func);
});
- assert!(blob.is_not_null());
+ assert!(!blob.is_null());
blob
}
}