Skip to content

Commit

Permalink
LibPDF: Let LineDashPattern store data as floats
Browse files Browse the repository at this point in the history
We used to store them as ints, which threw away information.
In practice, files do use fractional values for these.
  • Loading branch information
nico committed Nov 7, 2024
1 parent d569238 commit ebf67de
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Userland/Libraries/LibPDF/Renderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,10 @@ RENDERER_HANDLER(set_miter_limit)
RENDERER_HANDLER(set_dash_pattern)
{
auto dash_array = MUST(m_document->resolve_to<ArrayObject>(args[0]));
Vector<int> pattern;
Vector<float> pattern;
for (auto& element : *dash_array)
pattern.append(element.to_int());
state().line_dash_pattern = LineDashPattern { pattern, args[1].to_int() };
pattern.append(element.to_float());
state().line_dash_pattern = LineDashPattern { pattern, args[1].to_float() };
return {};
}

Expand Down
4 changes: 2 additions & 2 deletions Userland/Libraries/LibPDF/Renderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ enum class LineJoinStyle : u8 {
};

struct LineDashPattern {
Vector<int> pattern;
int phase;
Vector<float> pattern;
float phase;
};

enum class TextRenderingMode : u8 {
Expand Down

0 comments on commit ebf67de

Please sign in to comment.