aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--components/canvas/canvas_data.rs6
-rw-r--r--components/canvas/canvas_paint_thread.rs2
-rw-r--r--components/canvas_traits/canvas.rs2
-rw-r--r--components/constellation/constellation.rs2
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs31
-rw-r--r--components/script/dom/offscreencanvasrenderingcontext2d.rs2
-rw-r--r--components/script_traits/script_msg.rs2
7 files changed, 34 insertions, 13 deletions
diff --git a/components/canvas/canvas_data.rs b/components/canvas/canvas_data.rs
index 81e4bbe4bba..beb29242b5e 100644
--- a/components/canvas/canvas_data.rs
+++ b/components/canvas/canvas_data.rs
@@ -176,7 +176,7 @@ pub struct CanvasData<'a> {
impl<'a> CanvasData<'a> {
pub fn new(
- size: Size2D<u32>,
+ size: Size2D<u64>,
webrender_api_sender: webrender_api::RenderApiSender,
antialias: AntialiasMode,
canvas_id: CanvasId,
@@ -708,13 +708,13 @@ impl<'a> CanvasData<'a> {
.set_composition_op(op.to_azure_style());
}
- pub fn create(size: Size2D<u32>) -> DrawTarget {
+ pub fn create(size: Size2D<u64>) -> DrawTarget {
// FIXME(nox): Why is the size made of i32 values?
DrawTarget::new(BackendType::Skia, size.to_i32(), SurfaceFormat::B8G8R8A8)
}
pub fn recreate(&mut self, size: Size2D<u32>) {
- self.drawtarget = CanvasData::create(size);
+ self.drawtarget = CanvasData::create(Size2D::new(size.width as u64, size.height as u64));
self.state = CanvasPaintState::new(self.state.draw_options.antialias);
self.saved_states.clear();
// Webrender doesn't let images change size, so we clear the webrender image key.
diff --git a/components/canvas/canvas_paint_thread.rs b/components/canvas/canvas_paint_thread.rs
index 582512b8e44..b9e0a4fbd45 100644
--- a/components/canvas/canvas_paint_thread.rs
+++ b/components/canvas/canvas_paint_thread.rs
@@ -77,7 +77,7 @@ impl<'a> CanvasPaintThread<'a> {
pub fn create_canvas(
&mut self,
- size: Size2D<u32>,
+ size: Size2D<u64>,
webrender_api_sender: webrender_api::RenderApiSender,
antialias: bool,
) -> CanvasId {
diff --git a/components/canvas_traits/canvas.rs b/components/canvas_traits/canvas.rs
index 49f4690f015..7f3d0ef20ca 100644
--- a/components/canvas_traits/canvas.rs
+++ b/components/canvas_traits/canvas.rs
@@ -23,7 +23,7 @@ pub enum CanvasMsg {
Canvas2d(Canvas2dMsg, CanvasId),
Create(
IpcSender<CanvasId>,
- Size2D<u32>,
+ Size2D<u64>,
webrender_api::RenderApiSender,
bool,
),
diff --git a/components/constellation/constellation.rs b/components/constellation/constellation.rs
index e4120579912..0a0dafb03e8 100644
--- a/components/constellation/constellation.rs
+++ b/components/constellation/constellation.rs
@@ -3067,7 +3067,7 @@ where
fn handle_create_canvas_paint_thread_msg(
&mut self,
- size: Size2D<u32>,
+ size: Size2D<u64>,
response_sender: IpcSender<(IpcSender<CanvasMsg>, CanvasId)>,
) {
let webrender_api = self.webrender_api_sender.clone();
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index 285925b7302..67c18ff0c22 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -132,17 +132,38 @@ pub struct CanvasState {
}
impl CanvasState {
- pub fn new(global: &GlobalScope) -> CanvasState {
+ pub fn new(
+ global: &GlobalScope,
+ size: Size2D<u64>,
+ ) -> CanvasState {
+ debug!("Creating new canvas rendering context.");
let (sender, receiver) =
profiled_ipc::channel(global.time_profiler_chan().clone()).unwrap();
+ let script_to_constellation_chan = global.script_to_constellation_chan();
+ debug!("Asking constellation to create new canvas thread.");
+ script_to_constellation_chan
+ .send(ScriptMsg::CreateCanvasPaintThread(size, sender))
+ .unwrap();
let (ipc_renderer, canvas_id) = receiver.recv().unwrap();
debug!("Done.");
CanvasState {
- //reflector_: Reflector::new(),
ipc_renderer: ipc_renderer,
canvas_id: canvas_id,
+
}
}
+ /*pub fn new(
+ global: &GlobalScope,
+ size: Size2D<u32>,
+ ) -> CanvasState {
+
+ /*let boxed = Box::new(CanvasState::new_inherited(
+ global,
+ size,
+ ));
+
+ reflect_dom_object(boxed, global, CanvasState)*/
+ }*/
pub fn get_canvas_id(&self) -> CanvasId {
self.canvas_id.clone()
@@ -199,7 +220,7 @@ impl CanvasRenderingContext2D {
base_url: ServoUrl,
size: Size2D<u32>,
) -> CanvasRenderingContext2D {
- debug!("Creating new canvas rendering context.");
+ /*debug!("Creating new canvas rendering context.");
let (sender, receiver) =
profiled_ipc::channel(global.time_profiler_chan().clone()).unwrap();
let script_to_constellation_chan = global.script_to_constellation_chan();
@@ -208,7 +229,7 @@ impl CanvasRenderingContext2D {
.send(ScriptMsg::CreateCanvasPaintThread(size, sender))
.unwrap();
//let (canvas_state.ipc_renderer, canvas_id) = receiver.recv().unwrap();
- debug!("Done.");
+ debug!("Done.");*/
CanvasRenderingContext2D {
reflector_: Reflector::new(),
canvas: canvas.map(Dom::from_ref),
@@ -220,7 +241,7 @@ impl CanvasRenderingContext2D {
saved_states: DomRefCell::new(Vec::new()),
origin_clean: Cell::new(true),
//canvas_id: canvas_id,
- canvas_state: DomRefCell::new(CanvasState::new(global)),
+ canvas_state: DomRefCell::new(CanvasState::new(global,Size2D::new(size.width as u64, size.height as u64))),
}
}
diff --git a/components/script/dom/offscreencanvasrenderingcontext2d.rs b/components/script/dom/offscreencanvasrenderingcontext2d.rs
index bf1e8058f3e..34c91d42460 100644
--- a/components/script/dom/offscreencanvasrenderingcontext2d.rs
+++ b/components/script/dom/offscreencanvasrenderingcontext2d.rs
@@ -29,7 +29,7 @@ impl OffscreenCanvasRenderingContext2D {
OffscreenCanvasRenderingContext2D {
reflector_: Reflector::new(),
canvas: canvas.map(Dom::from_ref),
- canvas_state: DomRefCell::new(CanvasState::new(_global)),
+ canvas_state: DomRefCell::new(CanvasState::new(_global,_size)),
}
}
diff --git a/components/script_traits/script_msg.rs b/components/script_traits/script_msg.rs
index 33cc94d0128..40b0a939440 100644
--- a/components/script_traits/script_msg.rs
+++ b/components/script_traits/script_msg.rs
@@ -121,7 +121,7 @@ pub enum ScriptMsg {
ChangeRunningAnimationsState(AnimationState),
/// Requests that a new 2D canvas thread be created. (This is done in the constellation because
/// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.)
- CreateCanvasPaintThread(Size2D<u32>, IpcSender<(IpcSender<CanvasMsg>, CanvasId)>),
+ CreateCanvasPaintThread(Size2D<u64>, IpcSender<(IpcSender<CanvasMsg>, CanvasId)>),
/// Notifies the constellation that this frame has received focus.
Focus,
/// Requests that the constellation retrieve the current contents of the clipboard