Re: [cc65] Optimized tgi line functions for horizontal and vertical lines

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2011-11-07 22:14:22
On Mon, Nov 07, 2011 at 03:34:35PM +0100, "Andreas Rückert" wrote:
> If you don't want a public interface to those methods, something like
> lineto(x,y,x2,y2) {
>
> if( x == x2) { vertical_line( x, y, y2);
> } else if( y1 == y2) { horizontal_line( ...
>
> might work, although I think those functions could be of good use in
> some apps (think of fast grid drawing, or so).

It's up to the driver to choose such an optimization if appropriate.

> I used the bar function, which was a lot slower, but a forum64 user
> already posted a better solution:
>
>   char rvs[]={COLOR_WHITE, COLOR_BLACK};
>
>   tgi_setpalette(rvs);
>   tgi_clear();

Actually, I assumed that you complained about the tgi_setpalette function. It
needs about 6.5 ms to set the color RAM. The bar function is definitely slow.
The following comment is from the driver source:

; Note: This function needs optimization. It's just a cheap translation of
; the original C wrapper and could be written much smaller (besides that,
; calling LINE is not a good idea either).

> Problem is, that the tgi_setcolor() calls are not inverted.
> tgi_setcolor(COLOR_WHITE) draws black now and vice versa.

Yes, we had a lengthy discussion about that some time ago. The mixture of
palettes and colors is not really well-thought. Color constants are - desipite
their name - actually indices into the palette. At least for some of the
drivers that support a palette. A proposed solution does already exist (which
will require a change the TGI API) but is not implemented.

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Mon Nov 7 22:14:29 2011

This archive was generated by hypermail 2.1.8 : 2011-11-07 22:14:33 CET