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
341341 rju² = 1.0 / ju²;
342342 for(ju = 1; (1<<ju) < ju²; ju++);
343343
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−
350344 /* calculate area */
351345 sl = sq = 0;
352346 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
360354 #undef det
361355 #undef cL
362356 #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²;
363364 }
364− s₀ = (sl + sq/3)*QBZR_PIX_SCALE/2;
365+ s₀ = (sl + sq/3)*QBZR_PIX_SCALE/(2*ju²*ju²);
365366
366367 /* working space:
367368 * 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
448449 c = c₀x + 3*j²*j²;
449450 }
450451 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;
452454 }
453455 p += pitch - dw;
454456 }

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