rays 0.1.7 → 0.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.doc/ext/rays/bitmap.cpp +6 -6
  3. data/.doc/ext/rays/bounds.cpp +4 -4
  4. data/.doc/ext/rays/color.cpp +4 -4
  5. data/.doc/ext/rays/color_space.cpp +4 -4
  6. data/.doc/ext/rays/font.cpp +6 -6
  7. data/.doc/ext/rays/image.cpp +6 -6
  8. data/.doc/ext/rays/matrix.cpp +4 -4
  9. data/.doc/ext/rays/painter.cpp +56 -21
  10. data/.doc/ext/rays/point.cpp +5 -4
  11. data/.doc/ext/rays/rays.cpp +2 -3
  12. data/.doc/ext/rays/shader.cpp +5 -5
  13. data/.doc/ext/rays/texture.cpp +5 -5
  14. data/README.md +2 -2
  15. data/VERSION +1 -1
  16. data/ext/rays/bitmap.cpp +6 -6
  17. data/ext/rays/bounds.cpp +4 -4
  18. data/ext/rays/color.cpp +4 -4
  19. data/ext/rays/color_space.cpp +4 -4
  20. data/ext/rays/font.cpp +6 -6
  21. data/ext/rays/image.cpp +6 -6
  22. data/ext/rays/matrix.cpp +4 -4
  23. data/ext/rays/painter.cpp +72 -35
  24. data/ext/rays/point.cpp +5 -4
  25. data/ext/rays/rays.cpp +2 -3
  26. data/ext/rays/shader.cpp +5 -5
  27. data/ext/rays/texture.cpp +5 -5
  28. data/include/rays/opengl.h +1 -1
  29. data/include/rays/painter.h +12 -0
  30. data/include/rays/point.h +35 -9
  31. data/include/rays/ruby/bitmap.h +14 -0
  32. data/include/rays/ruby/bounds.h +14 -0
  33. data/include/rays/ruby/color.h +14 -0
  34. data/include/rays/ruby/color_space.h +14 -0
  35. data/include/rays/ruby/font.h +14 -0
  36. data/include/rays/ruby/image.h +14 -0
  37. data/include/rays/ruby/matrix.h +14 -0
  38. data/include/rays/ruby/painter.h +14 -0
  39. data/include/rays/ruby/point.h +14 -0
  40. data/include/rays/ruby/shader.h +14 -0
  41. data/include/rays/ruby/texture.h +14 -0
  42. data/rays.gemspec +1 -1
  43. data/src/painter.cpp +132 -43
  44. data/src/point.cpp +65 -30
  45. metadata +3 -3
@@ -10,13 +10,11 @@ using namespace Rucy;
10
10
  using Rays::coord;
11
11
 
12
12
 
13
- static Class cPoint;
14
-
15
- RUCY_DEFINE_VALUE_FROM_TO(Rays::Point, cPoint)
13
+ RUCY_DEFINE_VALUE_FROM_TO(Rays::Point)
16
14
 
17
15
  #define THIS to<Rays::Point*>(self)
18
16
 
19
- #define CHECK RUCY_CHECK_OBJ(Rays::Point, cPoint, self)
17
+ #define CHECK RUCY_CHECK_OBJ(Rays::Point, self)
20
18
 
21
19
 
22
20
  static
@@ -229,6 +227,9 @@ RUCY_DEF0(inspect)
229
227
  }
230
228
  RUCY_END
231
229
 
230
+
231
+ static Class cPoint;
232
+
232
233
  void
233
234
  Init_point ()
