aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/webgltexture.rs
diff options
context:
space:
mode:
authorDaosheng Mu <daoshengmu@gmail.com>2016-05-26 19:02:50 +0800
committerDaosheng Mu <daoshengmu@gmail.com>2016-06-10 01:15:55 +0100
commit9f563e9e43d80684e62876888efbcc5a1cc4fc18 (patch)
tree391d38ad005527783f85ad3d1d05b7ce3aa6829f /components/script/dom/webgltexture.rs
parent9dab66912449dcf3c03206426a68353bc6add201 (diff)
downloadservo-9f563e9e43d80684e62876888efbcc5a1cc4fc18.tar.gz
servo-9f563e9e43d80684e62876888efbcc5a1cc4fc18.zip
Implement texSubImage2D API
Diffstat (limited to 'components/script/dom/webgltexture.rs')
-rw-r--r--components/script/dom/webgltexture.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs
index ccd05182968..bd9f34515ba 100644
--- a/components/script/dom/webgltexture.rs
+++ b/components/script/dom/webgltexture.rs
@@ -109,13 +109,15 @@ impl WebGLTexture {
height: u32,
depth: u32,
internal_format: u32,
- level: u32) -> WebGLResult<()> {
+ level: u32,
+ data_type: Option<u32>) -> WebGLResult<()> {
let image_info = ImageInfo {
width: width,
height: height,
depth: depth,
internal_format: Some(internal_format),
is_initialized: true,
+ data_type: data_type,
};
let face = match target {
@@ -274,6 +276,7 @@ impl WebGLTexture {
depth: 0,
internal_format: base_image_info.internal_format,
is_initialized: base_image_info.is_initialized(),
+ data_type: base_image_info.data_type,
};
self.set_image_infos_at_level(level, image_info);
@@ -346,6 +349,7 @@ pub struct ImageInfo {
depth: u32,
internal_format: Option<u32>,
is_initialized: bool,
+ data_type: Option<u32>,
}
impl ImageInfo {
@@ -356,6 +360,7 @@ impl ImageInfo {
depth: 0,
internal_format: None,
is_initialized: false,
+ data_type: None,
}
}
@@ -371,6 +376,10 @@ impl ImageInfo {
self.internal_format
}
+ pub fn data_type(&self) -> Option<u32> {
+ self.data_type
+ }
+
fn is_power_of_two(&self) -> bool {
self.width.is_power_of_two() && self.height.is_power_of_two() && self.depth.is_power_of_two()
}