GithubHelp home page GithubHelp logo

servo / rust-azure Goto Github PK

View Code? Open in Web Editor NEW
56.0 29.0 59.0 2.59 MB

Rust bindings to mozilla-central's graphics abstraction layer

License: Mozilla Public License 2.0

Python 0.01% C++ 77.28% Makefile 0.34% C 18.76% Shell 0.01% QMake 0.09% Rust 2.66% HLSL 0.69% CMake 0.17%

rust-azure's Introduction

rust-azure's People

Contributors

adenilson avatar akosthekiss avatar brson avatar daggerbot avatar dzbarsky avatar eijebong avatar emilio avatar fabricedesre avatar frewsxcv avatar glennw avatar gw3583 avatar hyowon avatar hyunjunekim avatar jdm avatar joone avatar kmcallister avatar larsbergstrom avatar manishearth avatar mbrubeck avatar metajack avatar mmatyas avatar mmeyerho avatar mrobinson avatar ms2ger avatar nox avatar pcwalton avatar sammykim avatar simonsapin avatar tetsuharuohzeki avatar vvuk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rust-azure's Issues

Error in create DrawTarget with Skia on OS X (signal: 11)

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)

Need to fix a file which is azure.rc, because build fail.

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";

Does not currently compile

   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

Transmutes from non repr(C) to repr(C) structs

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.

Revert #195

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.