1 /* Copyright (C) 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 // Needed to avoid linking in libstdc++
10 #ifndef __STL_USE_EXCEPTIONS
11 # include <java/lang/OutOfMemoryError.h>
12 # define __THROW_BAD_ALLOC throw new java::lang::OutOfMemoryError()
19 #include <gnu/gcj/RawData.h>
20 #include <java/awt/Rectangle.h>
22 #include "gnu/gcj/xlib/Clip.h"
24 typedef java::awt::Rectangle AWTRect
;
25 typedef JArray
<AWTRect
*> AWTRectArray
;
26 typedef std::vector
<XRectangle
> XRectVector
;
28 void gnu::gcj::xlib::Clip::init(AWTRectArray
* rectangles
)
30 // Prepare rectangles:
32 int numRect
= JvGetArrayLength(rectangles
);
33 XRectVector
* xrectvector
= new XRectVector(numRect
);
35 for (int i
=0; i
<numRect
; i
++)
37 AWTRect
* awtrect
= elements(rectangles
)[i
];
38 XRectangle
& xrect
= (*xrectvector
)[i
];
42 xrect
.width
= awtrect
->width
;
43 xrect
.height
= awtrect
->height
;
46 xrects
= reinterpret_cast<gnu::gcj::RawData
*>(xrectvector
);
49 void gnu::gcj::xlib::Clip::dispose()