Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace GLUT with GLFW #563

Merged
merged 5 commits into from Jul 10, 2013
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -94,3 +94,9 @@
[submodule "src/support/nss/nspr"]
path = src/support/nss/nspr
url = git://github.com/mozilla-servo/nspr.git
[submodule "src/support/glfw/glfw"]
path = src/support/glfw/glfw
url = https://github.com/mozilla-servo/glfw.git
[submodule "src/support/glfw/glfw-rs"]
path = src/support/glfw/glfw-rs
url = https://github.com/mozilla-servo/glfw-rs.git
@@ -83,13 +83,18 @@ $(CFG_RUSTC):

clean-rust:
$(MAKE) -C "$(CFG_BUILD_DIR)src/compiler/rust" CFG_RUSTC_FLAGS="" RUSTFLAGS="" clean

else
$(CFG_RUSTC):

clean-rust:

endif

src/compiler/rust-auto-clean-stamp: $(S)src/compiler/rust-auto-clean-trigger
$(Q)$(MAKE) clean-rust
touch $@

rust: $(CFG_RUSTC)

# Strip off submodule paths to determine "raw" submodule names.
@@ -222,7 +227,7 @@ include $(S)mk/clean.mk

.DEFAULT_GOAL := all
.PHONY: all
all: servo package
all: src/compiler/rust-auto-clean-stamp servo package

# Servo helper libraries

@@ -403,6 +403,8 @@ CFG_SUBMODULES="\
support/css/rust-css \
support/geom/rust-geom \
support/glut/rust-glut \
support/glfw/glfw \
support/glfw/glfw-rs \
support/harfbuzz/rust-harfbuzz \
support/http-client/rust-http-client \
support/hubbub/libhubbub \
@@ -26,19 +26,19 @@ clean-fast: $(DEPS_CLEAN_TARGETS_FAST) clean-servo
$(Q)echo "$(filter-out $(SLOW_BUILDS),$(DEPS_CLEAN_ALL))"

clean-util:
cd $(B)/src/components/util/ && rm -rf libutil*.dylib $(DONE_util)
cd $(B)/src/components/util/ && rm -rf libutil*.{dylib,so} $(DONE_util)

clean-msg:
cd $(B)/src/components/msg/ && rm -rf libmsg*.dylib $(DONE_msg)
cd $(B)/src/components/msg/ && rm -rf libmsg*.{dylib,so} $(DONE_msg)

clean-net:
cd $(B)/src/components/net/ && rm -rf libnet*.dylib $(DONE_net)
cd $(B)/src/components/net/ && rm -rf libnet*.{dylib,so} $(DONE_net)

clean-gfx:
cd $(B)/src/components/gfx/ && rm -rf libgfx*.dylib $(DONE_gfx)
cd $(B)/src/components/gfx/ && rm -rf libgfx*.{dylib,so} $(DONE_gfx)

clean-script:
cd $(B)/src/components/script/ && rm -rf libscript*.dylib $(DONE_script)
cd $(B)/src/components/script/ && rm -rf libscript*.{dylib,so} $(DONE_script)

clean-servo: clean-gfx clean-util clean-net clean-script
clean-servo: clean-gfx clean-util clean-net clean-script clean-msg
rm -f servo servo-test
@@ -29,6 +29,7 @@ NATIVE_BUILDS += \
skia \
nss \
nspr \
glfw \
$(NULL)

# NOTE: the make magic can only compute transitive build dependencies,
@@ -40,18 +41,22 @@ NATIVE_BUILDS += \
DEPS_rust-azure += \
rust-opengles \
rust-layers \
rust-glut \
rust-geom \
glfw-rs \
glfw \
skia \
$(NULL)

DEPS_glfw-rs += \
glfw \
$(NULL)

DEPS_rust-glut += \
rust-opengles \
$(NULL)

DEPS_rust-layers += \
rust-geom \
rust-glut \
rust-opengles \
$(NULL)