234
235
  {
@@ -7,9 +7,6 @@
7
7
  using namespace Rucy;
8
8
 
9
9
 
10
- static Module mRays;
11
-
12
-
13
10
  static
14
11
  RUCY_DEF0(init)
15
12
  {
@@ -35,6 +32,8 @@ RUCY_DEF0(init_offscreen_context)
35
32
  RUCY_END
36
33
 
37
34
 
35
+ static Module mRays;
36
+
38
37
  void
39
38
  Init_rays ()
40
39
  {
@@ -8,13 +8,11 @@
8
8
  using namespace Rucy;
9
9
 
10
10
 
11
- static Class cShader;
12
-
13
- RUCY_DEFINE_VALUE_FROM_TO(Rays::Shader, cShader)
11
+ RUCY_DEFINE_VALUE_FROM_TO(Rays::Shader)
14
12
 
15
13
  #define THIS to<Rays::Shader*>(self)
16
14
 
17
- #define CHECK RUCY_CHECK_OBJECT(Rays::Shader, cShader, self)
15
+ #define CHECK RUCY_CHECK_OBJECT(Rays::Shader, self)
18
16
 
19
17
 
20
18
  static
@@ -27,7 +25,7 @@ RUCY_END
27
25
  static
28
26
  RUCY_DEF1(initialize, source)
29
27
  {
30
- RUCY_CHECK_OBJ(Rays::Shader, cShader, self);
28
+ RUCY_CHECK_OBJ(Rays::Shader, self);
31
29
 
32
30
  if (!source.is_s())
33
31
  argument_error(__FILE__, __LINE__);
@@ -38,6 +36,8 @@ RUCY_DEF1(initialize, source)
38
36
  RUCY_END
39
37
 
40
38
 
39
+ static Class cShader;
40
+
41
41
  void
42
42
  Init_shader ()
43
43
  {
@@ -12,13 +12,11 @@ using namespace Rucy;
12
12
  using Rays::coord;
13
13
 
14
14
 
15
- static Class cTexture;
16
-
17
- RUCY_DEFINE_VALUE_FROM_TO(Rays::Texture, cTexture)
15
+ RUCY_DEFINE_VALUE_FROM_TO(Rays::Texture)
18
16
 
19
17
  #define THIS to<Rays::Texture*>(self)
20
18
 
21
- #define CHECK RUCY_CHECK_OBJECT(Rays::Texture, cTexture, self)
19
+ #define CHECK RUCY_CHECK_OBJECT(Rays::Texture, self)
22
20
 
23
21
 
24
22
  static
@@ -31,7 +29,7 @@ RUCY_END
31
29
  static
32
30
  RUCY_DEF4(setup, width, height, color_space, alpha_only)
33
31
  {
34
- RUCY_CHECK_OBJ(Rays::Texture, cTexture, self);
32
+ RUCY_CHECK_OBJ(Rays::Texture, self);
35
33
 
36
34
  Rays::ColorSpace* cs = to<Rays::ColorSpace*>(color_space);
37
35
  if (!cs) argument_error(__FILE__, __LINE__);
@@ -115,6 +113,8 @@ RUCY_DEF0(to_bitmap)
115
113
  RUCY_END
116
114
 
117
115
 
116
+ static Class cTexture;
117
+
118
118
  void
119
119
  Init_texture ()
120
120
  {
@@ -48,7 +48,7 @@ namespace Rays
48
48
  #define glCheckFramebufferStatus glCheckFramebufferStatusOES
49
49
  #define glFramebufferTexture2D glFramebufferTexture2DOES
50
50
  #define glRenderbufferStorage glRenderbufferStorageOES
51
- #define glOrtho glOrthox
51
+ #define glOrtho glOrthof
52
52
 
53
53
  #define GL_UNSIGNED_INT GL_UNSIGNED_INT_OES
54
54
  #define GL_FRAMEBUFFER GL_FRAMEBUFFER_OES
@@ -13,6 +13,10 @@ namespace Rays
13
13
  {
14
14
 
15
15
 
16
+ struct Coord2;
17
+
18
+ struct Coord3;
19
+
16
20
  struct Point;
17
21
 
18
22
  struct Bounds;
@@ -64,6 +68,14 @@ namespace Rays
64
68
 
65
69
  void line (const Point& p1, const Point& p2);
66
70
 
71
+ void lines (const Coord2* points, size_t size);
72
+
73
+ void lines (const Coord3* points, size_t size);
74
+
75
+ void polygon (const Coord2* points, size_t size);
76
+
77
+ void polygon (const Coord3* points, size_t size);
78
+
67
79
  void rect (coord x, coord y, coord width, coord height);
68
80
 
69
81
  void rect (const Bounds& bounds);
@@ -11,7 +11,27 @@ namespace Rays
11
11
  {
12
12
 
13
13
 
14
- struct Point
14
+ struct Coord2
15
+ {
16
+
17
+ union
18
+ {
19
+ struct {coord x, y;};
20
+ coord array[2];
21
+ };
22
+
23
+ Coord2& reset (coord value = 0);
24
+
25
+ Coord2& reset (coord x, coord y);
26
+
27
+ coord& operator [] (size_t index);
28
+
29
+ const coord& operator [] (size_t index) const;
30
+
31
+ };// Coord2
32
+
33
+
34
+ struct Coord3
15
35
  {
16
36
 
17
37
  union
@@ -20,16 +40,26 @@ namespace Rays
20
40
  coord array[3];
21
41
  };
22
42
 
43
+ Coord3& reset (coord value = 0);
44
+
45
+ Coord3& reset (coord x, coord y, coord z = 0);
46
+
47
+ coord& operator [] (size_t index);
48
+
49
+ const coord& operator [] (size_t index) const;
50
+
51
+ };// Coord3
52
+
53
+
54
+ struct Point : public Coord3
55
+ {
56
+
23
57
  Point (coord value = 0);
24
58
 
25
59
  Point (coord x, coord y, coord z = 0);
26
60
 
27
61
  Point dup () const;
28
62
 
29
- Point& reset (coord value = 0);
30
-
31
- Point& reset (coord x, coord y, coord z = 0);
32
-
33
63
  Point& move_to (coord x, coord y, coord z = 0);
34
64
 
35
65
  Point& move_to (const Point& point);
@@ -40,10 +70,6 @@ namespace Rays
40
70
 
41
71
  String inspect () const;
42
72
 
43
- coord& operator [] (size_t index);
44
-
45
- const coord& operator [] (size_t index) const;
46
-
47
73
  Point operator - () const;
48
74
 
49
75
  Point& operator += (const Point& rhs);
@@ -24,4 +24,18 @@ namespace Rays
24
24
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Bitmap)
25
25
 
26
26
 
27
+ namespace Rucy
28
+ {
29
+
30
+
31
+ template <> inline Class
32
+ get_ruby_class<Rays::Bitmap> ()
33
+ {
34
+ return Rays::bitmap_class();
35
+ }
36
+
37
+
38
+ }// Rucy
39
+
40
+
27
41
  #endif//EOH
@@ -26,4 +26,18 @@ namespace Rays
26
26
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Bounds)
27
27
 
28
28
 
29
+ namespace Rucy
30
+ {
31
+
32
+
33
+ template <> inline Class
34
+ get_ruby_class<Rays::Bounds> ()
35
+ {
36
+ return Rays::bounds_class();
37
+ }
38
+
39
+
40
+ }// Rucy
41
+
42
+
29
43
  #endif//EOH
@@ -25,4 +25,18 @@ namespace Rays
25
25
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Color)
26
26
 
27
27
 
28
+ namespace Rucy
29
+ {
30
+
31
+
32
+ template <> inline Class
33
+ get_ruby_class<Rays::Color> ()
34
+ {
35
+ return Rays::color_class();
36
+ }
37
+
38
+
39
+ }// Rucy
40
+
41
+
28
42
  #endif//EOH
@@ -24,4 +24,18 @@ namespace Rays
24
24
  RUCY_DECLARE_VALUE_FROM_TO(Rays::ColorSpace)
25
25
 
26
26
 
27
+ namespace Rucy
28
+ {
29
+
30
+
31
+ template <> inline Class
32
+ get_ruby_class<Rays::ColorSpace> ()
33
+ {
34
+ return Rays::color_space_class();
35
+ }
36
+
37
+
38
+ }// Rucy
39
+
40
+
27
41
  #endif//EOH
@@ -24,4 +24,18 @@ namespace Rays
24
24
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Font)
25
25
 
26
26
 
27
+ namespace Rucy
28
+ {
29
+
30
+
31
+ template <> inline Class
32
+ get_ruby_class<Rays::Font> ()
33
+ {
34
+ return Rays::font_class();
35
+ }
36
+
37
+
38
+ }// Rucy
39
+
40
+
27
41
  #endif//EOH
@@ -24,4 +24,18 @@ namespace Rays
24
24
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Image)
25
25
 
26
26
 
27
+ namespace Rucy
28
+ {
29
+
30
+
31
+ template <> inline Class
32
+ get_ruby_class<Rays::Image> ()
33
+ {
34
+ return Rays::image_class();
35
+ }
36
+
37
+
38
+ }// Rucy
39
+
40
+
27
41
  #endif//EOH
@@ -24,4 +24,18 @@ namespace Rays
24
24
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Matrix)
25
25
 
26
26
 
27
+ namespace Rucy
28
+ {
29
+
30
+
31
+ template <> inline Class
32
+ get_ruby_class<Rays::Matrix> ()
33
+ {
34
+ return Rays::matrix_class();
35
+ }
36
+
37
+
38
+ }// Rucy
39
+
40
+
27
41
  #endif//EOH
@@ -24,4 +24,18 @@ namespace Rays
24
24
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Painter)
25
25
 
26
26
 
27
+ namespace Rucy
28
+ {
29
+
30
+
31
+ template <> inline Class
32
+ get_ruby_class<Rays::Painter> ()
33
+ {
34
+ return Rays::painter_class();
35
+ }
36
+
37
+
38
+ }// Rucy
39
+
40
+
27
41
  #endif//EOH
@@ -25,4 +25,18 @@ namespace Rays
25
25
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Point)
26
26
 
27
27
 
28
+ namespace Rucy
29
+ {
30
+
31
+
32
+ template <> inline Class
33
+ get_ruby_class<Rays::Point> ()
34
+ {
35
+ return Rays::point_class();
36
+ }
37
+
38
+
39
+ }// Rucy
40
+
41
+
28
42
  #endif//EOH
@@ -24,4 +24,18 @@ namespace Rays
24
24
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Shader)
25
25
 
