Home | Info | Community | Development | myReactOS | Contact Us
Definition at line 589 of file bitmaps.c.
Referenced by IntGdiCreatePatternBrush(), NtUserGetIconInfo(), and UserDrawIconEx().
{ HBITMAP hbmNew; SURFACE *psurfSrc, *psurfNew; /* Fail, if no source bitmap is given */ if (hBitmap == NULL) return 0; /* Lock the source bitmap */ psurfSrc = SURFACE_ShareLockSurface(hBitmap); if (psurfSrc == NULL) { return 0; } /* Allocate a new bitmap with the same dimensions as the source bmp */ hbmNew = GreCreateBitmapEx(psurfSrc->SurfObj.sizlBitmap.cx, psurfSrc->SurfObj.sizlBitmap.cy, abs(psurfSrc->SurfObj.lDelta), psurfSrc->SurfObj.iBitmapFormat, psurfSrc->SurfObj.fjBitmap & BMF_TOPDOWN, psurfSrc->SurfObj.cjBits, NULL, psurfSrc->flags); if (hbmNew) { /* Lock the new bitmap */ psurfNew = SURFACE_ShareLockSurface(hbmNew); if (psurfNew) { /* Copy the bitmap bits to the new bitmap buffer */ RtlCopyMemory(psurfNew->SurfObj.pvBits, psurfSrc->SurfObj.pvBits, psurfNew->SurfObj.cjBits); /* Dereference the new bitmaps palette, we will use a different */ GDIOBJ_vDereferenceObject(&psurfNew->ppal->BaseObject); /* Reference the palette of the source bitmap and use it */ GDIOBJ_vReferenceObjectByPointer(&psurfSrc->ppal->BaseObject); psurfNew->ppal = psurfSrc->ppal; /* Unlock the new surface */ SURFACE_ShareUnlockSurface(psurfNew); } else { /* Failed to lock the bitmap, shouldn't happen */ GreDeleteObject(hbmNew); hbmNew = NULL; } } /* Unlock the source bitmap and return the handle of the new bitmap */ SURFACE_ShareUnlockSurface(psurfSrc); return hbmNew; }