@@ -748,8 +748,9 @@ struct Triangle {
748
748
u32 c;
749
749
};
750
750
751
- PDFErrorOr<void > draw_gouraud_triangles (Gfx::Painter& painter, Gfx::AffineTransform const & ctm, NonnullRefPtr<ColorSpace> color_space, GouraudFunctionsType const & functions, Vector<Triangle> const & triangles, Vector<float > const & vertex_data, size_t number_of_components )
751
+ PDFErrorOr<void > draw_gouraud_triangles (Gfx::Painter& painter, Gfx::AffineTransform const & ctm, NonnullRefPtr<ColorSpace> color_space, GouraudFunctionsType const & functions, Vector<Triangle> const & triangles, Vector<float > const & vertex_data)
752
752
{
753
+ size_t const number_of_components = !functions.has <Empty>() ? 1 : color_space->number_of_components ();
753
754
bool is_indexed = color_space->family () == ColorSpaceFamily::Indexed;
754
755
RefPtr<IndexedColorSpace> indexed_color_space;
755
756
if (is_indexed) {
@@ -797,10 +798,9 @@ class FreeFormGouraudShading final : public Shading {
797
798
virtual PDFErrorOr<void > draw (Gfx::Painter&, Gfx::AffineTransform const &) override ;
798
799
799
800
private:
800
- FreeFormGouraudShading (CommonEntries common_entries, Vector<float > vertex_data, size_t number_of_components, Vector<Triangle> triangles, GouraudFunctionsType functions)
801
+ FreeFormGouraudShading (CommonEntries common_entries, Vector<float > vertex_data, Vector<Triangle> triangles, GouraudFunctionsType functions)
801
802
: m_common_entries(move(common_entries))
802
803
, m_vertex_data(move(vertex_data))
803
- , m_number_of_components(number_of_components)
804
804
, m_triangles(move(triangles))
805
805
, m_functions(move(functions))
806
806
{
@@ -810,7 +810,6 @@ class FreeFormGouraudShading final : public Shading {
810
810
811
811
// Interleaved x, y, c0, c1, c2, ...
812
812
Vector<float > m_vertex_data;
813
- size_t m_number_of_components { 0 };
814
813
Vector<Triangle> m_triangles;
815
814
GouraudFunctionsType m_functions;
816
815
};
@@ -938,12 +937,12 @@ PDFErrorOr<NonnullRefPtr<FreeFormGouraudShading>> FreeFormGouraudShading::create
938
937
}
939
938
}
940
939
941
- return adopt_ref (*new FreeFormGouraudShading (move (common_entries), move (vertex_data), number_of_components, move (triangles), move (functions)));
940
+ return adopt_ref (*new FreeFormGouraudShading (move (common_entries), move (vertex_data), move (triangles), move (functions)));
942
941
}
943
942
944
943
PDFErrorOr<void > FreeFormGouraudShading::draw (Gfx::Painter& painter, Gfx::AffineTransform const & ctm)
945
944
{
946
- return draw_gouraud_triangles (painter, ctm, m_common_entries.color_space , m_functions, m_triangles, m_vertex_data, m_number_of_components );
945
+ return draw_gouraud_triangles (painter, ctm, m_common_entries.color_space , m_functions, m_triangles, m_vertex_data);
947
946
}
948
947
949
948
class LatticeFormGouraudShading final : public Shading {
@@ -953,10 +952,9 @@ class LatticeFormGouraudShading final : public Shading {
953
952
virtual PDFErrorOr<void > draw (Gfx::Painter&, Gfx::AffineTransform const &) override ;
954
953
955
954
private:
956
- LatticeFormGouraudShading (CommonEntries common_entries, Vector<float > vertex_data, size_t number_of_components, Vector<Triangle> triangles, GouraudFunctionsType functions)
955
+ LatticeFormGouraudShading (CommonEntries common_entries, Vector<float > vertex_data, Vector<Triangle> triangles, GouraudFunctionsType functions)
957
956
: m_common_entries(move(common_entries))
958
957
, m_vertex_data(move(vertex_data))
959
- , m_number_of_components(number_of_components)
960
958
, m_triangles(move(triangles))
961
959
, m_functions(move(functions))
962
960
{
@@ -966,7 +964,6 @@ class LatticeFormGouraudShading final : public Shading {
966
964
967
965
// Interleaved x, y, c0, c1, c2, ...
968
966
Vector<float > m_vertex_data;
969
- size_t m_number_of_components { 0 };
970
967
Vector<Triangle> m_triangles;
971
968
GouraudFunctionsType m_functions;
972
969
};
@@ -1084,12 +1081,12 @@ PDFErrorOr<NonnullRefPtr<LatticeFormGouraudShading>> LatticeFormGouraudShading::
1084
1081
}
1085
1082
}
1086
1083
1087
- return adopt_ref (*new LatticeFormGouraudShading (move (common_entries), move (vertex_data), number_of_components, move (triangles), move (functions)));
1084
+ return adopt_ref (*new LatticeFormGouraudShading (move (common_entries), move (vertex_data), move (triangles), move (functions)));
1088
1085
}
1089
1086
1090
1087
PDFErrorOr<void > LatticeFormGouraudShading::draw (Gfx::Painter& painter, Gfx::AffineTransform const & ctm)
1091
1088
{
1092
- return draw_gouraud_triangles (painter, ctm, m_common_entries.color_space , m_functions, m_triangles, m_vertex_data, m_number_of_components );
1089
+ return draw_gouraud_triangles (painter, ctm, m_common_entries.color_space , m_functions, m_triangles, m_vertex_data);
1093
1090
}
1094
1091
1095
1092
class CoonsPatchShading final : public Shading {
0 commit comments