[Gridflow-cvs] [svn] commit: r3668 - in /trunk: format/videodev.c gridflow.h

gridflow-cvs at artengine.ca gridflow-cvs at artengine.ca
Sat Apr 26 00:33:53 EDT 2008


Author: matju
Date: Sat Apr 26 00:33:52 2008
New Revision: 3668

Log:
for any type T, can now cast P<T> to T *

Modified:
    trunk/format/videodev.c
    trunk/gridflow.h

Modified: trunk/format/videodev.c
==============================================================================
--- trunk/format/videodev.c (original)
+++ trunk/format/videodev.c Sat Apr 26 00:33:52 2008
@@ -355,7 +355,7 @@
 	//post("sy=%d sx=%d bs=%d",sy,sx,bs);
 	//post("frame_finished, vp.palette = %d; colorspace = %s",vp.palette,colorspace.data());
 	if (vp.palette==VIDEO_PALETTE_YUV420P) {
-		GridOutlet out(this,0,colorspace=="magic"?new Dim(sy,sx,3):dim,cast);
+		GridOutlet out(this,0,colorspace=="magic"?new Dim(sy,sx,3):(Dim *)dim,cast);
 		if (colorspace=="y") {
 			out.send(sy*sx,buf);
 		} else if (colorspace=="rgb") {

Modified: trunk/gridflow.h
==============================================================================
--- trunk/gridflow.h (original)
+++ trunk/gridflow.h Sat Apr 26 00:33:52 2008
@@ -295,19 +295,19 @@
 #define INCR if (p) p->refcount++;
 #define DECR if (p) {p->refcount--; if (!p->refcount) delete p;}
 	T *p;
-	P() : p(0) {}
-	P(T *_p)            { p = _p; INCR; }
-	P(const P<T> &_p) {
- p = _p.p; INCR; }
-	P<T> &operator =(T *  _p) { DECR; p=_p;   INCR; return *this; }
-	P<T> &operator =(P<T> _p) { DECR; p=_p.p; INCR; return *this; }
-	bool operator ==(P<T> _p) { return p == _p.p; }
-	bool operator !=(P<T> _p) { return p != _p.p; }
-	~P() { DECR; }
-	bool operator !(){ return  !p; }
-	operator bool()  { return !!p; }
-	T &operator *()  { return  *p; }
-	T *operator ->() { return   p; }
+	P()               {p=0;}
+	P(T *_p)          {p=_p  ; INCR;}
+	P(const P<T> &_p) {p=_p.p; INCR;}
+	P<T> &operator = (T *  _p) {DECR; p=_p;   INCR; return *this;}
+	P<T> &operator = (P<T> _p) {DECR; p=_p.p; INCR; return *this;}
+	bool operator == (P<T> _p) {return p==_p.p;}
+	bool operator != (P<T> _p) {return p!=_p.p;}
+	~P() {DECR;}
+	bool operator !() {return  !p;}
+	operator bool()   {return !!p;}
+	T &operator *()   {return  *p;}
+	T *operator ->()  {return   p;}
+	operator T *() {return p;}
 //#undef INCR
 //#undef DECR
 };



More information about the Gridflow-cvs mailing list