VirtualBox

Changeset 50626 in vbox for trunk/src/VBox/HostServices


Ignore:
Timestamp:
Feb 27, 2014 10:35:21 AM (11 years ago)
Author:
vboxsync
Message:

crOpenGL/win: proper deal with HRGN

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostServices/SharedOpenGL/render/renderspu_wgl.c

    r50095 r50626  
    12331233}
    12341234
     1235static void renderspuWindowRgnApply(WindowInfo *window)
     1236{
     1237    HRGN hRgn = window->hRgn;
     1238    if (hRgn)
     1239    {
     1240        /* note: according to the docs, SetWindowRgn owns the regions after it is called,
     1241         * and the regions will be freed automatically when needed,
     1242         * i.e. the caller should not do that.
     1243         * this is why we need to make a copy of the regions to be passed in */
     1244
     1245        int result;
     1246        hRgn = CreateRectRgn(0, 0, 0, 0);
     1247        if (!hRgn)
     1248        {
     1249            WARN(("CreateRectRgn failed"));
     1250            return;
     1251        }
     1252
     1253        result =  CombineRgn(hRgn, window->hRgn, NULL, RGN_COPY);
     1254        if (result == ERROR)
     1255        {
     1256            WARN(("CombineRgn failed"));
     1257            return;
     1258        }
     1259    }
     1260
     1261    SetWindowRgn(window->hWnd, hRgn, true);
     1262}
     1263
    12351264/* Either show or hide the render SPU's window. */
    12361265void renderspu_SystemShowWindow( WindowInfo *window, GLboolean showIt )
     
    12391268    {
    12401269        crDebug("SHOW renderspu_SystemShowWindow: %x", window->hWnd);
    1241         SetWindowRgn(window->hWnd, window->hRgn, true);
     1270        renderspuWindowRgnApply(window);
    12421271    }
    12431272    else
     
    12471276        hRgn = CreateRectRgn(0, 0, 0, 0);
    12481277        SetWindowRgn(window->hWnd, hRgn, true);
    1249         DeleteObject(hRgn);
     1278        /* note: according to the docs, SetWindowRgn owns the regions after it is called,
     1279         * and the regions will be freed automatically when needed,
     1280         * i.e. the caller should not do that */
    12501281    }
    12511282    window->visible = showIt;
     
    15721603    }
    15731604
     1605    window->hRgn = hRgn;
     1606
    15741607    if (window->visible)
    1575         SetWindowRgn(window->hWnd, hRgn, true);
     1608        renderspuWindowRgnApply(window);
    15761609
    15771610    crDebug("Render SPU: SetWindowRgn (%x, cRects=%i)", window->hWnd, cRects);
    1578 
    1579     window->hRgn = hRgn;
    15801611}
    15811612
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette