none
How to improve performance for drawing vertical lines in wince 6.0 on LCD buffer

    全般的な情報交換

  • Hi All, We have got performance issues in our product, our requirement is draw continous vertical lines of some height (let say 300 pixel vertically... and 500 pixel heirzontally)...so once will complete the drawing 500 vertical lines of 300 hieght it becomes a filled rectangle box of 500x300. But we need to complete this drawing 10 ms, and in our board it is taking around 60 ms. We are using DirectDraw API to get the access of primary display surface and with that we are writing color value to that location. Is their any other to achieve that performance.. please provide some pointer to achieve that performance. We are using 400mHz ARM9i (iMX25 series), 64mb RAM,Wince6.0 R3. Am also attaching the code snippet for that fucntionality.
    // Global data for direct draw //------------------------------------------------------------------------
    LPDIRECTDRAW g_pDD = NULL; // DirectDraw object 
    LPDIRECTDRAWSURFACE g_pDDSPrimary = NULL;// DirectDraw primary surface
    DDSURFACEDESC ddsd; //ddraw surface descriptor 
    InitDDrawObject() { 
    //////////////////////////////////////////// // Create the main DirectDrawobject ///////////////////////////////////////////////////// 
    hRet = DirectDrawCreate(NULL, &g_pDD, NULL); 
    if (hRet != DD_OK) ReleaseAllDDrawObjects(); // Get exclusive mode 
    hRet = g_pDD->SetCooperativeLevel(hWnd,DDSCL_FULLSCREEN); 
    if (hRet != DD_OK) ReleaseAllDDrawObjects(); // Create the primary surface with 1 back buffer 
    memset(&ddsd, 0, sizeof(ddsd)); 
    ddsd.dwSize = sizeof(ddsd); 
    ddsd.dwFlags = DDSD_CAPS | DDSD_BACKBUFFERCOUNT; 
    ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE | DDSCAPS_FLIP; 
    ddsd.dwBackBufferCount = 1; 
    hRet = g_pDD->CreateSurface(&ddsd, &g_pDDSPrimary, NULL); 
    if (hRet != DD_OK) 
    { 
    if (hRet == DDERR_NOFLIPHW) 
       ReleaseAllDDrawObjects(); 
    ReleaseAllDDrawObjects(); 
    } 
    } 
    //this function drawing block of 500x300 with green color 
    //screen width is 800 pixel
    //screen height is 480 pixel 
    //each pixel is 2 byte
    void DrawLines()
     {
     g_pDDSPrimary->Lock(NULL, &ddsd, DDLOCK_WAITNOTBUSY, NULL);
    BYTE* pDisplayMemOffset = (BYTE*) ddsd.lpSurface; 
    int iAscanHeight = 300; 
    int BottomPixel = (iAscanHeight)*ddsd.lPitch; //ddsd.lPitch is the offset of vertical pixel i.e 1600 //ddsd.lXpitch is the offset of horizontal pixel i.e 2 
    for(int i = 0 ;i<iAscanWidth;++i)
    { 
    BYTE* pDisplayMemOffset = (BYTE*) ddsd.lpSurface; 
    pDisplayMemOffset += (i)*ddsd.lXPitch + BottomPixel; 
    for(int j = 0;j<iAscanHeight;++j)
    {
     *(WORD*)pDisplayMemOffset = 0x0f00;//green color;
    pDisplayMemOffset -= ddsd.lPitch; //shifting pointer to 1 pixel up 
    } 
    } 
    g_pDDSPrimary->Unlock(NULL); 
    } 

    We also tried with normal GDI API's (MoveTo() and LineTo(), but with that it is taking around 400 ms ) Any suggestion will be helpfull



    2011年11月17日 8:58

すべての返信

  • Hello,

     

    I would like to change this thread type as discussion, because I think there is no exact answer for this question.

     

    Thanks for your understanding,

     

    Best regards,

    Jesse


    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us
    2011年11月21日 5:51