Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Multiple TDirect2DCanvas instances conflict


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
Mike Versteeg

Posts: 118
Registered: 9/16/07
Multiple TDirect2DCanvas instances conflict  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Feb 27, 2015 8:42 AM
I have noticed that if you use 2 instances of TDirect2DCanvas, each in their own frame or form (= different handles), they conflict with each other. The result of this is that the main thread is brought to its knees if the d2dcanvas is updated regularly (like for video). My guess is this is a result of message pipe congestion due to each d2dcanvas waiting for the next vsync. This is somewhat confirmed by the fact that this problem already occurs with the following simple paint code
void __fastcall TVideo::WMPaint (TWMPaint & Message)
{
        TPaintStruct * PaintStruct = new TPaintStruct ();
        BeginPaint (Handle, PaintStruct);
        try
        {
                D2DCanvas->BeginDraw ();
                try
                {
//                        Paint ();
                }
                __finally
                {
                        D2DCanvas->EndDraw ();
                }
        }
        __finally
        {
                EndPaint (Handle, PaintStruct);
                delete (PaintStruct);
        }
}


i.e. it is enough to call BeginDraw and EndDraw, which does the wait for vsync.

I have confirmed the problem on 5 different machines, all running either W7 or W8.

Is there any way to avoid this problem?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02