locked
DirectDraw in Windows Mobile & Edge Tearing in GDI RRS feed

  • Question

  • Hi,

    I tried to use the functions such as GetScanLine, WaitForVerticalBlank and GetVerticalBlankStatus but all of them were returning E_NOTIMPL as the error code.

    Are these not supported in Windows Mobile 6.5. I have an LDC screen on the device which I am testing. The reason I want to use these is to avoid edge tearing as am using GDI to draw some images. Any solution regarding the same is also appreciated.

    This is the sample code am using:

    #include "Windows.h"
    #include "ddraw.h"

    int _tmain()
    {
        DWORD MonitorFrequency = 0;
        LPDIRECTDRAW DD;
        HRESULT hr = DirectDrawCreate(NULL, &DD, NULL);

        DWORD dwMonitorFrequency = 0;
        DD->GetMonitorFrequency(&dwMonitorFrequency);

        hr = DD->GetScanLine(&dwMonitorFrequency);

        return 0;
    }

    Regards,
    CED

    • Edited by C.E.D Tuesday, March 23, 2010 3:58 PM sample code added
    Tuesday, March 23, 2010 3:57 PM

Answers

  • Hi CED

    One of the approaches to avoid undesired artefact while drawing (using GDI) is by using double buffering.
    For instance the following article show how you could implements this: http://www.codeproject.com/KB/GDI/akBufferedDC.aspx

    Michael

     


    MVP Windows Embedded
    • Marked as answer by C.E.D Monday, April 12, 2010 7:01 PM
    Thursday, March 25, 2010 7:26 AM
  • Hi Michael,

    I have followed the double buffering process but still tearing of edges can be seen. The application is similar to a list screen with a focused image being displayed when an item in the list is in focus. Now if we press the down arrow key, then the focus keeps on moving in a cyclic manner among the list items. While doing so, it seems that the focus image is getting torn at the center.

    While doing some searching we found that this can happen if we blit the content of a DC to the screen while the scan line process is going on for the display, i.e the display is getting refreshed. But there is no way from GDI I guess to know whether it is the right time to blit the content to prevent the image tearing.

    That's why wanted to use the WaitForVerticalBlank function but alas! that is not supported by my hardware on which I am working.

    Thank you,
    CED

    • Marked as answer by C.E.D Monday, April 12, 2010 7:01 PM
    Thursday, March 25, 2010 7:46 AM

All replies

  • Hi,

    Anyone has any idea regarding this as to why such error value is getting returned. As per MSDN the function calls are supported in Windows Mobile.

    Thank you,

    CED

    Wednesday, March 24, 2010 12:44 PM
  • Hi CED

    You're actually getting the error code DDERR_UNSUPPORTED - which is by chance defined as E_NOTIMPL.

    This means, that the underlaying display driver does not support this feature.

    Michael


    MVP Windows Embedded
    Wednesday, March 24, 2010 5:18 PM
  • Hi Michael,

    Thank you for the information, but is there any way by which I can use DirectDraw to remove removal of image tearing which occurs in GDI?

    Thank you,

    CED

    Thursday, March 25, 2010 5:16 AM
  • Hi CED

    One of the approaches to avoid undesired artefact while drawing (using GDI) is by using double buffering.
    For instance the following article show how you could implements this: http://www.codeproject.com/KB/GDI/akBufferedDC.aspx

    Michael

     


    MVP Windows Embedded
    • Marked as answer by C.E.D Monday, April 12, 2010 7:01 PM
    Thursday, March 25, 2010 7:26 AM
  • Hi Michael,

    I have followed the double buffering process but still tearing of edges can be seen. The application is similar to a list screen with a focused image being displayed when an item in the list is in focus. Now if we press the down arrow key, then the focus keeps on moving in a cyclic manner among the list items. While doing so, it seems that the focus image is getting torn at the center.

    While doing some searching we found that this can happen if we blit the content of a DC to the screen while the scan line process is going on for the display, i.e the display is getting refreshed. But there is no way from GDI I guess to know whether it is the right time to blit the content to prevent the image tearing.

    That's why wanted to use the WaitForVerticalBlank function but alas! that is not supported by my hardware on which I am working.

    Thank you,
    CED

    • Marked as answer by C.E.D Monday, April 12, 2010 7:01 PM
    Thursday, March 25, 2010 7:46 AM