Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / gnu / gcj / xlib / natClip.cc
bloba1f626dfe351383138b580daacf954dd64d03bf6
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
7 details. */
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()
13 #endif
15 #include <vector>
17 #include <X11/Xlib.h>
18 #include <gcj/cni.h>
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];
40 xrect.x = awtrect->x;
41 xrect.y = awtrect->y;
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()
51 if (xrects)
53 delete xrects;
54 xrects = 0;