-
- // cell height to render
- double scale = (_aa.graphHeight < contacts.getContactHeight()) ? 1
- : ((double) _aa.graphHeight)
- / (double) contacts.getContactHeight();
+ int contact_height = contacts.getContactHeight();
+ // fractional pixel height to render each contact cell
+ double pixels_per_contact = ((double) _aa.graphHeight)
+ / (double) contact_height;
+ // fractional number of contacts covering each pixel
+ double contacts_per_pixel = 1d/pixels_per_contact;
+ // number of contacts to render at a time
+ int step = (pixels_per_contact<1) ? (int) Math.floor(contacts_per_pixel) : (int) Math.ceil(pixels_per_contact);
+
+ int pixels_step = (int) Math.ceil(step*pixels_per_contact);