26
26
 
27
+ namespace Rucy
28
+ {
29
+
30
+
31
+ template <> inline Class
32
+ get_ruby_class<Rays::Shader> ()
33
+ {
34
+ return Rays::shader_class();
35
+ }
36
+
37
+
38
+ }// Rucy
39
+
40
+
27
41
  #endif//EOH
@@ -24,4 +24,18 @@ namespace Rays
24
24
  RUCY_DECLARE_VALUE_FROM_TO(Rays::Texture)
25
25
 
26
26
 
27
+ namespace Rucy
28
+ {
29
+
30
+
31
+ template <> inline Class
32
+ get_ruby_class<Rays::Texture> ()
33
+ {
34
+ return Rays::texture_class();
35
+ }
36
+
37
+
38
+ }// Rucy
39
+
40
+
27
41
  #endif//EOH
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.authors = %w[snori]
25
25
  s.email = 'snori@xord.org'
26
- s.homepage = "http://github.com/xord/#{name}/wiki"
26
+ s.homepage = "https://github.com/xord/spacy/wiki/#{name.capitalize}-Home"
27
27
 
28
28
  s.platform = Gem::Platform::RUBY
29
29
  s.required_ruby_version = '>=1.9.0'
@@ -31,8 +31,8 @@ namespace Rays
31
31
  FILL = 0,
