소스 검색

LibWeb/WebGL: Add WebGLRenderingContextBase.isContextLost()

Luke Wilde 3 년 전
부모
커밋
528c7bea03

+ 6 - 0
Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.cpp

@@ -71,6 +71,12 @@ void WebGLRenderingContextBase::needs_to_present()
     m_canvas_element->layout_node()->set_needs_display();
     m_canvas_element->layout_node()->set_needs_display();
 }
 }
 
 
+bool WebGLRenderingContextBase::is_context_lost() const
+{
+    dbgln_if(WEBGL_CONTEXT_DEBUG, "WebGLRenderingContextBase::is_context_lost()");
+    return m_context_lost;
+}
+
 Optional<Vector<String>> WebGLRenderingContextBase::get_supported_extensions() const
 Optional<Vector<String>> WebGLRenderingContextBase::get_supported_extensions() const
 {
 {
     if (m_context_lost)
     if (m_context_lost)

+ 2 - 0
Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.h

@@ -23,6 +23,8 @@ public:
 
 
     void present();
     void present();
 
 
+    bool is_context_lost() const;
+
     Optional<Vector<String>> get_supported_extensions() const;
     Optional<Vector<String>> get_supported_extensions() const;
     JS::Object* get_extension(String const& name) const;
     JS::Object* get_extension(String const& name) const;
 
 

+ 2 - 0
Userland/Libraries/LibWeb/WebGL/WebGLRenderingContextBase.idl

@@ -18,6 +18,8 @@ interface mixin WebGLRenderingContextBase {
     //       IDL code generator. This also allows us to handle the return type ourselves instead of adding the complexity of the
     //       IDL code generator. This also allows us to handle the return type ourselves instead of adding the complexity of the
     //       code generator working out the return type and returning the appropriate value to return on context loss.
     //       code generator working out the return type and returning the appropriate value to return on context loss.
 
 
+    boolean isContextLost();
+
     sequence<DOMString>? getSupportedExtensions();
     sequence<DOMString>? getSupportedExtensions();
     object? getExtension(DOMString name);
     object? getExtension(DOMString name);