drawPixel problem !! - Xwindows

This is a discussion on drawPixel problem !! - Xwindows ; Hi I am developing my GUI library. At first, i develop it in x-windows using xlib, then port to my os. But my program run very very slow. here is the design of my program 1) there are two thread ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: drawPixel problem !!

  1. drawPixel problem !!

    Hi
    I am developing my GUI library. At first, i develop it in x-windows
    using xlib, then port to my os.
    But my program run very very slow. here is the design of my program

    1) there are two thread (created by pthread lib), one is for hosting
    the keyboard & mouse event
    2) the second thread is just drawing every pixel of my two-dimensional
    array to the screen.

    If the resolution is 800x600, i need to invoke drawPixel() 480000
    times, it would be too many, at the result, i only got <1 screen
    refresh rate per second.

    SAVE ME !!!
    S.O.S

    thanks
    from Peter (cmk128@hotmail.com)


  2. Re: drawPixel problem !!

    On 22 Nov 2006 01:18:55 -0800, cmk128@hotmail.com wrote:

    >Hi
    > I am developing my GUI library. At first, i develop it in x-windows
    >using xlib,


    Good.

    > then port to my os.


    Bad. X11 is a carefully designed protocol, with decades of use. What
    makes you think you can do better?

    >But my program run very very slow. here is the design of my program
    >
    >1) there are two thread (created by pthread lib), one is for hosting
    >the keyboard & mouse event
    >2) the second thread is just drawing every pixel of my two-dimensional
    >array to the screen.
    >
    >If the resolution is 800x600, i need to invoke drawPixel() 480000
    >times, it would be too many, at the result, i only got <1 screen
    >refresh rate per second.


    Drawing pixel by pixel is inherently slow. Even if you didnt have to
    go through the layers of Xlib, it would be slow. You need to use the
    largest primitive as often as possible, not the smallest all the time.
    And X provides you with just that: primitives of all sizes.

    >
    >SAVE ME !!!
    >S.O.S
    >
    >thanks
    >from Peter (cmk128@hotmail.com)


+ Reply to Thread