32
32
  STROKE,
33
33
 
34
- COLOR_TYPE_LAST,
35
- COLOR_TYPE_FIRST = 0
34
+ COLOR_TYPE_END,
35
+ COLOR_TYPE_BEGIN = 0
36
36
 
37
37
  };// ColorType
38
38
 
@@ -63,19 +63,6 @@ namespace Rays
63
63
  };// Attributes
64
64
 
65
65
 
66
- struct coord2 {
67
-
68
- coord x, y;
69
-
70
- void reset (coord x_, coord y_)
71
- {
72
- x = x_;
73
- y = y_;
74
- }
75
-
76
- };// coord2
77
-
78
-
79
66
  struct Painter::Data
80
67
  {
81
68
 
@@ -89,6 +76,8 @@ namespace Rays
89
76
 
90
77
  bool painting;
91
78
 
79
+ GLenum prev_matrix_mode;
80
+
92
81
  GLuint current_texture;
93
82
 
94
83
  Image text_image;
@@ -98,7 +87,8 @@ namespace Rays
98
87
  mutable Matrix matrix_tmp;
99
88
 
100
89
  Data ()
101
- : painting(false), current_texture(0), text_image(1, 1, GRAY, true)
90
+ : painting(false), prev_matrix_mode(0), current_texture(0),
91
+ text_image(1, 1, GRAY, true)
102
92
  {
103
93
  attrs.init();
104
94
  }
@@ -122,11 +112,6 @@ namespace Rays
122
112
  check_error(__FILE__, __LINE__);
123
113
  }
124
114
 
125
- GLuint frame_buffer_id () const
126
- {
127
- return frame_buffer ? frame_buffer.id() : 0;
128
- }
129
-
130
115
  bool use_color (ColorType type)
