Home | Info | Community | Development | myReactOS | Contact Us
ReactOS Development > Doxygenpointer.c
Go to the documentation of this file.
00001 /* 00002 * ReactOS Generic Framebuffer display driver 00003 * 00004 * Copyright (C) 2004 Filip Navara 00005 * 00006 * This program is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU General Public License 00008 * as published by the Free Software Foundation; either version 2 00009 * of the License, or (at your option) any later version. 00010 * 00011 * This program is distributed in the hope that it will be useful, 00012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00014 * GNU General Public License for more details. 00015 * 00016 * You should have received a copy of the GNU General Public License along 00017 * with this program; if not, write to the Free Software Foundation, Inc., 00018 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 00019 */ 00020 00021 #include "framebuf.h" 00022 00023 #ifndef EXPERIMENTAL_MOUSE_CURSOR_SUPPORT 00024 00025 /* 00026 * DrvSetPointerShape 00027 * 00028 * Sets the new pointer shape. 00029 * 00030 * Status 00031 * @unimplemented 00032 */ 00033 00034 ULONG APIENTRY 00035 DrvSetPointerShape( 00036 IN SURFOBJ *pso, 00037 IN SURFOBJ *psoMask, 00038 IN SURFOBJ *psoColor, 00039 IN XLATEOBJ *pxlo, 00040 IN LONG xHot, 00041 IN LONG yHot, 00042 IN LONG x, 00043 IN LONG y, 00044 IN RECTL *prcl, 00045 IN FLONG fl) 00046 { 00047 /* return SPS_DECLINE;*/ 00048 return EngSetPointerShape(pso, psoMask, psoColor, pxlo, xHot, yHot, x, y, prcl, fl); 00049 } 00050 00051 /* 00052 * DrvMovePointer 00053 * 00054 * Moves the pointer to a new position and ensures that GDI does not interfere 00055 * with the display of the pointer. 00056 * 00057 * Status 00058 * @unimplemented 00059 */ 00060 00061 VOID APIENTRY 00062 DrvMovePointer( 00063 IN SURFOBJ *pso, 00064 IN LONG x, 00065 IN LONG y, 00066 IN RECTL *prcl) 00067 { 00068 EngMovePointer(pso, x, y, prcl); 00069 } 00070 00071 #else 00072 00073 VOID FASTCALL 00074 IntHideMousePointer(PPDEV ppdev, SURFOBJ *DestSurface) 00075 { 00076 if (ppdev->PointerAttributes.Enable == FALSE) 00077 { 00078 return; 00079 } 00080 00081 ppdev->PointerAttributes.Enable = FALSE; 00082 if (ppdev->PointerSaveSurface != NULL) 00083 { 00084 RECTL DestRect; 00085 POINTL SrcPoint; 00086 SURFOBJ *SaveSurface; 00087 SURFOBJ *MaskSurface; 00088 00089 DestRect.left = max(ppdev->PointerAttributes.Column, 0); 00090 DestRect.top = max(ppdev->PointerAttributes.Row, 0); 00091 DestRect.right = min( 00092 ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width, 00093 ppdev->ScreenWidth - 1); 00094 DestRect.bottom = min( 00095 ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height, 00096 ppdev->ScreenHeight - 1); 00097 00098 SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0); 00099 SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0); 00100 00101 SaveSurface = EngLockSurface(ppdev->PointerSaveSurface); 00102 MaskSurface = EngLockSurface(ppdev->PointerMaskSurface); 00103 EngBitBlt(DestSurface, SaveSurface, MaskSurface, NULL, NULL, 00104 &DestRect, &SrcPoint, &SrcPoint, NULL, NULL, SRCCOPY); 00105 EngUnlockSurface(MaskSurface); 00106 EngUnlockSurface(SaveSurface); 00107 } 00108 } 00109 00110 VOID FASTCALL 00111 IntShowMousePointer(PPDEV ppdev, SURFOBJ *DestSurface) 00112 { 00113 if (ppdev->PointerAttributes.Enable == TRUE) 00114 { 00115 return; 00116 } 00117 00118 ppdev->PointerAttributes.Enable = TRUE; 00119 00120 /* 00121 * Copy the pixels under the cursor to temporary surface. 00122 */ 00123 00124 if (ppdev->PointerSaveSurface != NULL) 00125 { 00126 RECTL DestRect; 00127 POINTL SrcPoint; 00128 SURFOBJ *SaveSurface; 00129 00130 SrcPoint.x = max(ppdev->PointerAttributes.Column, 0); 00131 SrcPoint.y = max(ppdev->PointerAttributes.Row, 0); 00132 00133 DestRect.left = SrcPoint.x - ppdev->PointerAttributes.Column; 00134 DestRect.top = SrcPoint.y - ppdev->PointerAttributes.Row; 00135 DestRect.right = min( 00136 ppdev->PointerAttributes.Width, 00137 ppdev->ScreenWidth - ppdev->PointerAttributes.Column - 1); 00138 DestRect.bottom = min( 00139 ppdev->PointerAttributes.Height, 00140 ppdev->ScreenHeight - ppdev->PointerAttributes.Row - 1); 00141 00142 SaveSurface = EngLockSurface(ppdev->PointerSaveSurface); 00143 EngBitBlt(SaveSurface, DestSurface, NULL, NULL, NULL, 00144 &DestRect, &SrcPoint, NULL, NULL, NULL, SRCCOPY); 00145 EngUnlockSurface(SaveSurface); 00146 } 00147 00148 /* 00149 * Blit the cursor on the screen. 00150 */ 00151 00152 { 00153 RECTL DestRect; 00154 POINTL SrcPoint; 00155 SURFOBJ *ColorSurf; 00156 SURFOBJ *MaskSurf; 00157 00158 DestRect.left = max(ppdev->PointerAttributes.Column, 0); 00159 DestRect.top = max(ppdev->PointerAttributes.Row, 0); 00160 DestRect.right = min( 00161 ppdev->PointerAttributes.Column + ppdev->PointerAttributes.Width, 00162 ppdev->ScreenWidth - 1); 00163 DestRect.bottom = min( 00164 ppdev->PointerAttributes.Row + ppdev->PointerAttributes.Height, 00165 ppdev->ScreenHeight - 1); 00166 00167 SrcPoint.x = max(-ppdev->PointerAttributes.Column, 0); 00168 SrcPoint.y = max(-ppdev->PointerAttributes.Row, 0); 00169 00170 MaskSurf = EngLockSurface(ppdev->PointerMaskSurface); 00171 if (ppdev->PointerColorSurface != NULL) 00172 { 00173 ColorSurf = EngLockSurface(ppdev->PointerColorSurface); 00174 EngBitBlt(DestSurface, ColorSurf, MaskSurf, NULL, ppdev->PointerXlateObject, 00175 &DestRect, &SrcPoint, &SrcPoint, NULL, NULL, 0xAACC); 00176 EngUnlockSurface(ColorSurf); 00177 } 00178 else 00179 { 00180 /* FIXME */ 00181 EngBitBlt(DestSurface, MaskSurf, NULL, NULL, ppdev->PointerXlateObject, 00182 &DestRect, &SrcPoint, NULL, NULL, NULL, SRCAND); 00183 SrcPoint.y += ppdev->PointerAttributes.Height; 00184 EngBitBlt(DestSurface, MaskSurf, NULL, NULL, ppdev->PointerXlateObject, 00185 &DestRect, &SrcPoint, NULL, NULL, NULL, SRCINVERT); 00186 } 00187 EngUnlockSurface(MaskSurf); 00188 } 00189 } 00190 00191 /* 00192 * DrvSetPointerShape 00193 * 00194 * Sets the new pointer shape. 00195 * 00196 * Status 00197 * @implemented 00198 */ 00199 00200 ULONG APIENTRY 00201 DrvSetPointerShape( 00202 IN SURFOBJ *pso, 00203 IN SURFOBJ *psoMask, 00204 IN SURFOBJ *psoColor, 00205 IN XLATEOBJ *pxlo, 00206 IN LONG xHot, 00207 IN LONG yHot, 00208 IN LONG x, 00209 IN LONG y, 00210 IN RECTL *prcl, 00211 IN FLONG fl) 00212 { 00213 PPDEV ppdev = (PPDEV)pso->dhpdev; 00214 SURFOBJ *TempSurfObj; 00215 00216 IntHideMousePointer(ppdev, pso); 00217 00218 if (ppdev->PointerColorSurface != NULL) 00219 { 00220 /* FIXME: Is this really needed? */ 00221 TempSurfObj = EngLockSurface(ppdev->PointerColorSurface); 00222 EngFreeMem(TempSurfObj->pvBits); 00223 TempSurfObj->pvBits = 0; 00224 EngUnlockSurface(TempSurfObj); 00225 00226 EngDeleteSurface(ppdev->PointerColorSurface); 00227 ppdev->PointerMaskSurface = NULL; 00228 } 00229 00230 if (ppdev->PointerMaskSurface != NULL) 00231 { 00232 /* FIXME: Is this really needed? */ 00233 TempSurfObj = EngLockSurface(ppdev->PointerMaskSurface); 00234 EngFreeMem(TempSurfObj->pvBits); 00235 TempSurfObj->pvBits = 0; 00236 EngUnlockSurface(TempSurfObj); 00237 00238 EngDeleteSurface(ppdev->PointerMaskSurface); 00239 ppdev->PointerMaskSurface = NULL; 00240 } 00241 00242 if (ppdev->PointerSaveSurface != NULL) 00243 { 00244 EngDeleteSurface(ppdev->PointerSaveSurface); 00245 ppdev->PointerSaveSurface = NULL; 00246 } 00247 00248 /* 00249 * See if we are being asked to hide the pointer. 00250 */ 00251 00252 if (psoMask == NULL) 00253 { 00254 return SPS_ACCEPT_EXCLUDE; 00255 } 00256 00257 ppdev->PointerHotSpot.x = xHot; 00258 ppdev->PointerHotSpot.y = yHot; 00259 00260 ppdev->PointerXlateObject = pxlo; 00261 ppdev->PointerAttributes.Column = x - xHot; 00262 ppdev->PointerAttributes.Row = y - yHot; 00263 ppdev->PointerAttributes.Width = psoMask->lDelta << 3; 00264 ppdev->PointerAttributes.Height = (psoMask->cjBits / psoMask->lDelta) >> 1; 00265 00266 if (psoColor != NULL) 00267 { 00268 SIZEL Size; 00269 PBYTE Bits; 00270 00271 Size.cx = ppdev->PointerAttributes.Width; 00272 Size.cy = ppdev->PointerAttributes.Height; 00273 Bits = EngAllocMem(0, psoColor->cjBits, ALLOC_TAG); 00274 memcpy(Bits, psoColor->pvBits, psoColor->cjBits); 00275 00276 ppdev->PointerColorSurface = (HSURF)EngCreateBitmap(Size, 00277 psoColor->lDelta, psoColor->iBitmapFormat, 0, Bits); 00278 } 00279 else 00280 { 00281 ppdev->PointerColorSurface = NULL; 00282 } 00283 00284 if (psoMask != NULL) 00285 { 00286 SIZEL Size; 00287 PBYTE Bits; 00288 00289 Size.cx = ppdev->PointerAttributes.Width; 00290 Size.cy = ppdev->PointerAttributes.Height << 1; 00291 Bits = EngAllocMem(0, psoMask->cjBits, ALLOC_TAG); 00292 memcpy(Bits, psoMask->pvBits, psoMask->cjBits); 00293 00294 ppdev->PointerMaskSurface = (HSURF)EngCreateBitmap(Size, 00295 psoMask->lDelta, psoMask->iBitmapFormat, 0, Bits); 00296 } 00297 else 00298 { 00299 ppdev->PointerMaskSurface = NULL; 00300 } 00301 00302 /* 00303 * Create surface for saving the pixels under the cursor. 00304 */ 00305 00306 { 00307 SIZEL Size; 00308 LONG lDelta; 00309 00310 Size.cx = ppdev->PointerAttributes.Width; 00311 Size.cy = ppdev->PointerAttributes.Height; 00312 00313 switch (pso->iBitmapFormat) 00314 { 00315 case BMF_8BPP: lDelta = Size.cx; break; 00316 case BMF_16BPP: lDelta = Size.cx << 1; break; 00317 case BMF_24BPP: lDelta = Size.cx * 3; break; 00318 case BMF_32BPP: lDelta = Size.cx << 2; break; 00319 } 00320 00321 ppdev->PointerSaveSurface = (HSURF)EngCreateBitmap( 00322 Size, lDelta, pso->iBitmapFormat, BMF_NOZEROINIT, NULL); 00323 } 00324 00325 IntShowMousePointer(ppdev, pso); 00326 00327 return SPS_ACCEPT_EXCLUDE; 00328 } 00329 00330 /* 00331 * DrvMovePointer 00332 * 00333 * Moves the pointer to a new position and ensures that GDI does not interfere 00334 * with the display of the pointer. 00335 * 00336 * Status 00337 * @implemented 00338 */ 00339 00340 VOID APIENTRY 00341 DrvMovePointer( 00342 IN SURFOBJ *pso, 00343 IN LONG x, 00344 IN LONG y, 00345 IN RECTL *prcl) 00346 { 00347 PPDEV ppdev = (PPDEV)pso->dhpdev; 00348 BOOL WasVisible; 00349 00350 WasVisible = ppdev->PointerAttributes.Enable; 00351 if (WasVisible) 00352 { 00353 IntHideMousePointer(ppdev, pso); 00354 } 00355 00356 if (x == -1) 00357 { 00358 return; 00359 } 00360 00361 ppdev->PointerAttributes.Column = x - ppdev->PointerHotSpot.x; 00362 ppdev->PointerAttributes.Row = y - ppdev->PointerHotSpot.y; 00363 00364 if (WasVisible) 00365 { 00366 IntShowMousePointer(ppdev, pso); 00367 } 00368 } 00369 00370 #endif Generated on Sat May 26 2012 04:36:55 for ReactOS by
1.7.6.1
|