Explorar o código

LibPDF: Don't abort on unsupported drawing operations

Instead of calling TODO(), which will abort the program, we now return
an Error specifying that we haven't implemented the drawing operation
yet. This will now nicely trickle up all the way through to the
PDFViewer, which will then notify its clients about the problem.
Rodrigo Tobar %!s(int64=2) %!d(string=hai) anos
pai
achega
c4bc27f274
Modificáronse 1 ficheiros con 4 adicións e 5 borrados
  1. 4 5
      Userland/Libraries/LibPDF/Renderer.cpp

+ 4 - 5
Userland/Libraries/LibPDF/Renderer.cpp

@@ -13,11 +13,10 @@
 #define RENDERER_HANDLER(name) \
     PDFErrorOr<void> Renderer::handle_##name([[maybe_unused]] Vector<Value> const& args, [[maybe_unused]] Optional<NonnullRefPtr<DictObject>> extra_resources)
 
-#define RENDERER_TODO(name)                                         \
-    RENDERER_HANDLER(name)                                          \
-    {                                                               \
-        dbgln("[PDF::Renderer] Unsupported draw operation " #name); \
-        TODO();                                                     \
+#define RENDERER_TODO(name)                                                        \
+    RENDERER_HANDLER(name)                                                         \
+    {                                                                              \
+        return Error(Error::Type::RenderingUnsupported, "draw operation: " #name); \
     }
 
 namespace PDF {