Преглед изворни кода

LibGfx/TinyVG: Parse and ignore `line_width` in paths

TinyVG allows varying the line width along a path, this is not supported
in LibGfx so we just ignore this (but still need to parse the field).
MacDue пре 2 година
родитељ
комит
bebfb81c85
1 измењених фајлова са 6 додато и 0 уклоњено
  1. 6 0
      Userland/Libraries/LibGfx/ImageFormats/TinyVGLoader.cpp

+ 6 - 0
Userland/Libraries/LibGfx/ImageFormats/TinyVGLoader.cpp

@@ -247,6 +247,12 @@ public:
             for (u32 i = 0; i < command_count; i++) {
             for (u32 i = 0; i < command_count; i++) {
                 u8 command_tag = TRY(m_stream.read_value<u8>());
                 u8 command_tag = TRY(m_stream.read_value<u8>());
                 auto path_command = static_cast<PathCommand>(command_tag & 0x7);
                 auto path_command = static_cast<PathCommand>(command_tag & 0x7);
+                bool has_line_width = (command_tag >> 4) & 0b1;
+                if (has_line_width) {
+                    // FIXME: TinyVG allows changing the line width within a path.
+                    // This is not supported in LibGfx, so we currently ignore this.
+                    (void)TRY(read_unit());
+                }
                 switch (path_command) {
                 switch (path_command) {
                 case PathCommand::Line:
                 case PathCommand::Line:
                     path.line_to(TRY(read_point()));
                     path.line_to(TRY(read_point()));