mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Support fetching viewport info
This commit is contained in:
parent
e259ff727e
commit
7e043a33f1
9 changed files with 125 additions and 6 deletions
|
@ -157,6 +157,7 @@ pub struct WebGLRenderingContext {
|
|||
current_scissor: Cell<(i32, i32, u32, u32)>,
|
||||
#[ignore_malloc_size_of = "Because it's small"]
|
||||
current_clear_color: Cell<(f32, f32, f32, f32)>,
|
||||
size: Cell<Size2D<u32>>,
|
||||
extension_manager: WebGLExtensions,
|
||||
capabilities: Capabilities,
|
||||
default_vao: DomOnceCell<WebGLVertexArrayObjectOES>,
|
||||
|
@ -211,6 +212,7 @@ impl WebGLRenderingContext {
|
|||
current_program: MutNullableDom::new(None),
|
||||
current_vertex_attrib_0: Cell::new((0f32, 0f32, 0f32, 1f32)),
|
||||
current_scissor: Cell::new((0, 0, size.width, size.height)),
|
||||
size: Cell::new(size),
|
||||
current_clear_color: Cell::new((0.0, 0.0, 0.0, 0.0)),
|
||||
extension_manager: WebGLExtensions::new(webgl_version),
|
||||
capabilities: Default::default(),
|
||||
|
@ -266,6 +268,7 @@ impl WebGLRenderingContext {
|
|||
pub fn recreate(&self, size: Size2D<u32>) {
|
||||
let (sender, receiver) = webgl_channel().unwrap();
|
||||
self.webgl_sender.send_resize(size, sender).unwrap();
|
||||
self.size.set(size);
|
||||
|
||||
if let Err(msg) = receiver.recv().unwrap() {
|
||||
error!("Error resizing WebGLContext: {}", msg);
|
||||
|
@ -340,6 +343,10 @@ impl WebGLRenderingContext {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn size(&self) -> Size2D<u32> {
|
||||
self.size.get()
|
||||
}
|
||||
|
||||
// Helper function for validating framebuffer completeness in
|
||||
// calls touching the framebuffer. From the GLES 2.0.25 spec,
|
||||
// page 119:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue