[OpenJDK Rasterizer] Marlin #4

Jim Graham james.graham at oracle.com
Thu Sep 24 01:10:56 UTC 2015


Some thoughts - we record some info on each scanline - mostly about the 
new edges that are added.  Perhaps we could keep deltas of how many 
edges come and go per scanline and then sum them up at the start to 
figure out if any scanline has a lot of crossings?

One slight optimization in the non-tileflag version of CopyRLE.

for (i, from, to) {
     int delta;
     if ((delta = alphaRow[i]) != 0) {
         cache.add(val);
         val += delta;
         // Range Check only needed here?
         runLen = 1;
         alphaRow[i] = 0;  // Optional - avoids clear later?
     } else {
         runLen++;
     }
}

It avoids prev and having to add "prev + delta" for the very common case 
of delta == 0.

Also, RLE tends to be more useful if the index of the values is larger 
than your data storage unit - which is why Pisces used RLE when it was 
on embedded since they were using bytes to store the alpha caches, but 
shapes could be larger than 256 units.  You seem to be using integers 
which means there is no run long enough to require having to break it up 
into multiple segments, you can just store the horizontal index of the 
next change of value and its value.  This also means you don't have to 
sum up counts to figure out where a partial row starts, you just scan 
for the first index that is in range (remembering the previous alpha 
value to be used for the beginning of the range)...

			...jim


More information about the graphics-rasterizer-dev mailing list