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
25 #include "gdiplus_private.h"
26 #include "wine/debug.h"
28 WINE_DEFAULT_DEBUG_CHANNEL(gdiplus
);
30 GpStatus WINGDIPAPI
GdipCloneCustomLineCap(GpCustomLineCap
* from
,
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
);
51 memcpy((*to
)->pathdata
.Points
, from
->pathdata
.Points
, from
->pathdata
.Count
53 memcpy((*to
)->pathdata
.Types
, from
->pathdata
.Types
, from
->pathdata
.Count
);
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
)
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
;
74 (*customCap
)->fill
= FALSE
;
75 pathdata
= &strokePath
->pathdata
;
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
) &&
87 GdipFree((*customCap
)->pathdata
.Points
);
88 GdipFree((*customCap
)->pathdata
.Types
);
93 memcpy((*customCap
)->pathdata
.Points
, pathdata
->Points
, pathdata
->Count
95 memcpy((*customCap
)->pathdata
.Types
, pathdata
->Types
, pathdata
->Count
);
96 (*customCap
)->pathdata
.Count
= pathdata
->Count
;
98 (*customCap
)->inset
= baseInset
;
99 (*customCap
)->cap
= baseCap
;
104 GpStatus WINGDIPAPI
GdipDeleteCustomLineCap(GpCustomLineCap
*customCap
)
107 return InvalidParameter
;
109 GdipFree(customCap
->pathdata
.Points
);
110 GdipFree(customCap
->pathdata
.Types
);