aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webglrenderingcontext.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <me@emiliocobos.me>2016-04-20 20:24:56 +0200
committerEmilio Cobos Álvarez <me@emiliocobos.me>2016-04-20 20:24:56 +0200
commit21e2f97cfaf805c9e8f53e515c717ad263d3b891 (patch)
treefa47aa6345e453775f632b53241e7801fe709068 /components/script/dom/webglrenderingcontext.rs
parent1ad7f73caf3965621238cceebb19fe3a8203ed8f (diff)
downloadservo-21e2f97cfaf805c9e8f53e515c717ad263d3b891.tar.gz
servo-21e2f97cfaf805c9e8f53e515c717ad263d3b891.zip
webgl: Fix filling a non-zero level
You can fill a level > 0 as long as the width and height values are power of two, so the previous test was bogus.
Diffstat (limited to 'components/script/dom/webglrenderingcontext.rs')
-rw-r--r--components/script/dom/webglrenderingcontext.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index 551a1874b0c..51a53cb3435 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -251,13 +251,10 @@ impl WebGLRenderingContext {
// If an attempt is made to call this function with no
// WebGLTexture bound, an INVALID_OPERATION error is generated.
- let texture = match texture {
- Some(texture) => texture,
- None => {
- self.webgl_error(InvalidOperation);
- return false;
- }
- };
+ if texture.is_none() {
+ self.webgl_error(InvalidOperation);
+ return false;
+ }
// GL_INVALID_ENUM is generated if data_type is not an accepted value.
match data_type {
@@ -324,7 +321,9 @@ impl WebGLRenderingContext {
// GL_INVALID_VALUE is generated if level is greater than zero and the
// texture and the texture is not power of two.
- if level > 0 && !texture.is_power_of_two() {
+ if level > 0 &&
+ (!(width as u32).is_power_of_two() ||
+ !(height as u32).is_power_of_two()) {
self.webgl_error(InvalidValue);
return false;
}