Changeset 6950 for trunk/src


Ignore:
Timestamp:
Oct 5, 2001, 2:33:10 PM (24 years ago)
Author:
sandervl
Message:

updates for stretch blitting

Location:
trunk/src/ddraw
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ddraw/OS2CLIPPER.CPP

    r6935 r6950  
    1 /* $Id: OS2CLIPPER.CPP,v 1.14 2001-10-03 13:49:39 sandervl Exp $ */
     1/* $Id: OS2CLIPPER.CPP,v 1.15 2001-10-05 12:33:08 sandervl Exp $ */
    22
    33/*
     
    3131OS2IDirectDrawClipper::OS2IDirectDrawClipper(void) :
    3232                 Referenced(0), lastError(DD_OK), fDrawingAllowed(TRUE),
    33                  clipWindow(0), lpRgnData(NULL), fClipListChanged(FALSE)
     33                 clipWindow(0), lpRgnData(NULL), fClipListChanged(FALSE),
     34                 fClipListChangedInt(FALSE)
    3435{
    3536  // this constructor creates an unassociated instance of the ddraw clipper,
     
    5758OS2IDirectDrawClipper::OS2IDirectDrawClipper(OS2IDirectDraw *lpDirectDraw) :
    5859                 Referenced(0), lastError(DD_OK), fDrawingAllowed(TRUE),
    59                  clipWindow(0), lpRgnData(NULL), fClipListChanged(FALSE)
     60                 clipWindow(0), lpRgnData(NULL), fClipListChanged(FALSE),
     61                 fClipListChangedInt(FALSE)
    6062{
    6163  lpVtbl                  = &Vtbl;
     
    282284  dprintf(("DDRAW: ClipVisRgnCallback %x %x %x", me, hwnd, fDrawingAllowed));
    283285  if(me && me->clipWindow == hwnd) {
    284       me->fClipListChanged = TRUE;
     286      me->fClipListChanged    = TRUE;
     287      me->fClipListChangedInt = TRUE; //internal flag
    285288      lpRgnOld = me->lpRgnData;
    286289      if(fDrawingAllowed == FALSE) {
     
    323326#if 1
    324327  me->lpRgnData = OSLibQueryVisibleRegion(hwnd, me->lpDraw->GetScreenHeight());
     328  me->fClipListChanged    = TRUE;
     329  me->fClipListChangedInt = TRUE; //internal flag
    325330#else
    326331  me->lpRgnData = (LPRGNDATA)malloc(sizeof(RGNDATAHEADER) + sizeof(RECT));
  • trunk/src/ddraw/OS2CLIPPER.H

    r6935 r6950  
    1 /* $Id: OS2CLIPPER.H,v 1.10 2001-10-03 13:49:39 sandervl Exp $ */
     1/* $Id: OS2CLIPPER.H,v 1.11 2001-10-05 12:33:08 sandervl Exp $ */
    22
    33/*
     
    3131        inline  HRESULT       GetLastError() { return lastError; };
    3232
     33        BOOL IsClipListChangedInt()
     34        {
     35           BOOL ret = fClipListChangedInt;
     36           fClipListChangedInt = FALSE;
     37           return ret;
     38        }
    3339 private:
    3440
     
    4046
    4147        LPRGNDATA              lpRgnData;
    42         BOOL                   fClipListChanged;
     48        BOOL                   fClipListChanged, fClipListChangedInt;
    4349        BOOL                   fDrawingAllowed;
    4450
  • trunk/src/ddraw/OS2DDRAW.CPP

    r6901 r6950  
    1 /* $Id: OS2DDRAW.CPP,v 1.31 2001-09-30 22:23:44 sandervl Exp $ */
     1/* $Id: OS2DDRAW.CPP,v 1.32 2001-10-05 12:33:09 sandervl Exp $ */
    22
    33/*
     
    16451645{
    16461646//  DWORD dwFCC[MAX_FOURCC_CODES] = {FOURCC_LUT8,FOURCC_R565,FOURCC_RGB3,FOURCC_YUY2};
    1647   DWORD dwFCC[MAX_FOURCC_CODES] = {FOURCC_LUT8,FOURCC_R565,FOURCC_RGB3};
     1647  DWORD dwFCC[MAX_FOURCC_CODES] = {FOURCC_LUT8,FOURCC_R565,FOURCC_R555,FOURCC_RGB3};
    16481648
    16491649  dprintf(("DDRAW: GetFourCCCodes %x %x %x", This, lpNumCodes, lpCodes));
  • trunk/src/ddraw/OS2DDRAW.H

    r5326 r6950  
    1 /* $Id: OS2DDRAW.H,v 1.14 2001-03-18 21:44:42 mike Exp $ */
     1/* $Id: OS2DDRAW.H,v 1.15 2001-10-05 12:33:09 sandervl Exp $ */
    22
    33/*
     
    2626#define THIS VOID*
    2727
    28 #define MAX_FOURCC_CODES        3
     28#define MAX_FOURCC_CODES        4
    2929
    3030#define ODINDDRAW_SECTION       "DirectDraw"
  • trunk/src/ddraw/OS2SURFACE.CPP

    r6935 r6950  
    1 /* $Id: OS2SURFACE.CPP,v 1.34 2001-10-03 13:49:40 sandervl Exp $ */
     1/* $Id: OS2SURFACE.CPP,v 1.35 2001-10-05 12:33:09 sandervl Exp $ */
    22
    33/*
     
    566566  OS2IDirectDrawSurface *MipMapSurface;
    567567
     568  memset(&sBlt, 0, sizeof(sBlt));
     569
    568570  lpVtbl                     = &Vtbl2;
    569571  lpVtbl2                    = &Vtbl2;
     
    706708  memcpy((char *)&DDSurfaceDesc, (char *)lpDDSurfaceDesc, sizeof(DDSURFACEDESC2));
    707709
     710#ifdef DEBUG
     711  dprintf(("Pixel format:"));
     712  _dump_pixelformat(&lpDDSurfaceDesc->ddpfPixelFormat);
     713  dprintf(("Capabilities"));
     714  _dump_DDSCAPS(lpDDSurfaceDesc->ddsCaps.dwCaps);
     715  _dump_DDSCAPS2(lpDDSurfaceDesc->ddsCaps.dwCaps2);
     716#endif
     717
    708718  if(lpDraw->dCaps.ulDepth != 15)
    709719  {
     
    12931303          }
    12941304
    1295           if(Mainchain)
    1296           {
    1297             diveBufNr = 0;
    1298             rc = DiveAllocImageBuffer( hDive,
     1305//          if(Mainchain)
     1306//          {
     1307              diveBufNr = 0;
     1308              rc = DiveAllocImageBuffer( hDive,
    12991309                                       &diveBufNr,
    13001310                                       lpDraw->dCaps.fccColorEncoding,
     
    13031313                                       dwPitchDB,
    13041314                                       (PBYTE)pDiveBuffer);
    1305              dprintf(("DDRAW: rc = 0x%08X\n",rc));
    1306           }
     1315              dprintf(("DDRAW: DiveAllocImageBuffer %x -> %d (rc=%d)",pDiveBuffer, diveBufNr, rc));
     1316//          }
    13071317
    13081318        }  // end of 3rd case
     
    23762386  delete pIRectSrc;
    23772387
     2388  if(dest->diveBufNr == DIVE_BUFFER_SCREEN &&
     2389     !(dwFlags & (DDBLT_COLORFILL|DDBLT_DEPTHFILL|DDBLT_ROP) ) )
     2390  {
     2391      int rc, temp, fChanged = FALSE;
     2392      int destheight = RECT_HEIGHT(&DestRect);
     2393      int destwidth  = RECT_WIDTH(&DestRect);
     2394      int srcheight  = RECT_HEIGHT(&SrcRect);
     2395      int srcwidth   = RECT_WIDTH(&SrcRect);
     2396
     2397      //if full surface blit or stretching blit, then use Dive
     2398      if( (src->DDSurfaceDesc.dwHeight == srcheight &&
     2399           src->DDSurfaceDesc.dwWidth  == srcwidth) ||
     2400          (srcwidth != destwidth && srcheight != destheight) ) 
     2401      {
     2402          SETUP_BLITTER          sBlt = {0};
     2403
     2404          sBlt.ulStructLen       = sizeof(sBlt);
     2405          sBlt.fInvert           = 0;
     2406          sBlt.fccSrcColorFormat = src->DDSurfaceDesc.ddpfPixelFormat.dwFourCC;
     2407          sBlt.ulSrcWidth        = srcwidth;
     2408          sBlt.ulSrcHeight       = srcheight;
     2409          sBlt.ulSrcPosX         = SrcRect.left;
     2410          sBlt.ulSrcPosY         = src->DDSurfaceDesc.dwHeight-SrcRect.bottom;
     2411          sBlt.ulDitherType      = 0;
     2412          sBlt.fccDstColorFormat = dest->DDSurfaceDesc.ddpfPixelFormat.dwFourCC;
     2413          sBlt.ulDstWidth        = destwidth;
     2414          sBlt.ulDstHeight       = destheight;
     2415          sBlt.lDstPosX          = 0;
     2416          sBlt.lDstPosY          = 0;
     2417          sBlt.lScreenPosX       = DestRect.left;
     2418          sBlt.lScreenPosY       = dest->DDSurfaceDesc.dwHeight-DestRect.bottom;
     2419          sBlt.ulNumDstRects     = DIVE_FULLY_VISIBLE;
     2420          sBlt.pVisDstRects      = NULL;
     2421
     2422          if(dest->lpClipper && dest->lpClipper->IsClipListChangedInt())
     2423          {
     2424              DWORD rgnsize;
     2425              if(ClipGetClipList((IDirectDrawClipper*)dest->lpClipper, NULL, NULL, &rgnsize) == DD_OK)
     2426              {
     2427                  LPRGNDATA lpRgnData = (LPRGNDATA)alloca(rgnsize);
     2428                  if(lpRgnData == NULL) {
     2429                      DebugInt3();
     2430                      goto dodiveblit;
     2431                  }
     2432                  if(ClipGetClipList((IDirectDrawClipper*)dest->lpClipper, NULL, lpRgnData, &rgnsize) == DD_OK)
     2433                  {
     2434                      OS2RECTL *pRectl = (OS2RECTL *)&lpRgnData->Buffer;
     2435
     2436                      if(sBlt.ulNumDstRects == 0) {
     2437                          dprintf(("empty cliplist, return"));
     2438                          return DD_OK;
     2439                      }
     2440                      for(i=0;i<lpRgnData->rdh.nCount;i++)
     2441                      {
     2442                          temp               = pRectl[i].yTop;
     2443                          pRectl[i].yTop     = dest->DDSurfaceDesc.dwHeight - pRectl[i].yBottom;
     2444                          pRectl[i].yBottom  = dest->DDSurfaceDesc.dwHeight - temp;
     2445                          //clip rectangle must be relative to lScreenPos
     2446                          pRectl[i].xLeft   -= sBlt.lScreenPosX;
     2447                          pRectl[i].xRight  -= sBlt.lScreenPosX;
     2448                          pRectl[i].yTop    -= sBlt.lScreenPosY;
     2449                          pRectl[i].yBottom -= sBlt.lScreenPosY;
     2450                      }
     2451                      fChanged = TRUE;
     2452                      sBlt.ulNumDstRects = lpRgnData->rdh.nCount;
     2453                      sBlt.pVisDstRects  = (PRECTL)&lpRgnData->Buffer;
     2454                  }
     2455              }
     2456          }
     2457dodiveblit:
     2458          if(fChanged || memcmp(&sBlt, &dest->sBlt, sizeof(sBlt)-sizeof(PRECTL)-sizeof(ULONG)))
     2459          {
     2460              dprintf(("Setting up blitter: src  (%d,%d)(%d,%d)", sBlt.ulSrcPosX, sBlt.ulSrcPosY, sBlt.ulSrcWidth, sBlt.ulSrcHeight));
     2461              dprintf(("Setting up blitter: dest (%d,%d)(%d,%d)", sBlt.lScreenPosX, sBlt.lScreenPosY, sBlt.ulDstWidth, sBlt.ulDstHeight));
     2462              rc = DiveSetupBlitter(dest->hDive, &sBlt);
     2463              if(rc) {
     2464                  dprintf(("DiveSetupBlitter returned %d", rc));
     2465                  return(DD_OK);
     2466              }
     2467              sBlt.ulNumDstRects     = DIVE_FULLY_VISIBLE;
     2468              sBlt.pVisDstRects      = NULL;
     2469              memcpy(&dest->sBlt, &sBlt, sizeof(sBlt));
     2470          }
     2471          dprintf(("DiveBlitImage %x %d->%d", dest->hDive, src->diveBufNr, dest->diveBufNr));
     2472          rc = DiveBlitImage(dest->hDive, src->diveBufNr, dest->diveBufNr);
     2473          if(rc) {
     2474              dprintf(("DiveBlitImage returned %d", rc));
     2475              return(DD_OK);
     2476          }
     2477          return DD_OK;
     2478      }
     2479  }
     2480
    23782481  //TODO: do we need to check the source for clipping information in case
    23792482  //      the app wants to copy from the frame buffer?
     
    24032506                      newsrc.bottom = newsrc.top + RECT_HEIGHT(&newdest);
    24042507
     2508//                      DDSURFACEDESC2 surfdesc = {0};
     2509//                      SurfLock4(dest, &newdest, &surfdesc, 0, 0);
     2510
    24052511                      ret = SurfDoBlt(This, &newdest, lpDDSrcSurface, &newsrc, dwFlags, lpDDBltFx);
    24062512                      if(ret != DD_OK) {
    24072513                          break;
    24082514                      }
     2515//                      SurfUnlock(dest, surfdesc.lpSurface);
    24092516                  }
    24102517              }
     
    44874594    return DDERR_INVALIDPARAMS;
    44884595
     4596#ifdef DEBUG
     4597  _dump_pixelformat(&me->DDSurfaceDesc.ddpfPixelFormat);
     4598#endif
     4599
    44894600  memcpy( (char*)lpPixelFormat,
    44904601          (char*)&(me->DDSurfaceDesc.ddpfPixelFormat),
     
    47034814                   pIRectNew);
    47044815
     4816    if(me->diveBufNr == DIVE_BUFFER_SCREEN)
     4817    {
     4818        OS2RECTL rectOS2;
     4819
     4820        rectOS2.xLeft   = pIRectNew->Left();
     4821        rectOS2.yBottom = me->DDSurfaceDesc.dwHeight - pIRectNew->Bottom();
     4822        rectOS2.xRight  = pIRectNew->Right();
     4823        rectOS2.yTop    = me->DDSurfaceDesc.dwHeight - pIRectNew->Top();
     4824        dprintf(("DiveAcquireFrameBuffer (%d,%d)(%d,%d)", rectOS2.xLeft, rectOS2.yBottom, rectOS2.xRight, rectOS2.yTop));
     4825        int ret = DiveAcquireFrameBuffer(me->hDive, (PRECTL)&rectOS2);
     4826        if(ret) {
     4827            dprintf(("ERROR: DiveAcquireFrameBuffer failed with %d", ret));
     4828        }
     4829    }
    47054830    me->fLocked = TRUE;
    47064831  }
     
    51245249    else
    51255250      dprintf( ("No ColorConversion Needed"));
     5251
     5252
     5253    if(me->diveBufNr == DIVE_BUFFER_SCREEN)
     5254    {
     5255        OS2RECTL rectOS2;
     5256
     5257        rectOS2.xLeft   = pIRectEnum->Left();
     5258        rectOS2.yBottom = me->DDSurfaceDesc.dwHeight - pIRectEnum->Bottom();
     5259        rectOS2.xRight  = pIRectEnum->Right();
     5260        rectOS2.yTop    = me->DDSurfaceDesc.dwHeight - pIRectEnum->Top();
     5261        dprintf(("DiveDeacquireFrameBuffer (%d,%d)(%d,%d)", rectOS2.xLeft, rectOS2.yBottom, rectOS2.xRight, rectOS2.yTop));
     5262        int ret = DiveDeacquireFrameBuffer(me->hDive);
     5263        if(ret) {
     5264            dprintf(("ERROR: DiveDeacquireFrameBuffer failed with %d", ret));
     5265        }
     5266    }
    51265267
    51275268    // delete tne DDRectobject of the found rectangle
  • trunk/src/ddraw/OS2SURFACE.H

    r6942 r6950  
    1 /* $Id: OS2SURFACE.H,v 1.15 2001-10-03 18:40:29 sandervl Exp $ */
     1/* $Id: OS2SURFACE.H,v 1.16 2001-10-05 12:33:10 sandervl Exp $ */
    22
    33/*
     
    151151        LONG                   lOverlayX;
    152152        LONG                   lOverlayY;
     153
     154        SETUP_BLITTER          sBlt;
    153155
    154156        // surface management
  • trunk/src/ddraw/rectangle.cpp

    r6935 r6950  
    1 /* $Id: rectangle.cpp,v 1.6 2001-10-03 13:49:41 sandervl Exp $ */
     1/* $Id: rectangle.cpp,v 1.7 2001-10-05 12:33:10 sandervl Exp $ */
    22
    33/*
     
    5353}
    5454
    55 DDRectangle::Coord DDRectangle::Top() const
    56 {
    57   return lTop;
    58 }
    59 
    60 DDRectangle::Coord DDRectangle::Left() const
    61 {
    62   return lLeft;
    63 }
    64 
    65 DDRectangle::Coord DDRectangle::Bottom() const
    66 {
    67   return lBottom;
    68 }
    69 
    70 DDRectangle::Coord DDRectangle::Right() const
    71 {
    72   return lRight;
    73 }
    74 
    7555void DDRectangle::SetMemPtr(void* NewMemPtr)
    7656{
  • trunk/src/ddraw/rectangle.h

    r5344 r6950  
    1 /* $Id: rectangle.h,v 1.6 2001-03-20 23:18:56 mike Exp $ */
     1/* $Id: rectangle.h,v 1.7 2001-10-05 12:33:10 sandervl Exp $ */
    22
    33/*
     
    3939Coord
    4040  width() const,
    41   height() const,
    42   Top() const,
    43   Left() const,
    44   Bottom() const,
    45   Right() const;
     41  height() const;
     42
     43  Coord Top() const
     44  {
     45    return lTop;
     46  }
     47
     48  Coord Left() const
     49  {
     50    return lLeft;
     51  }
     52 
     53  Coord Bottom() const
     54  {
     55    return lBottom;
     56  }
     57 
     58  Coord Right() const
     59  {
     60    return lRight;
     61  }
    4662
    4763  void* GetMemPtr();
Note: See TracChangeset for help on using the changeset viewer.