source: trunk/gcc/libjava/gnu/gcj/xlib/natClip.cc

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.3 KB
Line 
1/* Copyright (C) 2000 Free Software Foundation
2
3 This file is part of libgcj.
4
5This software is copyrighted work licensed under the terms of the
6Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
7details. */
8
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
14
15#include <vector>
16
17#include <X11/Xlib.h>
18#include <gcj/cni.h>
19#include <gnu/gcj/RawData.h>
20#include <java/awt/Rectangle.h>
21
22#include "gnu/gcj/xlib/Clip.h"
23
24typedef java::awt::Rectangle AWTRect;
25typedef JArray<AWTRect*> AWTRectArray;
26typedef std::vector<XRectangle> XRectVector;
27
28void gnu::gcj::xlib::Clip::init(AWTRectArray* rectangles)
29{
30 // Prepare rectangles:
31
32 int numRect = JvGetArrayLength(rectangles);
33 XRectVector* xrectvector = new XRectVector(numRect);
34
35 for (int i=0; i<numRect; i++)
36 {
37 AWTRect* awtrect = elements(rectangles)[i];
38 XRectangle& xrect = (*xrectvector)[i];
39
40 xrect.x = awtrect->x;
41 xrect.y = awtrect->y;
42 xrect.width = awtrect->width;
43 xrect.height = awtrect->height;
44 }
45
46 xrects = reinterpret_cast<gnu::gcj::RawData*>(xrectvector);
47}
48
49void gnu::gcj::xlib::Clip::finalize()
50{
51 delete xrects; xrects = 0;
52}
Note: See TracBrowser for help on using the repository browser.