Skip to content

Commit

Permalink
Remove render backend option as it doesn't work and confuses people.
Browse files Browse the repository at this point in the history
  • Loading branch information
gw3583 committed Oct 19, 2014
1 parent c123f75 commit b816550
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 46 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions components/gfx/display_list/mod.rs
Expand Up @@ -555,8 +555,7 @@ impl DisplayItem {

render_context.font_ctx.get_render_font_from_template(
&text.text_run.font_template,
text.text_run.actual_pt_size,
render_context.opts.render_backend
text.text_run.actual_pt_size
).borrow().draw_text_into_context(
render_context,
&*text.text_run,
Expand Down
16 changes: 9 additions & 7 deletions components/gfx/font_context.rs
Expand Up @@ -20,7 +20,7 @@ use std::cell::RefCell;
use sync::Arc;

use azure::AzFloat;
use azure::azure_hl::BackendType;
use azure::azure_hl::SkiaBackend;
use azure::scaled_font::ScaledFont;

#[cfg(target_os="linux")]
Expand All @@ -29,14 +29,14 @@ use azure::scaled_font::FontData;

#[cfg(target_os="linux")]
#[cfg(target_os="android")]
fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont {
ScaledFont::new(backend, FontData(&template.bytes), pt_size as AzFloat)
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont {
ScaledFont::new(SkiaBackend, FontData(&template.bytes), pt_size as AzFloat)
}

#[cfg(target_os="macos")]
fn create_scaled_font(backend: BackendType, template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont {
fn create_scaled_font(template: &Arc<FontTemplateData>, pt_size: f64) -> ScaledFont {
let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont();
ScaledFont::new(backend, &cgfont, pt_size as AzFloat)
ScaledFont::new(SkiaBackend, &cgfont, pt_size as AzFloat)
}

static SMALL_CAPS_SCALE_FACTOR: f64 = 0.8; // Matches FireFox (see gfxFont.h)
Expand Down Expand Up @@ -199,15 +199,17 @@ impl FontContext {

/// Create a render font for use with azure. May return a cached
/// reference if already used by this font context.
pub fn get_render_font_from_template(&mut self, template: &Arc<FontTemplateData>, pt_size: f64, backend: BackendType) -> Rc<RefCell<ScaledFont>> {
pub fn get_render_font_from_template(&mut self,
template: &Arc<FontTemplateData>,
pt_size: f64) -> Rc<RefCell<ScaledFont>> {
for cached_font in self.render_font_cache.iter() {
if cached_font.pt_size == pt_size &&
cached_font.identifier == template.identifier {
return cached_font.font.clone();
}
}

let render_font = Rc::new(RefCell::new(create_scaled_font(backend, template, pt_size)));
let render_font = Rc::new(RefCell::new(create_scaled_font(template, pt_size)));
self.render_font_cache.push(RenderFontCacheEntry{
font: render_font.clone(),
pt_size: pt_size,
Expand Down
10 changes: 6 additions & 4 deletions components/gfx/render_task.rs
Expand Up @@ -10,7 +10,7 @@ use display_list::DisplayList;
use font_context::FontContext;
use render_context::RenderContext;

use azure::azure_hl::{B8G8R8A8, Color, DrawTarget, StolenGLResources};
use azure::azure_hl::{B8G8R8A8, Color, DrawTarget, SkiaBackend, StolenGLResources};
use azure::AzFloat;
use geom::matrix2d::Matrix2D;
use geom::point::Point2D;
Expand Down Expand Up @@ -317,17 +317,19 @@ impl<C:RenderListener + Send> RenderTask<C> {
let width = tile.screen_rect.size.width;
let height = tile.screen_rect.size.height;

// TODO: In the future we'll want to re-enable configuring the
// rendering backend - it's hardcoded to Skia below for now
// since none of the other backends work at all.
let size = Size2D(width as i32, height as i32);
let draw_target = match self.graphics_context {
CpuGraphicsContext => {
DrawTarget::new(self.opts.render_backend, size, B8G8R8A8)
DrawTarget::new(SkiaBackend, size, B8G8R8A8)
}
GpuGraphicsContext => {
// FIXME(pcwalton): Cache the components of draw targets
// (texture color buffer, renderbuffers) instead of recreating them.
let draw_target =
DrawTarget::new_with_fbo(self.opts.render_backend,
native_graphics_context!(self),
DrawTarget::new_with_fbo(SkiaBackend, native_graphics_context!(self),
size,
B8G8R8A8);
draw_target.make_current();
Expand Down
3 changes: 0 additions & 3 deletions components/util/Cargo.toml
Expand Up @@ -7,9 +7,6 @@ authors = ["The Servo Project Developers"]
name = "util"
path = "lib.rs"

[dependencies.azure]
git = "https://github.com/servo/rust-azure"

[dependencies.geom]
git = "https://github.com/servo/rust-geom"

Expand Down
1 change: 0 additions & 1 deletion components/util/lib.rs
Expand Up @@ -12,7 +12,6 @@ extern crate log;

extern crate debug;
extern crate alloc;
extern crate azure;
extern crate collections;
extern crate geom;
extern crate getopts;
Expand Down
25 changes: 0 additions & 25 deletions components/util/opts.rs
Expand Up @@ -7,8 +7,6 @@

use geometry::ScreenPx;

use azure::azure_hl::{BackendType, CairoBackend, CoreGraphicsBackend};
use azure::azure_hl::{CoreGraphicsAcceleratedBackend, Direct2DBackend, SkiaBackend};
use geom::scale_factor::ScaleFactor;
use geom::size::TypedSize2D;
use layers::geometry::DevicePixel;
Expand All @@ -25,9 +23,6 @@ pub struct Opts {
/// The initial URLs to load.
pub urls: Vec<String>,

/// The rendering backend to use (`-r`).
pub render_backend: BackendType,

/// How many threads to use for CPU rendering (`-t`).
///
/// FIXME(pcwalton): This is not currently used. All rendering is sequential.
Expand Down Expand Up @@ -163,25 +158,6 @@ pub fn from_cmdline_args(args: &[String]) -> Option<Opts> {
opt_match.free.clone()
};

let render_backend = match opt_match.opt_str("r") {
Some(backend_str) => {
if "direct2d" == backend_str.as_slice() {
Direct2DBackend
} else if "core-graphics" == backend_str.as_slice() {
CoreGraphicsBackend
} else if "core-graphics-accelerated" == backend_str.as_slice() {
CoreGraphicsAcceleratedBackend
} else if "cairo" == backend_str.as_slice() {
CairoBackend
} else if "skia" == backend_str.as_slice() {
SkiaBackend
} else {
fail!("unknown backend type")
}
}
None => SkiaBackend
};

let tile_size: uint = match opt_match.opt_str("s") {
Some(tile_size_str) => from_str(tile_size_str.as_slice()).unwrap(),
None => 512,
Expand Down Expand Up @@ -238,7 +214,6 @@ pub fn from_cmdline_args(args: &[String]) -> Option<Opts> {

let opts = Opts {
urls: urls,
render_backend: render_backend,
n_render_threads: n_render_threads,
cpu_painting: cpu_painting,
tile_size: tile_size,
Expand Down
1 change: 0 additions & 1 deletion ports/android/glut_app/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ports/cef/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion ports/cef/core.rs
Expand Up @@ -51,7 +51,6 @@ pub extern "C" fn cef_run_message_loop() {
urls.push("http://s27.postimg.org/vqbtrolyr/servo.jpg".to_string());
let opts = opts::Opts {
urls: urls,
render_backend: azure::azure_hl::SkiaBackend,
n_render_threads: 1,
cpu_painting: false,
tile_size: 512,
Expand Down

13 comments on commit b816550

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at glennw@b816550

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging glennw/servo/cleanup-opts = b816550 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glennw/servo/cleanup-opts = b816550 merged ok, testing candidate = e3a6611

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at glennw@b816550

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging glennw/servo/cleanup-opts = b816550 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glennw/servo/cleanup-opts = b816550 merged ok, testing candidate = fc73af9

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from pcwalton
at glennw@b816550

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging glennw/servo/cleanup-opts = b816550 into auto

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

glennw/servo/cleanup-opts = b816550 merged ok, testing candidate = a983deb

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors-servo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = a983deb

Please sign in to comment.