@@ -0,0 +1,4 @@
# If this file is modified, then rust will be forcibly cleaned and then rebuilt.
# The actual contents of this file do not matter, but to trigger a change on the
# build bots then the contents should be changed so git updates the mtime.
2013-07-09
@@ -48,7 +48,7 @@ impl<E> DisplayList<E> {
/// Draws the display list into the given render context.
pub fn draw_into_context(&self, render_context: &RenderContext) {
debug!("Beginning display list.");
for self.list.each |item| {
for self.list.iter().advance |item| {
// FIXME(Issue #150): crashes
//debug!("drawing %?", *item);
item.draw_into_context(render_context)
@@ -389,7 +389,7 @@ impl Font {

let mut origin = copy baseline_origin;
let mut azglyphs = ~[];
vec::reserve(&mut azglyphs, range.length());
azglyphs.reserve(range.length());

for run.iter_slices_for_range(range) |glyphs, _offset, slice_range| {
for glyphs.iter_glyphs_for_char_range(slice_range) |_i, glyph| {
@@ -433,7 +433,7 @@ impl Font {
let mut advance = Au(0);
for run.iter_slices_for_range(range) |glyphs, _offset, slice_range| {
for glyphs.iter_glyphs_for_char_range(slice_range) |_i, glyph| {
advance += glyph.advance_();
advance = advance + glyph.advance_();
}
}
RunMetrics::new(advance, self.metrics.ascent, self.metrics.descent)
@@ -445,7 +445,7 @@ impl Font {
-> RunMetrics {
let mut advance = Au(0);
for glyphs.iter_glyphs_for_char_range(slice_range) |_i, glyph| {
advance += glyph.advance_();
advance = advance + glyph.advance_();
}
RunMetrics::new(advance, self.metrics.ascent, self.metrics.descent)
}
@@ -126,7 +126,7 @@ impl FontFamily {
// TODO(Issue #190): if not in the fast path above, do
// expensive matching of weights, etc.
let this: &mut FontFamily = self; // FIXME: borrow checker workaround
for this.entries.each |entry| {
for this.entries.iter().advance |entry| {
if (style.weight.is_bold() == entry.is_bold()) &&
(style.italic == entry.is_italic()) {

@@ -28,7 +28,6 @@ use freetype::tt_os2::TT_OS2;
use std::cast;
use std::ptr;
use std::str;
use std::vec;

fn float_to_fixed_ft(f: float) -> i32 {
float_to_fixed(6, f)
@@ -63,7 +62,7 @@ pub struct FontHandle {

#[unsafe_destructor]
impl Drop for FontHandle {
fn finalize(&self) {
fn drop(&self) {
assert!(self.face.is_not_null());
unsafe {
if !FT_Done_Face(self.face).succeeded() {
@@ -81,7 +80,7 @@ impl FontHandleMethods for FontHandle {
let ft_ctx: FT_Library = fctx.ctx.ctx;
if ft_ctx.is_null() { return Err(()); }

let face_result = do vec::as_imm_buf(buf) |bytes: *u8, len: uint| {
let face_result = do buf.as_imm_buf |bytes: *u8, len: uint| {
create_face_from_buffer(ft_ctx, bytes, len, style.pt_size)
};

@@ -17,7 +17,7 @@ struct FreeTypeLibraryHandle {
}

impl Drop for FreeTypeLibraryHandle {
fn finalize(&self) {
fn drop(&self) {
assert!(self.ctx.is_not_null());
unsafe {
FT_Done_FreeType(self.ctx);
@@ -139,7 +139,7 @@ struct AutoPattern {
}

impl Drop for AutoPattern {
fn finalize(&self) {
fn drop(&self) {
unsafe {
FcPatternDestroy(self.pattern);
}
@@ -29,15 +29,14 @@ use core_text::font_descriptor::{kCTFontDefaultOrientation};
use core_text;

use std::ptr;
use std::vec;

pub struct FontTable {
data: CFData,
}

// Noncopyable.
impl Drop for FontTable {
fn finalize(&self) {}
fn drop(&self) {}
}

impl FontTable {
@@ -80,9 +79,9 @@ impl FontHandle {
impl FontHandleMethods for FontHandle {
fn new_from_buffer(_: &FontContextHandle, buf: ~[u8], style: &SpecifiedFontStyle)
-> Result<FontHandle, ()> {
let fontprov : CGDataProvider = vec::as_imm_buf(buf, |cbuf, len| {
let fontprov : CGDataProvider = do buf.as_imm_buf |cbuf, len| {
core_graphics::data_provider::new_from_buffer(cbuf, len)
});
};

let cgfont = core_graphics::font::create_with_data_provider(&fontprov);
let ctfont = core_text::font::new_from_CGFont(&cgfont, style.pt_size);
@@ -75,7 +75,7 @@ priv struct RenderTask<C> {
last_paint_msg: Option<(arc::ARC<LayerBufferSet>, Size2D<uint>)>,
}

impl<C: RenderListener + Owned> RenderTask<C> {
impl<C: RenderListener + Send> RenderTask<C> {
pub fn create(id: uint,
port: Port<Msg>,
compositor: C,
@@ -347,7 +347,7 @@ impl<'self> DetailedGlyphStore {
// FIXME: Is this right? --pcwalton
// TODO: should fix this somewhere else
if count == 0 {
return vec::slice(self.detail_buffer, 0, 0);
return self.detail_buffer.slice(0, 0);
}

assert!((count as uint) <= self.detail_buffer.len());
@@ -365,7 +365,7 @@ impl<'self> DetailedGlyphStore {
Some(i) => {
assert!(i + (count as uint) <= self.detail_buffer.len());
// return a slice into the buffer
vec::slice(self.detail_buffer, i, i + count as uint)
self.detail_buffer.slice(i, i + count as uint)
}
}
}
@@ -635,17 +635,19 @@ impl<'self> GlyphStore {
}

for range.eachi |i| {
if !self.iter_glyphs_for_char_index(i, callback) {
// FIXME: Work around rust#2202. We should be able to pass the callback directly.
if !self.iter_glyphs_for_char_index(i, |a, b| callback(a, b)) {
break
}
}

true
}

pub fn iter_all_glyphs(&'self self, cb: &fn(uint, &GlyphInfo<'self>) -> bool) -> bool {
pub fn iter_all_glyphs(&'self self, callback: &fn(uint, &GlyphInfo<'self>) -> bool) -> bool {
for uint::range(0, self.entry_buffer.len()) |i| {
if !self.iter_glyphs_for_char_index(i, cb) {
// FIXME: Work around rust#2202. We should be able to pass the callback directly.
if !self.iter_glyphs_for_char_index(i, |a, b| callback(a, b)) {
break;
}
}
@@ -118,7 +118,7 @@ impl ShapedGlyphData {
} else {
// adjust the pen..
if y_advance > Au(0) {
*y_pos -= y_advance;
*y_pos = *y_pos - y_advance;
}

Some(Point2D(x_offset, *y_pos - y_offset))
@@ -143,7 +143,7 @@ pub struct Shaper {

#[unsafe_destructor]
impl Drop for Shaper {
fn finalize(&self) {
fn drop(&self) {
unsafe {
assert!(self.hb_face.is_not_null());
hb_face_destroy(self.hb_face);
@@ -123,7 +123,7 @@ impl<'self> TextRun {
}

pub fn char_len(&self) -> uint {
do self.glyphs.foldl(0u) |len, slice_glyphs| {
do self.glyphs.iter().fold(0u) |len, slice_glyphs| {
len + slice_glyphs.get().char_len()
}
}
@@ -161,7 +161,7 @@ impl<'self> TextRun {
f: &fn(&GlyphStore, uint, &Range) -> bool)
-> bool {
let mut offset = 0;
for self.glyphs.each |slice_glyphs| {
for self.glyphs.iter().advance |slice_glyphs| {
// Determine the range of this slice that we need.
let slice_range = Range::new(offset, slice_glyphs.get().char_len());
let mut char_range = range.intersect(&slice_range);
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.