aboutsummaryrefslogtreecommitdiffstats
path: root/components
diff options
context:
space:
mode:
authorDavid Zbarsky <dzbarsky@gmail.com>2015-12-15 20:43:38 -0800
committerDavid Zbarsky <dzbarsky@gmail.com>2015-12-15 20:43:38 -0800
commit6a72d4dd128f18c5ff027f363fed51a7fad4531c (patch)
tree3b521639b1f87b22163cbb6e77fa91243b9af0ac /components
parent59a354427923f1c4febd9b8bcd6692900aa10f98 (diff)
downloadservo-6a72d4dd128f18c5ff027f363fed51a7fad4531c.tar.gz
servo-6a72d4dd128f18c5ff027f363fed51a7fad4531c.zip
Implement WebGL scissor method
Diffstat (limited to 'components')
-rw-r--r--components/canvas/webgl_paint_task.rs2
-rw-r--r--components/canvas_traits/lib.rs1
-rw-r--r--components/script/dom/webglrenderingcontext.rs7
-rw-r--r--components/script/dom/webidls/WebGLRenderingContext.webidl2
4 files changed, 11 insertions, 1 deletions
diff --git a/components/canvas/webgl_paint_task.rs b/components/canvas/webgl_paint_task.rs
index ef89fca2303..2073c0ccf81 100644
--- a/components/canvas/webgl_paint_task.rs
+++ b/components/canvas/webgl_paint_task.rs
@@ -111,6 +111,8 @@ impl WebGLPaintTask {
gl::pixel_store_i(name, val),
CanvasWebGLMsg::PolygonOffset(factor, units) =>
gl::polygon_offset(factor, units),
+ CanvasWebGLMsg::Scissor(x, y, width, height) =>
+ gl::scissor(x, y, width, height),
CanvasWebGLMsg::EnableVertexAttribArray(attrib_id) =>
gl::enable_vertex_attrib_array(attrib_id),
CanvasWebGLMsg::GetAttribLocation(program_id, name, chan) =>
diff --git a/components/canvas_traits/lib.rs b/components/canvas_traits/lib.rs
index e2d6e70b875..b98cef63fd6 100644
--- a/components/canvas_traits/lib.rs
+++ b/components/canvas_traits/lib.rs
@@ -175,6 +175,7 @@ pub enum CanvasWebGLMsg {
GetAttribLocation(u32, String, IpcSender<Option<i32>>),
GetUniformLocation(u32, String, IpcSender<Option<i32>>),
PolygonOffset(f32, f32),
+ Scissor(i32, i32, i32, i32),
Hint(u32, u32),
LineWidth(f32),
PixelStorei(u32, i32),
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 1d104bba61b..22e134b1f30 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -906,6 +906,13 @@ impl WebGLRenderingContextMethods for WebGLRenderingContext {
.unwrap()
}
+ // https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.4
+ fn Scissor(&self, x: i32, y: i32, width: i32, height: i32) {
+ self.ipc_renderer
+ .send(CanvasMsg::WebGL(CanvasWebGLMsg::Scissor(x, y, width, height)))
+ .unwrap()
+ }
+
// https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.9
fn LinkProgram(&self, program: Option<&WebGLProgram>) {
if let Some(program) = program {
diff --git a/components/script/dom/webidls/WebGLRenderingContext.webidl b/components/script/dom/webidls/WebGLRenderingContext.webidl
index 6e9e2d19626..c2c82b5ff17 100644
--- a/components/script/dom/webidls/WebGLRenderingContext.webidl
+++ b/components/script/dom/webidls/WebGLRenderingContext.webidl
@@ -618,7 +618,7 @@ interface WebGLRenderingContextBase
//void renderbufferStorage(GLenum target, GLenum internalformat,
// GLsizei width, GLsizei height);
//void sampleCoverage(GLclampf value, GLboolean invert);
- //void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
+ void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
void shaderSource(WebGLShader? shader, DOMString source);