ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

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;
}

Generated on Fri May 25 2012 06:08:29 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.