• R/O
  • SSH
  • HTTPS

daikon: Commit


Commit MetaInfo

Revision35 (tree)
Time2009-02-26 21:01:40
Authorkarasimiso

Log Message

Faceオブジェクトをプールするためのメソッド準備

Change Summary

Incremental Difference

--- trunk/daikon/src/Face.cpp (revision 34)
+++ trunk/daikon/src/Face.cpp (revision 35)
@@ -24,12 +24,12 @@
2424
2525 #include "Face.h"
2626 #include "Window.h"
27+#include "GC.h"
2728
2829 Face::Face()
2930 {
3031 waitingForSurface = false;
3132 inactive = false;
32- destroy = false;
3333 alpha = SDL_ALPHA_OPAQUE;
3434 alphaFlags = SDL_SRCALPHA;
3535 layer = Window::DEFAULTLAYER;
@@ -36,3 +36,13 @@
3636 surface = NULL;
3737 initFrame();
3838 }
39+
40+Face* Face::create()
41+{
42+ return GC<Face>::getInstance();
43+}
44+
45+void Face::destroy()
46+{
47+ GC<Face>::destroy(this);
48+}
--- trunk/daikon/src/ActionFO.cpp (revision 34)
+++ trunk/daikon/src/ActionFO.cpp (revision 35)
@@ -66,7 +66,6 @@
6666 {
6767 face->inactive = false;
6868 face->waitingForSurface = false;
69- face->destroy = false;
7069 }
7170
7271 bool ActionFO::action(SceneMediator* mediator) {
@@ -173,7 +172,6 @@
173172 obj->width = width;
174173 obj->height = height;
175174
176- obj->face = new Face();
177175 obj->face->setSurface(face->surface);
178176 obj->face->initFrame(face->frameWidth, face->frameHeight, face->frameInterval);
179177 obj->face->setDistRect(x,y);
--- trunk/daikon/src/Face.h (revision 34)
+++ trunk/daikon/src/Face.h (revision 35)
@@ -51,7 +51,6 @@
5151 SDL_Surface* surface;
5252 bool waitingForSurface;
5353 bool inactive;
54- bool destroy;
5554
5655 Face();
5756
@@ -58,6 +57,9 @@
5857 private:
5958 List<Face>::Item* listIndex;
6059 public:
60+ Face* create();
61+ void destroy();
62+
6163 inline List<Face>::Item* getListIndex()
6264 {
6365 return listIndex;
--- trunk/daikon/src/Window.cpp (revision 34)
+++ trunk/daikon/src/Window.cpp (revision 35)
@@ -97,10 +97,6 @@
9797 if ( face->waitingForSurface ) {
9898 f = f->getNext();
9999 }
100- else if ( face->destroy ) {
101- delete (face);
102- f = faces->erase(f);
103- }
104100 else if ( face->surface == NULL || face->inactive ) {
105101 f = faces->erase(f);
106102 }
Show on old repository browser