Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Commit 6eaa061

Browse files
committed
Upgrade to rustc 1.0.0-dev (47551b574 2015-04-14) (built 2015-03-18)
1 parent 9c8d119 commit 6eaa061

File tree

12 files changed

+86
-86
lines changed

12 files changed

+86
-86
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ authors = ["The Servo Project Developers"]
66

77
[dependencies]
88
libc = "*"
9+
rustc-serialize = "*"
10+
log = "*"
911

1012
[dependencies.geom]
1113

src/color.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// option. This file may not be copied, modified, or distributed
88
// except according to those terms.
99

10-
#[derive(Copy)]
10+
#[derive(Copy, Clone)]
1111
pub struct Color {
1212
pub r: f32,
1313
pub g: f32,

src/geometry.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
/// One hardware pixel.
1313
///
1414
/// This unit corresponds to the smallest addressable element of the display hardware.
15-
#[derive(Copy, RustcEncodable)]
15+
#[derive(Copy, Clone, RustcEncodable)]
1616
pub enum DevicePixel {}
1717

1818
/// One pixel in layer coordinate space.
1919
///
2020
/// This unit corresponds to a "pixel" in layer coordinate space, which after scaling and
2121
/// transformation becomes a device pixel.
22-
#[derive(Copy, RustcEncodable)]
22+
#[derive(Copy, Clone, RustcEncodable)]
2323
pub enum LayerPixel {}
2424

2525

src/layers.rs

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,11 @@ use geom::rect::{Rect, TypedRect};
1919
use platform::surface::{NativeCompositingGraphicsContext, NativePaintingGraphicsContext};
2020
use platform::surface::NativeSurface;
2121
use std::cell::{RefCell, RefMut};
22-
use std::num::Float;
2322
use std::rc::Rc;
2423

2524
#[derive(Clone, Copy, PartialEq, PartialOrd)]
2625
pub struct ContentAge {
27-
age: uint,
26+
age: usize,
2827
}
2928

3029
impl ContentAge {
@@ -42,7 +41,7 @@ impl ContentAge {
4241
pub struct Layer<T> {
4342
pub children: RefCell<Vec<Rc<Layer<T>>>>,
4443
pub transform: RefCell<Matrix4<f32>>,
45-
pub tile_size: uint,
44+
pub tile_size: usize,
4645
pub extra_data: RefCell<T>,
4746
tile_grid: RefCell<TileGrid>,
4847

@@ -67,7 +66,7 @@ pub struct Layer<T> {
6766

6867
impl<T> Layer<T> {
6968
pub fn new(bounds: TypedRect<LayerPixel, f32>,
70-
tile_size: uint,
69+
tile_size: usize,
7170
background_color: Color,
7271
opacity: f32,
7372
data: T)
@@ -142,7 +141,7 @@ impl<T> Layer<T> {
142141
#[derive(Clone, Copy)]
143142
pub struct BufferRequest {
144143
// The rect in pixels that will be drawn to the screen
145-
pub screen_rect: Rect<uint>,
144+
pub screen_rect: Rect<usize>,
146145

147146
// The rect in page coordinates that this tile represents
148147
pub page_rect: Rect<f32>,
@@ -152,7 +151,7 @@ pub struct BufferRequest {
152151
}
153152

154153
impl BufferRequest {
155-
pub fn new(screen_rect: Rect<uint>,
154+
pub fn new(screen_rect: Rect<usize>,
156155
page_rect: Rect<f32>,
157156
content_age: ContentAge)
158157
-> BufferRequest {
@@ -173,13 +172,13 @@ pub struct LayerBuffer {
173172
pub rect: Rect<f32>,
174173

175174
/// The rect in pixels that will be drawn to the screen.
176-
pub screen_pos: Rect<uint>,
175+
pub screen_pos: Rect<usize>,
177176

178177
/// The scale at which this tile is rendered
179178
pub resolution: f32,
180179

181180
/// NB: stride is in pixels, like OpenGL GL_UNPACK_ROW_LENGTH.
182-
pub stride: uint,
181+
pub stride: usize,
183182

184183
/// Whether or not this buffer was painted with the CPU rasterization.
185184
pub painted_with_cpu: bool,
@@ -190,7 +189,7 @@ pub struct LayerBuffer {
190189

191190
impl LayerBuffer {
192191
/// Returns the amount of memory used by the tile
193-
pub fn get_mem(&self) -> uint {
192+
pub fn get_mem(&self) -> usize {
194193
// This works for now, but in the future we may want a better heuristic
195194
self.screen_pos.size.width * self.screen_pos.size.height
196195
}
@@ -201,7 +200,7 @@ impl LayerBuffer {
201200
}
202201

203202
/// Returns the Size2D of the tile
204-
pub fn get_size_2d(&self) -> Size2D<uint> {
203+
pub fn get_size_2d(&self) -> Size2D<usize> {
205204
self.screen_pos.size
206205
}
207206

src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
#![crate_name = "layers"]
1111
#![crate_type = "rlib"]
1212

13-
#![allow(raw_pointer_deriving)]
14-
#![feature(int_uint)]
13+
#![allow(raw_pointer_derive)]
14+
#![feature(collections, std_misc, core)]
1515

1616
extern crate azure;
1717
extern crate geom;
1818
extern crate libc;
1919
#[macro_use]
2020
extern crate log;
21-
extern crate "serialize" as rustc_serialize;
21+
extern crate rustc_serialize;
2222
extern crate gleam;
2323
extern crate skia;
2424

src/platform/android/surface.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,10 @@ impl EGLImageNativeSurface {
134134
}
135135
}
136136

137-
pub fn get_id(&self) -> int {
137+
pub fn get_id(&self) -> isize {
138138
match self.image {
139139
None => 0,
140-
Some(image_khr) => image_khr as int,
140+
Some(image_khr) => image_khr as isize,
141141
}
142142
}
143143

src/platform/linux/surface.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ use libc::{c_char, c_int, c_uint, c_void};
1818
use glx;
1919
use gleam::gl;
2020
use skia::{SkiaSkNativeSharedGLContextRef, SkiaSkNativeSharedGLContextStealSurface};
21-
use std::ascii::{AsciiExt, OwnedAsciiExt};
22-
use std::ffi::{CString, c_str_to_bytes};
21+
use std::ascii::OwnedAsciiExt;
22+
use std::ffi::{CString, CStr};
2323
use std::mem;
2424
use std::ptr;
2525
use std::str;
@@ -60,7 +60,7 @@ impl NativePaintingGraphicsContext {
6060
/// someday.
6161
///
6262
/// FIXME(pcwalton): Mark nonsendable.
63-
#[derive(Copy)]
63+
#[derive(Copy, Clone)]
6464
pub struct NativeCompositingGraphicsContext {
6565
display: *mut Display,
6666
framebuffer_configuration: Option<glx::types::GLXFBConfig>,
@@ -142,7 +142,7 @@ impl NativeCompositingGraphicsContext {
142142
panic!("Could not determine GLX vendor.");
143143
}
144144
let glx_vendor =
145-
str::from_utf8(c_str_to_bytes(&glx_vendor))
145+
str::from_utf8(CStr::from_ptr(glx_vendor).to_bytes())
146146
.ok()
147147
.expect("GLX client vendor string not in UTF-8 format.");
148148
let glx_vendor = String::from_str(glx_vendor).into_ascii_lowercase();
@@ -178,7 +178,7 @@ impl NativeGraphicsMetadata {
178178
// the X Pixmap will not be sharable across them. Using this
179179
// method breaks that assumption.
180180
unsafe {
181-
let mut c_str = CString::from_slice(descriptor.display.as_bytes());
181+
let c_str = CString::new(descriptor.display.as_bytes()).unwrap();
182182
let display = XOpenDisplay(c_str.as_ptr() as *mut _);
183183
if display.is_null() {
184184
panic!("XOpenDisplay() failed!");
@@ -201,7 +201,7 @@ impl NativeGraphicsMetadataDescriptor {
201201
pub fn from_metadata(metadata: NativeGraphicsMetadata) -> NativeGraphicsMetadataDescriptor {
202202
unsafe {
203203
let c_str = XDisplayString(metadata.display) as *const _;
204-
let bytes = c_str_to_bytes(&c_str);
204+
let bytes = CStr::from_ptr(c_str).to_bytes();
205205
NativeGraphicsMetadataDescriptor {
206206
display: str::from_utf8(bytes).unwrap().to_string(),
207207
}
@@ -265,7 +265,7 @@ impl PixmapNativeSurface {
265265
pub fn bind_to_texture(&self,
266266
native_context: &NativeCompositingGraphicsContext,
267267
texture: &Texture,
268-
size: Size2D<int>) {
268+
size: Size2D<isize>) {
269269
// Create the GLX pixmap.
270270
//
271271
// FIXME(pcwalton): RAII for exception safety?
@@ -352,8 +352,8 @@ impl PixmapNativeSurface {
352352
}
353353
}
354354

355-
pub fn get_id(&self) -> int {
356-
self.pixmap as int
355+
pub fn get_id(&self) -> isize {
356+
self.pixmap as isize
357357
}
358358

359359
pub fn destroy(&mut self, graphics_context: &NativePaintingGraphicsContext) {

src/platform/macos/surface.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ impl IOSurfaceNativeSurface {
213213
pub fn bind_to_texture(&self,
214214
_: &NativeCompositingGraphicsContext,
215215
texture: &Texture,
216-
size: Size2D<int>) {
216+
size: Size2D<isize>) {
217217
let _bound_texture = texture.bind();
218218
let io_surface = io_surface::lookup(self.io_surface_id.unwrap());
219219
io_surface.bind_to_gl_texture(size)
@@ -224,10 +224,10 @@ impl IOSurfaceNativeSurface {
224224
io_surface.upload(data)
225225
}
226226

227-
pub fn get_id(&self) -> int {
227+
pub fn get_id(&self) -> isize {
228228
match self.io_surface_id {
229229
None => 0,
230-
Some(id) => id as int,
230+
Some(id) => id as isize,
231231
}
232232
}
233233

src/platform/surface.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ impl NativeSurface {
145145
pub fn bind_to_texture(&self,
146146
native_context: &NativeCompositingGraphicsContext,
147147
texture: &Texture,
148-
size: Size2D<int>) {
148+
size: Size2D<isize>) {
149149
native_surface_method!(self bind_to_texture (native_context, texture, size))
150150
}
151151

@@ -155,7 +155,7 @@ impl NativeSurface {
155155
}
156156

157157
/// Returns an opaque ID identifying the surface for debugging.
158-
pub fn get_id(&self) -> int {
158+
pub fn get_id(&self) -> isize {
159159
native_surface_method!(self get_id ())
160160
}
161161

@@ -205,7 +205,7 @@ impl MemoryBufferNativeSurface {
205205

206206
/// This may only be called on the compositor side.
207207
#[cfg(not(target_os="android"))]
208-
pub fn bind_to_texture(&self, _: &NativeCompositingGraphicsContext, texture: &Texture, size: Size2D<int>) {
208+
pub fn bind_to_texture(&self, _: &NativeCompositingGraphicsContext, texture: &Texture, size: Size2D<isize>) {
209209
let _bound = texture.bind();
210210
gl::tex_image_2d(gl::TEXTURE_2D,
211211
0,
@@ -215,11 +215,11 @@ impl MemoryBufferNativeSurface {
215215
0,
216216
gl::BGRA,
217217
gl::UNSIGNED_BYTE,
218-
Some(self.bytes.as_slice()));
218+
Some(&self.bytes));
219219
}
220220

221221
#[cfg(target_os="android")]
222-
pub fn bind_to_texture(&self, _: &NativeCompositingGraphicsContext, _: &Texture, _: Size2D<int>) {
222+
pub fn bind_to_texture(&self, _: &NativeCompositingGraphicsContext, _: &Texture, _: Size2D<isize>) {
223223
panic!("Binding a memory surface to a texture is not yet supported on Android.");
224224
}
225225

@@ -229,7 +229,7 @@ impl MemoryBufferNativeSurface {
229229
self.bytes.push_all(data);
230230
}
231231

232-
pub fn get_id(&self) -> int {
232+
pub fn get_id(&self) -> isize {
233233
0
234234
}
235235

0 commit comments

Comments
 (0)