diff options
author | Daniel Robertson <dan.robertson@anidata.org> | 2016-05-21 10:50:47 -0400 |
---|---|---|
committer | Daniel Robertson <dan.robertson@anidata.org> | 2016-05-23 22:29:23 -0400 |
commit | 867cd9be293d18c3d1ddedd7e6ae886f04da1b0e (patch) | |
tree | d2e2513a5e4af362e1f3c98a3338ad2851d87e8d /components/script/dom/webgltexture.rs | |
parent | f1efeb00af4cbc2a63e09d7c50b603dd1fee2df5 (diff) | |
download | servo-867cd9be293d18c3d1ddedd7e6ae886f04da1b0e.tar.gz servo-867cd9be293d18c3d1ddedd7e6ae886f04da1b0e.zip |
Impl copyTexImage2D and copyTexSubImage2D
Implement copyTexImage2D and copyTexSubImage2D for
WebGLRenderingContext.
Diffstat (limited to 'components/script/dom/webgltexture.rs')
-rw-r--r-- | components/script/dom/webgltexture.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/components/script/dom/webgltexture.rs b/components/script/dom/webgltexture.rs index df636a1db59..ccd05182968 100644 --- a/components/script/dom/webgltexture.rs +++ b/components/script/dom/webgltexture.rs @@ -309,7 +309,7 @@ impl WebGLTexture { true } - fn image_info_at_face(&self, face: u8, level: u32) -> ImageInfo { + pub fn image_info_at_face(&self, face: u8, level: u32) -> ImageInfo { let pos = (level * self.face_count.get() as u32) + face as u32; self.image_info_array.borrow()[pos as usize] } @@ -340,7 +340,7 @@ impl Drop for WebGLTexture { } #[derive(Clone, Copy, PartialEq, Debug, JSTraceable, HeapSizeOf)] -struct ImageInfo { +pub struct ImageInfo { width: u32, height: u32, depth: u32, @@ -359,6 +359,18 @@ impl ImageInfo { } } + pub fn width(&self) -> u32 { + self.width + } + + pub fn height(&self) -> u32 { + self.height + } + + pub fn internal_format(&self) -> Option<u32> { + self.internal_format + } + 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() } |