... |
... |
@@ -67,13 +67,13 @@ swap( long int* a, long int* b ) |
67
|
67
|
|
68
|
68
|
|
69
|
69
|
void
|
70
|
|
-dense_render_line( dense_worker* worker, TPos to_x, TPos to_y )
|
|
70
|
+dense_render_line( dense_worker* worker, TPos tox, TPos toy )
|
71
|
71
|
{
|
72
|
72
|
// printf("line from: %d, %d to %d, %d\n", worker->prev_x, worker->prev_y,
|
73
|
73
|
// to_x, to_y);
|
74
|
|
- TPos from_x = worker->prev_x;
|
75
|
|
- TPos from_y = worker->prev_y;
|
76
|
|
- if ( from_y == to_y )
|
|
74
|
+ float from_x = worker->prev_x;
|
|
75
|
+ float from_y = worker->prev_y;
|
|
76
|
+ if ( from_y == toy )
|
77
|
77
|
return;
|
78
|
78
|
|
79
|
79
|
// aP0.m_x -= worker->m_origin_x;
|
... |
... |
@@ -81,10 +81,18 @@ dense_render_line( dense_worker* worker, TPos to_x, TPos to_y ) |
81
|
81
|
// aP1.m_x -= worker->m_origin_x;
|
82
|
82
|
// aP1.m_y -= worker->m_origin_y;
|
83
|
83
|
|
84
|
|
- from_x = TRUNC( (int)from_x );
|
85
|
|
- from_y = TRUNC( (int)from_y );
|
86
|
|
- to_x = TRUNC( (int)to_x );
|
87
|
|
- to_y = TRUNC( (int)to_y );
|
|
84
|
+ // from_x = TRUNC( (int)from_x );
|
|
85
|
+ // from_y = TRUNC( (int)from_y );
|
|
86
|
+ // to_x = TRUNC( (int)to_x );
|
|
87
|
+ // to_y = TRUNC( (int)to_y );
|
|
88
|
+
|
|
89
|
+ from_x /= 256.0;
|
|
90
|
+ from_y /= 256.0;
|
|
91
|
+ float to_x = tox / 256.0;
|
|
92
|
+ float to_y = toy / 256.0;
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+ //printf("line from: %f, %f to %f, %f\n", from_x, from_y, to_x, to_y);
|
88
|
96
|
|
89
|
97
|
float dir;
|
90
|
98
|
if ( from_y < to_y )
|
... |
... |
@@ -112,57 +120,6 @@ dense_render_line( dense_worker* worker, TPos to_x, TPos to_y ) |
112
|
120
|
to_y = (float)worker->m_h;
|
113
|
121
|
}
|
114
|
122
|
|
115
|
|
- /**
|
116
|
|
- Handle parts of the line outside the clip rectangle by
|
117
|
|
- snapping them to the left or right edge, or, if they intersect the clip area,
|
118
|
|
- by recursive calls.
|
119
|
|
- */
|
120
|
|
-
|
121
|
|
- FT_Vector intersect = { 0, 0 };
|
122
|
|
- int recursive = 0;
|
123
|
|
- if ( from_x >= worker->m_w && to_x >= worker->m_w )
|
124
|
|
- {
|
125
|
|
- from_x = to_x = (float)worker->m_w;
|
126
|
|
- dxdy = 0;
|
127
|
|
- }
|
128
|
|
- else if ( from_x <= 0 && to_x <= 0 )
|
129
|
|
- {
|
130
|
|
- from_x = to_x = 0;
|
131
|
|
- dxdy = 0;
|
132
|
|
- }
|
133
|
|
- else if ( ( from_x < 0 ) != ( to_x < 0 ) )
|
134
|
|
- {
|
135
|
|
- intersect.x = 0;
|
136
|
|
- intersect.y = to_y - to_x / dxdy;
|
137
|
|
- recursive = 1;
|
138
|
|
- }
|
139
|
|
- else if ( ( from_x > worker->m_w ) != ( to_x > worker->m_w ) )
|
140
|
|
- {
|
141
|
|
- intersect.x = worker->m_w;
|
142
|
|
- intersect.y = from_y + ( worker->m_w - from_x ) / dxdy;
|
143
|
|
- recursive = 1;
|
144
|
|
- }
|
145
|
|
- if ( recursive )
|
146
|
|
- {
|
147
|
|
- from_x += worker->m_origin_x;
|
148
|
|
- from_y += worker->m_origin_y;
|
149
|
|
- to_x += worker->m_origin_x;
|
150
|
|
- to_y += worker->m_origin_y;
|
151
|
|
- intersect.x += worker->m_origin_x;
|
152
|
|
- intersect.y += worker->m_origin_y;
|
153
|
|
- if ( dir == 1 )
|
154
|
|
- {
|
155
|
|
- dense_render_line( worker, intersect.x, intersect.y );
|
156
|
|
- dense_render_line( worker, to_x, to_y );
|
157
|
|
- }
|
158
|
|
- else
|
159
|
|
- {
|
160
|
|
- dense_render_line( worker, intersect.x, intersect.y );
|
161
|
|
- dense_render_line( worker, from_x, from_y );
|
162
|
|
- }
|
163
|
|
- return;
|
164
|
|
- }
|
165
|
|
-
|
166
|
123
|
float x = from_x;
|
167
|
124
|
int y0 = (int)from_y;
|
168
|
125
|
int y_limit = (int)ceil( to_y );
|
... |
... |
@@ -170,6 +127,7 @@ dense_render_line( dense_worker* worker, TPos to_x, TPos to_y ) |
170
|
127
|
|
171
|
128
|
for ( int y = y0; y < y_limit; y++ )
|
172
|
129
|
{
|
|
130
|
+ // printf("y is %d\n", y);
|
173
|
131
|
int linestart = y * worker->m_w;
|
174
|
132
|
float dy = fmin( y + 1.0f, to_y ) - fmax( (float)y, from_y );
|
175
|
133
|
float xnext = x + dxdy * dy;
|