c++directdraw

DirectDraw Blt function parameters


Just a simple blt function:

RECT dstRect = {dstL, dstT, dstR, dstB};
RECT srcRect = {srcL, srcT, srcR, srcB};

HRESULT hr = _surface->Blt(&dstRect,source,&srcRect,DDBLT_WAIT, NULL);

My question is:

let's say I have a buffer of width 'w', I specify dstL = 0. What should be dstR ? w or w-1 ?

meaning is dstR included or not ? (< or <=) ?


Solution

  • DirectDraw rectangles are like GDI rectangles in that they cover the area up to (but not including) the right column and bottom row. So it should be w.

    Reference: http://msdn.microsoft.com/en-us/library/aa911080.aspx :

    The RECT structures are defined so that the right and bottom members are exclusive: right minus left equals the width of the rectangle, not one less than the width.