rpcrt4: Try a lot harder to resuse existing connections by comparing inside the RpcQu...
[wine] / dlls / gdiplus / graphicspath.c
1 /*
2  * Copyright (C) 2007 Google (Evan Stade)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  *
18  */
19
20 #include <stdarg.h>
21 #include <math.h>
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "wingdi.h"
27 #include "gdiplus.h"
28 #include "gdiplus_private.h"
29 #include "wine/debug.h"
30
31 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
32
33 GpStatus WINGDIPAPI GdipCreatePath(GpFillMode fill, GpPath **path)
34 {
35     HDC hdc;
36     GpStatus ret;
37
38     if(!path)
39         return InvalidParameter;
40
41     *path = GdipAlloc(sizeof(GpPath));
42     if(!*path)  return OutOfMemory;
43
44     (*path)->fill = fill;
45     (*path)->newfigure = TRUE;
46
47     hdc = GetDC(0);
48     ret = GdipCreateFromHDC(hdc, &((*path)->graphics));
49
50     if(ret != Ok){
51         ReleaseDC(0, hdc);
52         GdipFree(*path);
53     }
54
55     return ret;
56 }
57
58 GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
59 {
60     if(!path || !(path->graphics))
61         return InvalidParameter;
62
63     ReleaseDC(0, path->graphics->hdc);
64     GdipDeleteGraphics(path->graphics);
65     GdipFree(path);
66
67     return Ok;
68 }