| 1 | /* $Id: surfoverlay.cpp,v 1.1 2002-12-29 14:11:03 sandervl Exp $ */ | 
|---|
| 2 |  | 
|---|
| 3 | /* | 
|---|
| 4 | * DirectDraw Surface class implementaion | 
|---|
| 5 | * | 
|---|
| 6 | * Copyright 1999 Markus Montkowski | 
|---|
| 7 | * Copyright 2000 Michal Necasek | 
|---|
| 8 | * Copyright 1998-2001 Sander van Leeuwen | 
|---|
| 9 | * | 
|---|
| 10 | * Project Odin Software License can be found in LICENSE.TXT | 
|---|
| 11 | * | 
|---|
| 12 | */ | 
|---|
| 13 |  | 
|---|
| 14 | #define _OS2WIN_H | 
|---|
| 15 | #define FAR | 
|---|
| 16 |  | 
|---|
| 17 | #include <odin.h> | 
|---|
| 18 | #include <winbase.h> | 
|---|
| 19 | #include <stdlib.h> | 
|---|
| 20 | #include <string.h> | 
|---|
| 21 | #include <memory.h> | 
|---|
| 22 | #define mmioFOURCC( ch0, ch1, ch2, ch3 )                         \ | 
|---|
| 23 | ( (DWORD)(BYTE)(ch0) | ( (DWORD)(BYTE)(ch1) << 8 ) |    \ | 
|---|
| 24 | ( (DWORD)(BYTE)(ch2) << 16 ) | ( (DWORD)(BYTE)(ch3) << 24 ) ) | 
|---|
| 25 | #include <fourcc.h> | 
|---|
| 26 |  | 
|---|
| 27 | #define CINTERFACE | 
|---|
| 28 | #include "ddraw2d.h" | 
|---|
| 29 | #include "clipper.h" | 
|---|
| 30 | #include "palette.h" | 
|---|
| 31 | #include "surface.h" | 
|---|
| 32 | #include "surfacehlp.h" | 
|---|
| 33 | #include "os2util.h" | 
|---|
| 34 | #include "rectangle.h" | 
|---|
| 35 |  | 
|---|
| 36 | #include <misc.h> | 
|---|
| 37 | #include "asmutil.h" | 
|---|
| 38 | #include "bltFunc.h" | 
|---|
| 39 | #include "colorconv.h" | 
|---|
| 40 | #include "fillfunc.h" | 
|---|
| 41 | #include <winerror.h> | 
|---|
| 42 | #include <os2win.h> | 
|---|
| 43 | #include <cpuhlp.h> | 
|---|
| 44 | #include "asmutil.h" | 
|---|
| 45 | #include "wndproc.h" | 
|---|
| 46 |  | 
|---|
| 47 | #ifndef __WATCOMC__ | 
|---|
| 48 | #include <builtin.h> | 
|---|
| 49 | #endif | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 |  | 
|---|
| 53 | //****************************************************************************** | 
|---|
| 54 | //****************************************************************************** | 
|---|
| 55 | HRESULT WIN32API SurfUpdateOverlay(THIS This, LPRECT, LPDIRECTDRAWSURFACE2,LPRECT,DWORD, LPDDOVERLAYFX) | 
|---|
| 56 | { | 
|---|
| 57 | dprintf(("DDRAW: SurfUpdateOverlay NOT IMPLEMENTED")); | 
|---|
| 58 | return(DD_OK); | 
|---|
| 59 | } | 
|---|
| 60 | //****************************************************************************** | 
|---|
| 61 | //****************************************************************************** | 
|---|
| 62 | HRESULT WIN32API SurfUpdateOverlay3(THIS This, LPRECT, LPDIRECTDRAWSURFACE3,LPRECT,DWORD, LPDDOVERLAYFX) | 
|---|
| 63 | { | 
|---|
| 64 | dprintf(("DDRAW: SurfUpdateOverlay  NOT IMPLEMENTED")); | 
|---|
| 65 | return(DD_OK); | 
|---|
| 66 | } | 
|---|
| 67 | //****************************************************************************** | 
|---|
| 68 | //****************************************************************************** | 
|---|
| 69 | HRESULT WIN32API SurfUpdateOverlay4(THIS, LPRECT, LPDIRECTDRAWSURFACE4,LPRECT,DWORD, LPDDOVERLAYFX) | 
|---|
| 70 | { | 
|---|
| 71 | dprintf(("DDRAW: SurfUpdateOverlay NOT IMPLEMENTED")); | 
|---|
| 72 | return(DD_OK); | 
|---|
| 73 | } | 
|---|
| 74 | //****************************************************************************** | 
|---|
| 75 | //****************************************************************************** | 
|---|
| 76 | HRESULT WIN32API SurfUpdateOverlayDisplay(THIS, DWORD) | 
|---|
| 77 | { | 
|---|
| 78 | dprintf(("DDRAW: SurfUpdateOverlayDisplay  NOT IMPLEMENTED")); | 
|---|
| 79 | return(DD_OK); | 
|---|
| 80 | } | 
|---|
| 81 | //****************************************************************************** | 
|---|
| 82 | //****************************************************************************** | 
|---|
| 83 | HRESULT WIN32API SurfUpdateOverlayZOrder(THIS, DWORD, LPDIRECTDRAWSURFACE2) | 
|---|
| 84 | { | 
|---|
| 85 | dprintf(("DDRAW: SurfUpdateOverlayZOrder NOT IMPLEMENTED")); | 
|---|
| 86 | return(DD_OK); | 
|---|
| 87 | } | 
|---|
| 88 | //****************************************************************************** | 
|---|
| 89 | //****************************************************************************** | 
|---|
| 90 | HRESULT WIN32API SurfUpdateOverlayZOrder3(THIS, DWORD, LPDIRECTDRAWSURFACE3) | 
|---|
| 91 | { | 
|---|
| 92 | dprintf(("DDRAW: SurfUpdateOverlayZOrder NOT IMPLEMENTED")); | 
|---|
| 93 | return(DD_OK); | 
|---|
| 94 | } | 
|---|
| 95 | //****************************************************************************** | 
|---|
| 96 | //****************************************************************************** | 
|---|
| 97 | HRESULT WIN32API SurfUpdateOverlayZOrder4(THIS, DWORD, LPDIRECTDRAWSURFACE4) | 
|---|
| 98 | { | 
|---|
| 99 | dprintf(("DDRAW: SurfUpdateOverlayZOrder4 NOT IMPLEMENTED")); | 
|---|
| 100 | return(DD_OK); | 
|---|
| 101 | } | 
|---|
| 102 | //****************************************************************************** | 
|---|
| 103 | //****************************************************************************** | 
|---|
| 104 | HRESULT WIN32API SurfGetOverlayPosition(THIS This, LPLONG lplX, LPLONG lplY) | 
|---|
| 105 | { | 
|---|
| 106 | OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; | 
|---|
| 107 | dprintf(("DDRAW: SurfGetOverlayPosition\n")); | 
|---|
| 108 |  | 
|---|
| 109 | // Maybe simply return dderr_notsupported as we retun a max overlay value of 0 in the caps ? | 
|---|
| 110 |  | 
|---|
| 111 | if( (NULL==lplX) || (NULL==lplY)) | 
|---|
| 112 | return DDERR_INVALIDPARAMS; | 
|---|
| 113 |  | 
|---|
| 114 | if(!(me->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_OVERLAY)) | 
|---|
| 115 | return DDERR_NOTAOVERLAYSURFACE; | 
|---|
| 116 |  | 
|---|
| 117 | if(!(me->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_VISIBLE)) | 
|---|
| 118 | return DDERR_OVERLAYNOTVISIBLE; | 
|---|
| 119 |  | 
|---|
| 120 | if(!me->fOverlayValid) | 
|---|
| 121 | return DDERR_NOOVERLAYDEST; | 
|---|
| 122 |  | 
|---|
| 123 | *lplX = me->lOverlayX; | 
|---|
| 124 | *lplY = me->lOverlayY; | 
|---|
| 125 |  | 
|---|
| 126 | return(DD_OK); | 
|---|
| 127 | } | 
|---|
| 128 | //****************************************************************************** | 
|---|
| 129 | //****************************************************************************** | 
|---|
| 130 | HRESULT WIN32API SurfSetOverlayPosition(THIS This, LONG lX, LONG lY) | 
|---|
| 131 | { | 
|---|
| 132 | OS2IDirectDrawSurface *me = (OS2IDirectDrawSurface *)This; | 
|---|
| 133 |  | 
|---|
| 134 | dprintf(("DDRAW: SurfSetOverlayPosition\n")); | 
|---|
| 135 |  | 
|---|
| 136 | if( (me->DDSurfaceDesc.dwFlags & DDSD_CAPS) && | 
|---|
| 137 | (me->DDSurfaceDesc.ddsCaps.dwCaps & DDSCAPS_OVERLAY) ) | 
|---|
| 138 | { | 
|---|
| 139 | if(me->fOverlayValid) | 
|---|
| 140 | return(DDERR_NOOVERLAYDEST); | 
|---|
| 141 |  | 
|---|
| 142 | if(!(me->DDSurfaceDesc.dwFlags & DDSCAPS_VISIBLE)) | 
|---|
| 143 | return(DDERR_OVERLAYNOTVISIBLE); | 
|---|
| 144 |  | 
|---|
| 145 | // ToDo: If we implement alignment restricions to the Overlay position | 
|---|
| 146 | // check if the new values are OK otherwiese return DDERR_INVALIDPOSITION | 
|---|
| 147 |  | 
|---|
| 148 | me->lOverlayX = lX; | 
|---|
| 149 | me->lOverlayY = lY; | 
|---|
| 150 | return(DD_OK); | 
|---|
| 151 | } | 
|---|
| 152 |  | 
|---|
| 153 | return(DDERR_NOTAOVERLAYSURFACE); | 
|---|
| 154 | } | 
|---|
| 155 | //****************************************************************************** | 
|---|
| 156 | //****************************************************************************** | 
|---|
| 157 | HRESULT WIN32API SurfAddOverlayDirtyRect(THIS, LPRECT) | 
|---|
| 158 | { | 
|---|
| 159 | dprintf(("DDRAW: SurfAddOverlayDirtyRect Not implemented by M$ in DX 6.0!\n")); | 
|---|
| 160 |  | 
|---|
| 161 | return(DD_OK); | 
|---|
| 162 | } | 
|---|
| 163 | //****************************************************************************** | 
|---|
| 164 | //****************************************************************************** | 
|---|
| 165 | HRESULT WIN32API SurfEnumOverlayZOrders(THIS, DWORD,LPVOID,LPDDENUMSURFACESCALLBACK) | 
|---|
| 166 | { | 
|---|
| 167 | dprintf(("DDRAW: SurfEnumOverlayZOrders\n")); | 
|---|
| 168 |  | 
|---|
| 169 | return(DD_OK); | 
|---|
| 170 | } | 
|---|
| 171 | //****************************************************************************** | 
|---|
| 172 | //****************************************************************************** | 
|---|
| 173 | HRESULT WIN32API SurfEnumOverlayZOrders4(THIS, DWORD,LPVOID,LPDDENUMSURFACESCALLBACK2) | 
|---|
| 174 | { | 
|---|
| 175 | dprintf(("DDRAW: SurfEnumOverlayZOrders\n")); | 
|---|
| 176 |  | 
|---|
| 177 | return(DD_OK); | 
|---|
| 178 | } | 
|---|
| 179 | //****************************************************************************** | 
|---|
| 180 | //****************************************************************************** | 
|---|