History

scale after area

Sigrid Solveig Haflínudóttir committed 2 years ago

Commit c02b0a61 parent 2ea187e1 file · +10 −8Browse files

Unified · Split

rast.c+10−8
@@ -341,12 +341,6 @@ qbzr(SegQ *seg, int ns, int dw, int dh, int pitch, u8int *p) · 340 unmodified lines
341 rju² = 1.0 / ju²;341 rju² = 1.0 / ju²;
342 for(ju = 1; (1<<ju) < ju²; ju++);342 for(ju = 1; (1<<ju) < ju²; ju++);
343 343
344 /* scale */
345 for(i = 0; i < ns; i++){
346 for(j = 0; j < nelem(seg->v); j++)
347 seg[i].v[j] *= rju²;
348 }
349
350 /* calculate area */344 /* calculate area */
351 sl = sq = 0;345 sl = sq = 0;
352 for(i = 0; i < ns; i++){346 for(i = 0; i < ns; i++){
@@ -360,8 +354,15 @@ qbzr(SegQ *seg, int ns, int dw, int dh, int pitch, u8int *p) · 7 unmodified lines
360#undef det354#undef det
361#undef cL355#undef cL
362#undef cQ356#undef cQ
357 /* scale */
358 seg[i].v[0] *= rju²;
359 seg[i].v[1] *= rju²;
360 seg[i].v[2] *= rju²;
361 seg[i].v[3] *= rju²;
362 seg[i].v[4] *= rju²;
363 seg[i].v[5] *= rju²;
363 }364 }
364 s₀ = (sl + sq/3)*QBZR_PIX_SCALE/2;365 s₀ = (sl + sq/3)*QBZR_PIX_SCALE/(2*ju²*ju²);
365 366
366 /* working space:367 /* working space:
367 * quick is-segment-in-the-cell tests (two 64-bit nums per segment)368 * quick is-segment-in-the-cell tests (two 64-bit nums per segment)
@@ -448,7 +449,8 @@ qbzr(SegQ *seg, int ns, int dw, int dh, int pitch, u8int *p) · 80 unmodified lines
448 c = c₀x + 3*j²*j²;449 c = c₀x + 3*j²*j²;
449 }450 }
450 v = s/QBZR_PIX_SCALE*255;451 v = s/QBZR_PIX_SCALE*255;
451 *p++ = v < 0 ? 0 : (v > 255 ? 255 : v);452 v *= v > 0;
453 *p++ = v < 255 ? v : 255;
452 }454 }
453 p += pitch - dw;455 p += pitch - dw;
454 }456 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t