2 * Copyright 2003-2010 Haiku, Inc. All rights reserved.
3 * Distributed under the terms of the MIT License.
6 * Axel Dörfler, axeld@pinc-software.de
7 * Adrian Oanca, adioanca@cotty.iren.ro
9 #ifndef SHAPE_PRIVATE_H
10 #define SHAPE_PRIVATE_H
14 #include <Referenceable.h>
20 #define OP_LINETO 0x10000000
21 #define OP_BEZIERTO 0x20000000
22 #define OP_CLOSE 0x40000000
23 #define OP_MOVETO 0x80000000
24 #define OP_LARGE_ARC_TO_CW 0x01000000
25 #define OP_LARGE_ARC_TO_CCW 0x02000000
26 #define OP_SMALL_ARC_TO_CW 0x04000000
27 #define OP_SMALL_ARC_TO_CCW 0x08000000
30 struct shape_data
: public BReferenceable
{
54 shape_data(const shape_data
& other
)
56 opList
= new(std::nothrow
) uint32
[other
.opCount
];
57 ptList
= new(std::nothrow
) BPoint
[other
.ptCount
];
59 opCount
= other
.opCount
;
60 opSize
= other
.opSize
;
61 ptCount
= other
.ptCount
;
62 ptSize
= other
.ptSize
;
63 memcpy(opList
, other
.opList
, opSize
);
64 memcpy(ptList
, other
.ptList
, ptSize
);
67 BRect
DetermineBoundingBox() const
74 // TODO: This implementation doesn't take into account curves at all.
75 bounds
.left
= ptList
[0].x
;
76 bounds
.top
= ptList
[0].y
;
77 bounds
.right
= ptList
[0].x
;
78 bounds
.bottom
= ptList
[0].y
;
80 for (int32 i
= 1; i
< ptCount
; i
++) {
81 if (bounds
.left
> ptList
[i
].x
)
82 bounds
.left
= ptList
[i
].x
;
84 if (bounds
.top
> ptList
[i
].y
)
85 bounds
.top
= ptList
[i
].y
;
87 if (bounds
.right
< ptList
[i
].x
)
88 bounds
.right
= ptList
[i
].x
;
90 if (bounds
.bottom
< ptList
[i
].y
)
91 bounds
.bottom
= ptList
[i
].y
;
99 #endif // SHAPE_PRIVATE_H