servo / rust-azure Goto Github PK
View Code? Open in Web Editor NEWRust bindings to mozilla-central's graphics abstraction layer
License: Mozilla Public License 2.0
Rust bindings to mozilla-central's graphics abstraction layer
License: Mozilla Public License 2.0
The Documentation link at the foot of the https://github.com/servo/rust-azure page produces a 404 error.
Culprit in the stack trace: azure::azure_hl::DrawTarget::new(backend=Skia, size=(width = 11621, height = 109884), format=B8G8R8A8
It is necessary for servo/servo#15781.
In Servo’s currently-in-progress Rust upgrade, I’m writing silly things like PatternRef::ColorPatternRef
. Now that enums are namespaced, the variant names don’t need to contains the type name to disambiguate collisions anymore.
The override member methods should be marked 'override' instead of 'virtual'.
Compiling azure v0.1.0 (file:///Users/coreyf/Development/rust/rust-azure)
Compiling skia v0.0.20130412 (https://github.com/servo/skia#be648407)
Compiling expat-sys v2.1.0 (https://github.com/servo/libexpat#83f914d9)
Compiling libc v0.1.8
Compiling rustc-serialize v0.3.14
Compiling log v0.3.1
Compiling rand v0.3.8
Compiling core-foundation v0.1.0 (https://github.com/servo/core-foundation-rs#c2d82df5)
Compiling core-foundation v0.1.0
Compiling core-graphics v0.1.0 (https://github.com/servo/core-graphics-rs#bf96e0cf)
Compiling core-graphics v0.1.0
Compiling core-text v0.1.0 (https://github.com/servo/core-text-rs#54080aaa)
Compiling num v0.1.25
Compiling geom v0.1.0 (https://github.com/servo/rust-geom#270d0246)
src/scaled_font.rs:123:74: 123:95 error: no method named `as_concrete_TypeRef` found for type `&core_graphics::font::CGFont` in the current scope
src/scaled_font.rs:123 azure_native_font.mFont = mem::transmute(native_font.as_concrete_TypeRef());
^~~~~~~~~~~~~~~~~~~~~
src/scaled_font.rs:123:74: 123:95 help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
src/scaled_font.rs:123:74: 123:95 help: candidate #1: use `core_foundation::base::TCFType`
error: aborting due to previous error
Could not compile `azure`.
To learn more, run the command again with --verbose.
~/D/r/rust-azure (master|✔) $ rustc --version
rustc 1.2.0-nightly (613e57b44 2015-06-01) (built 2015-06-01)
Running on OSX 10.10
I don't think this is the right solution. It sounds like we're not choosing the appropriate size for the provided canvas pixels; we should fix that instead of working around it.
For example this:
https://github.com/servo/rust-azure/blob/master/src/azure_hl.rs#L708
pub fn draw_filter(&self,
filter: &FilterNode,
source_rect: &Rect<AzFloat>,
dest_point: &Point2D<AzFloat>,
options: DrawOptions) {
unsafe {
AzDrawTargetDrawFilter(self.azure_draw_target,
filter.azure_filter_node,
mem::transmute::<_,*const AzRect>(source_rect),
mem::transmute::<_,*const AzPoint>(dest_point),
&options.as_azure_draw_options())
}
}
transmutes from &Rect<AzFloat>
to *const AzRect
.
AzRect
is an alias to repr(C)
type, but Rect<AzFloat>
is not:
#[derive(RustcDecodable, RustcEncodable)]
pub struct TypedRect<T, U = UnknownUnit> {
pub origin: TypedPoint2D<T, U>,
pub size: TypedSize2D<T, U>,
}
/// The default rectangle type with no unit.
pub type Rect<T> = TypedRect<T, UnknownUnit>;
Therefore this whole crate is invoking a big undefined behaviour and should probably be fixed, preferably by not using transmute.
This is error about master(60ee86c).
/home/hyunjune/project/servo/servo/src/support/azure/rust-azure/azure.rc:13:0: 13:30 error: can't find crate for geom
/home/hyunjune/project/servo/servo/src/support/azure/rust-azure/azure.rc:13 extern mod geom = "rust-geom";
The issue is that AzDestroyFontOptions doesn't cast back to gfx::FontOptions before calling delete.
Apparently it's possible to get null derefs in DrawTarget
. That should be forbidden!
extern crate azure;
extern crate euclid;
use azure::azure_hl::DrawTarget;
use azure::azure_hl::BackendType;
use azure::azure_hl::SurfaceFormat;
use euclid::Size2D;
fn main() {
let target = DrawTarget::new(BackendType::Skia, Size2D::new(100, 100), SurfaceFormat::R8G8B8A8);
println!("can't print");
}
Running `target/debug/test`
Process didn't exit successfully: `target/debug/test` (signal: 11)
There appears to be platform specific code in this repository.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.