131
116
  {
132
117
  const Color& c = attrs.colors[type];
@@ -262,20 +247,22 @@ namespace Rays
262
247
  if (self->painting)
263
248
  invalid_state_error(__FILE__, __LINE__, "self->painting should be false.");
264
249
 
265
- GLuint fb = self->frame_buffer_id();
266
- bind_frame_buffer(fb);
250
+ FrameBuffer& fb = self->frame_buffer;
251
+ if (fb) bind_frame_buffer(fb.id());
267
252
 
268
253
  push_attr();
269
254
  push_shader();
270
255
 
271
256
  const Bounds& vp = self->viewport;
272
- glViewport((int) vp.x, (int)vp.y, (int) vp.width, (int) vp.height);
257
+ glViewport((int) vp.x, (int) vp.y, (int) vp.width, (int) vp.height);
273
258
 
274
259
  coord x1 = vp.x, x2 = vp.x + vp.width;
275
260
  coord y1 = vp.y, y2 = vp.y + vp.height;
276
261
  coord z1 = vp.z, z2 = vp.z + vp.depth;
277
262
  if (z1 == 0 && z2 == 0) {z1 = -100; z2 = 200;}
278
- if (fb == 0) std::swap(y1, y2);
263
+ if (!fb) std::swap(y1, y2);
264
+
265
+ glGetIntegerv(GL_MATRIX_MODE, (GLint*) &self->prev_matrix_mode);
279
266
 
280
267
  glMatrixMode(GL_PROJECTION);
281
268
  glPushMatrix();
@@ -335,15 +322,20 @@ namespace Rays
335
322
  glPopMatrix();
336
323
  #endif
337
324
 
325
+ glMatrixMode(self->prev_matrix_mode);
326
+
338
327
  pop_shader();
339
328
  pop_attr();
340
329
 
341
330
  //glFinish();
342
331
 
343
- unbind_frame_buffer();
332
+ if (self->frame_buffer)
333
+ {
334
+ unbind_frame_buffer();
344
335
 
345
- Texture& tex = self->frame_buffer.texture();
346
- if (tex) tex.set_dirty(true);
336
+ Texture& tex = self->frame_buffer.texture();
337
+ if (tex) tex.set_dirty(true);
338
+ }
347
339
  }
348
340
 
349
341
  void
@@ -390,6 +382,109 @@ namespace Rays
390
382
  line(p1.x, p1.y, p2.x, p2.y);
391
383
  }
392
384
 
385
+ void
386
+ Painter::lines (const Coord2* points, size_t size)
387
+ {
388
+ Data* pself = self.get();
389
+
390
+ if (!pself->painting)
391
+ invalid_state_error(__FILE__, __LINE__, "self->painting should be true.");
392
+
393
+ if (!pself->use_color(STROKE))
394
+ return;
395
+
396
+ boost::scoped_array<uint> indices(new uint[size]);
397
+ for (size_t i = 0; i < size; ++i)
398
+ indices[i] = (uint) i;
399
+
400
+ pself->draw_shape(GL_LINES, (int) size, indices.get(), 2, (coord*) points);
401
+ }
402
+
403
+ void
404
+ Painter::lines (const Coord3* points, size_t size)
405
+ {
406
+ Data* pself = self.get();
407
+
408
+ if (!pself->painting)
409
+ invalid_state_error(__FILE__, __LINE__, "self->painting should be true.");
410
+
411
+ if (!pself->use_color(STROKE))
412
+ return;
413
+
414
+ boost::scoped_array<uint> indices(new uint[size]);
415
+ boost::scoped_array<Coord2> vertices(new Coord2[size]);
416
+ for (size_t i = 0; i < size; ++i)
417
+ {
418
+ indices[i] = (uint) i;
419
+ vertices[i].reset(points[i].x, points[i].y);
420
+ }
421
+
422
+ pself->draw_shape(
423
+ GL_LINES, (int) size, indices.get(), 2, (coord*) vertices.get());
424
+ }
425
+
426
+ void
427
+ Painter::polygon (const Coord2* points, size_t size)
428
+ {
429
+ Data* pself = self.get();
430
+
431
+ if (!pself->painting)
432
+ invalid_state_error(__FILE__, __LINE__, "self->painting should be true.");
433
+
434
+ GLenum modes[] = {GL_TRIANGLE_FAN, GL_LINE_LOOP};
435
+ boost::scoped_array<uint> indices;
436
+
437
+ for (int type = COLOR_TYPE_BEGIN; type < COLOR_TYPE_END; ++type)
438
+ {
439
+ if (!pself->use_color((ColorType) type)) continue;
440
+
441
+ if (!indices.get())
442
+ {
443
+ indices.reset(new uint[size]);
444
+ for (size_t i = 0; i < size; ++i)
445
+ indices[i] = (uint) i;
446
+ }
447
+
448
+ pself->draw_shape(
449
+ modes[type], (int) size, indices.get(), 2, (coord*) points);
450
+ }
451
+ }
452
+
453
+ void
454
+ Painter::polygon (const Coord3* points, size_t size)
455
+ {
456
+ Data* pself = self.get();
457
+
458
+ if (!pself->painting)
459
+ invalid_state_error(__FILE__, __LINE__, "self->painting should be true.");
460
+
461
+ GLenum modes[] = {GL_TRIANGLE_FAN, GL_LINE_LOOP};
462
+ boost::scoped_array<uint> indices;
463
+ boost::scoped_array<Coord2> vertices;
464
+
465
+ for (int type = COLOR_TYPE_BEGIN; type < COLOR_TYPE_END; ++type)
466
+ {
467
+ if (!pself->use_color((ColorType) type)) continue;
468
+
469
+ if (!indices.get())
470
+ {
471
+ indices.reset(new uint[size]);
472
+ for (size_t i = 0; i < size; ++i)
473
+ indices[i] = (uint) i;
474
+ }
475
+
476
+ if (!vertices.get())
477
+ {
478
+ vertices.reset(new Coord2[size]);
479
+ for (size_t i = 0; i < size; ++i)
480
+ vertices[i].reset(points[i].x, points[i].y);
481
+ }
482
+
483
+ pself->draw_shape(
484
+ modes[type], (int) size, indices.get(), 2, (coord*) vertices.get());
485
+ }
486
+ }
487
+
393
488
  void
