Are you sure we need to check weather we are writing outside the GLCD
boundaries?

It seems like a waste of cycles in most cases, the user should insure
this on his own. These if statements will run every time a pixel is
drawn, and graphics have a lot of pixels.

If you wish, I can run a speed comparison.

OLD:

      glcd_write_pixel(byte(cx + x), byte(cy + y))
      glcd_write_pixel(byte(cx - x), byte(cy + y))
      glcd_write_pixel(byte(cx - x), byte(cy - y))
      glcd_write_pixel(byte(cx + x), byte(cy - y))


NEW:

procedure _glcd_write_4_ellipse_pixels(byte*GLCD_X_SIZE in cx, sbyte*3
in dx,
   byte*GLCD_Y_SIZE in cy, sbyte*3 in dy) is
   if (cx + dx) >= 0 & (cx + dx) < GLCD_X_PIXELS  then
      if (cy + dy) >= 0 & (cy + dy) < GLCD_Y_PIXELS  then
         glcd_write_pixel(byte*GLCD_X_SIZE(cx + dx),
byte*GLCD_Y_SIZE(cy + dy))
      end if
      if (cy - dy) >= 0 & (cy - dy) < GLCD_Y_PIXELS  then
        glcd_write_pixel(byte*GLCD_X_SIZE(cx + dx),
byte*GLCD_Y_SIZE(cy - dy))
      end if
   end if
   if (cx - dx) >= 0 & (cx - dx) < GLCD_X_PIXELS  then
      if (cy + dy) >= 0 & (cy + dy) < GLCD_Y_PIXELS  then
        glcd_write_pixel(byte*GLCD_X_SIZE(cx - dx),
byte*GLCD_Y_SIZE(cy + dy))
      end if
      if (cy - dy) >= 0 & (cy - dy) < GLCD_Y_PIXELS  then
         glcd_write_pixel(byte*GLCD_X_SIZE(cx - dx),
byte*GLCD_Y_SIZE(cy - dy))
      end if
   end if
end procedure

Matt.

-- 
You received this message because you are subscribed to the Google Groups 
"jallib" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/jallib?hl=en.

Reply via email to