PDA

View Full Version : [2.7.3] SWRender patch to handle cl_line_strip



moogtrain
06-26-2013, 04:22 PM
I was trying to draw some audio waveforms, and then I found that draw_primitives on SWRender does not handle cl_line_strip at all. It's the same on the current 2.7 SVN.


--- a/Sources/SWRender/swr_graphic_context_provider.cpp
+++ b/Sources/SWRender/swr_graphic_context_provider.cpp
@@ -265,6 +265,13 @@
for (int i = offset; i+1 < end_vertices; i+=2)
draw_line(i+0, i+1);
}
+ else if (type == cl_line_strip)
+ {
+ int end_vertices = offset+num_vertices;
+
+ for (int i = offset; i < end_vertices-1; i++)
+ draw_line(i, i+1);
+ }
else if (type == cl_line_loop)
{
int end_vertices = offset+num_vertices;
@@ -302,6 +309,11 @@
for (int i = 0; i+1 < count; i+=2)
draw_line(indices[i], indices[i+1]);
}
+ else if (type == cl_line_strip)
+ {
+ for (int i = 0; i < count-1; i++)
+ draw_line(indices[i], indices[i+1]);
+ }
else if (type == cl_line_loop)
{
int i;
@@ -334,6 +346,11 @@
for (int i = 0; i+1 < count; i+=2)
draw_line(indices[i], indices[i+1]);
}
+ else if (type == cl_line_strip)
+ {
+ for (int i = 0; i < count-1; i++)
+ draw_line(indices[i], indices[i+1]);
+ }
else if (type == cl_line_loop)
{
int i;
@@ -366,6 +383,11 @@
for (int i = 0; i+1 < count; i+=2)
draw_line(indices[i], indices[i+1]);
}
+ else if (type == cl_line_strip)
+ {
+ for (int i = 0; i < count-1; i++)
+ draw_line(indices[i], indices[i+1]);
+ }
else if (type == cl_line_loop)
{
int i;

rombust
06-27-2013, 07:21 AM
Applied patch to ClanLib 2.3 SVN and modified patch to ClanLib 3.0 SVN

Many thanks