394
489
  Painter::rect (coord x, coord y, coord width, coord height)
395
490
  {
@@ -409,7 +504,7 @@ namespace Rays
409
504
  coord x2 = x + width - 1;
410
505
  coord y2 = y + height - 1;
411
506
 
412
- for (int type = COLOR_TYPE_FIRST; type < COLOR_TYPE_LAST; ++type)
507
+ for (int type = COLOR_TYPE_BEGIN; type < COLOR_TYPE_END; ++type)
413
508
  {
414
509
  if (!pself->use_color((ColorType) type)) continue;
415
510
 
@@ -460,19 +555,19 @@ namespace Rays
460
555
  float from = angle_from / 360.f;
461
556
  float to = angle_to / 360.f;
462
557
  bool hole = radius_min != 0;
463
- int nvertices = hole ? nsegment * 2 : nsegment + 1;
558
+ int nvertices = hole ? nsegment * 2 : nsegment;
464
559
  GLenum modes[] =
465
560
  {
466
561
  (GLenum) (hole ? GL_TRIANGLE_STRIP : GL_TRIANGLE_FAN),
467
562
  GL_LINE_LOOP
468
563
  };
469
- boost::scoped_array<uint> indices;
470
- boost::scoped_array<coord2> vertices;
564
+ boost::scoped_array<uint> indices;
565
+ boost::scoped_array<Coord2> vertices;
471
566
 
472
567
  x += radius_x;
473
568
  y += radius_y;
474
569
 
475
- for (int type = COLOR_TYPE_FIRST; type < COLOR_TYPE_LAST; ++type)
570
+ for (int type = COLOR_TYPE_BEGIN; type < COLOR_TYPE_END; ++type)
476
571
  {
477
572
  if (!pself->use_color((ColorType) type)) continue;
478
573
 
@@ -484,18 +579,12 @@ namespace Rays
484
579
  }
485
580
 
486
581
  if (!vertices.get())
487
- vertices.reset(new coord2[nvertices]);
582
+ vertices.reset(new Coord2[nvertices]);
488
583
 
489
- coord2* vertex = vertices.get();
584
+ Coord2* vertex = vertices.get();
490
585
  assert(vertex);
491
586
 
492
- if (!hole)
493
- {
494
- vertex->reset(x, y);
495
- ++vertex;
496
- }
497
-
498
- for (int seg = 0; seg <= (int) nsegment; ++seg, ++vertex)
587
+ for (int seg = 0; seg < (int) nsegment; ++seg, ++vertex)
499
588
  {
500
589
  float pos = (float) seg / (float) nsegment;
501
590
  float radian = (from + (to - from) * pos) * PI_2;
@@ -595,7 +684,7 @@ namespace Rays
595
684
  x2, y
596
685
  };
597
686
 
598
- for (int type = COLOR_TYPE_FIRST; type < COLOR_TYPE_LAST; ++type)
687
+ for (int type = COLOR_TYPE_BEGIN; type < COLOR_TYPE_END; ++type)
599
688
  {
600
689
  if (
601
690
  (nostroke && type == STROKE) ||