mshtml.idl: Added some missing attributes.
[wine.git] / dlls / gdiplus / customlinecap.c
blobaadea5fc2f4df47bcb69cde16f92b8de92442929
1 /*
2 * Copyright (C) 2007 Google (Evan Stade)
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.
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.
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
19 #include <stdarg.h>
21 #include "windef.h"
22 #include "winbase.h"
24 #include "gdiplus.h"
25 #include "gdiplus_private.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus);
30 GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap* from,
31 GpCustomLineCap** to)
33 if(!from || !to)
34 return InvalidParameter;
36 *to = GdipAlloc(sizeof(GpCustomLineCap));
37 if(!*to) return OutOfMemory;
39 memcpy(*to, from, sizeof(GpCustomLineCap));
41 (*to)->pathdata.Points = GdipAlloc(from->pathdata.Count * sizeof(PointF));
42 (*to)->pathdata.Types = GdipAlloc(from->pathdata.Count);
44 if((!(*to)->pathdata.Types || !(*to)->pathdata.Points) && (*to)->pathdata.Count){
45 GdipFree((*to)->pathdata.Points);
46 GdipFree((*to)->pathdata.Types);
47 GdipFree(*to);
48 return OutOfMemory;
51 memcpy((*to)->pathdata.Points, from->pathdata.Points, from->pathdata.Count
52 * sizeof(PointF));
53 memcpy((*to)->pathdata.Types, from->pathdata.Types, from->pathdata.Count);
55 return Ok;
58 /* FIXME: Sometimes when fillPath is non-null and stroke path is null, the native
59 * version of this function returns NotImplemented. I cannot figure out why. */
60 GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath* fillPath, GpPath* strokePath,
61 GpLineCap baseCap, REAL baseInset, GpCustomLineCap **customCap)
63 GpPathData *pathdata;
65 TRACE("%p %p %d %f %p\n", fillPath, strokePath, baseCap, baseInset, customCap);
67 if(!customCap || !(fillPath || strokePath))
68 return InvalidParameter;
70 *customCap = GdipAlloc(sizeof(GpCustomLineCap));
71 if(!*customCap) return OutOfMemory;
73 if(strokePath){
74 (*customCap)->fill = FALSE;
75 pathdata = &strokePath->pathdata;
77 else{
78 (*customCap)->fill = TRUE;
79 pathdata = &fillPath->pathdata;
82 (*customCap)->pathdata.Points = GdipAlloc(pathdata->Count * sizeof(PointF));
83 (*customCap)->pathdata.Types = GdipAlloc(pathdata->Count);
85 if((!(*customCap)->pathdata.Types || !(*customCap)->pathdata.Points) &&
86 pathdata->Count){
87 GdipFree((*customCap)->pathdata.Points);
88 GdipFree((*customCap)->pathdata.Types);
89 GdipFree(*customCap);
90 return OutOfMemory;
93 memcpy((*customCap)->pathdata.Points, pathdata->Points, pathdata->Count
94 * sizeof(PointF));
95 memcpy((*customCap)->pathdata.Types, pathdata->Types, pathdata->Count);
96 (*customCap)->pathdata.Count = pathdata->Count;
98 (*customCap)->inset = baseInset;
99 (*customCap)->cap = baseCap;
101 return Ok;
104 GpStatus WINGDIPAPI GdipDeleteCustomLineCap(GpCustomLineCap *customCap)
106 if(!customCap)
107 return InvalidParameter;
109 GdipFree(customCap->pathdata.Points);
110 GdipFree(customCap->pathdata.Types);
111 GdipFree(customCap);
113 return Ok;