[Gridflow-cvs] [svn] commit: r5594 - in /trunk/src: aalib.cxx fftw.cxx gem.cxx grid.cxx jpeg.cxx mpeg3.cxx opencv.cxx png.cxx quicktimehw.cxx v4l2.cxx videodev.cxx x11.cxx

svn-gridflow at artengine.ca svn-gridflow at artengine.ca
Wed May 5 18:58:19 EDT 2010


Author: matju
Date: Wed May  5 18:58:19 2010
New Revision: 5594

Log:
passage de P<Dim> à Dim

Modified:
    trunk/src/aalib.cxx
    trunk/src/fftw.cxx
    trunk/src/gem.cxx
    trunk/src/grid.cxx
    trunk/src/jpeg.cxx
    trunk/src/mpeg3.cxx
    trunk/src/opencv.cxx
    trunk/src/png.cxx
    trunk/src/quicktimehw.cxx
    trunk/src/v4l2.cxx
    trunk/src/videodev.cxx
    trunk/src/x11.cxx

Modified: trunk/src/aalib.cxx
==============================================================================
--- trunk/src/aalib.cxx (original)
+++ trunk/src/aalib.cxx Wed May  5 18:58:19 2010
@@ -57,7 +57,7 @@
 		rparams = aa_getrenderparams();
 		if (!context) RAISE("opening aalib didn't work");
 		int32 v[]={context->imgheight,context->imgwidth,1};
-		post("aalib image size: %s",(new Dim(3,v))->to_s());
+		post("aalib image size: %s",Dim(3,v).to_s());
 	}
 	~FormatAALib () {if (context) aa_close(context);}
 	\decl 0 hidecursor ();
@@ -123,7 +123,7 @@
 
 \def 0 dump () {
 	int32 v[] = {aa_scrheight(context), aa_scrwidth(context), 2};
-	GridOutlet out(this,0,new Dim(3,v));
+	GridOutlet out(this,0,Dim(3,v));
 	for (int y=0; y<aa_scrheight(context); y++) {
 		for (int x=0; x<aa_scrwidth(context); x++) {
 			int32 data[2];

Modified: trunk/src/fftw.cxx
==============================================================================
--- trunk/src/fftw.cxx (original)
+++ trunk/src/fftw.cxx Wed May  5 18:58:19 2010
@@ -26,13 +26,14 @@
 
 \class GridFFT : FObject {
 	fftwf_plan plan;
-	P<Dim> lastdim; /* of last input (for plan cache) */
+	Dim lastdim; /* of last input (for plan cache) */
+	bool haslastdim;
 	long lastchans; /* of last input (for plan cache) */
 	\attr int sign; /* -1 or +1 */
 	\attr int skip; /* 0 (y and x) or 1 (x only) */
 	\attr bool real;
 	bool lastreal;
-	\constructor () {sign=-1; plan=0; lastdim=0; lastchans=0; skip=0; real=false;}
+	\constructor () {sign=-1; plan=0; haslastdim=false; lastchans=0; skip=0; real=false;}
 	\grin 0 float32
 };
 \def 0 sign (int sign) {
@@ -56,20 +57,20 @@
 	in->set_chunk(0);
 } GRID_FLOW {
 	if (skip==1 && real) RAISE("can't do 1-D FFT in real mode, sorry");
-	Dim *dim;
+	Dim dim;
 	if (!real) dim = in->dim;
 	else if (sign==-1) {
 		int v[Dim::MAX_DIM];
 		for (int i=0; i<in->dim->n; i++) v[i]=in->dim->v[i];
 		v[in->dim->n] = 2;
-		dim = new Dim(in->dim->n+1,v);
-	} else dim = new Dim(in->dim->n-1,in->dim->v);
+		dim = Dim(in->dim->n+1,v);
+	} else dim = Dim(in->dim->n-1,in->dim->v);
 	GridOutlet out(this,0,dim,in->nt);
 	float32 *tada = (float32 *)memalign(16,dim->prod()*sizeof(float32));
 	long chans = in->dim->n>=3 ? in->dim->get(2) : 1;
 	CHECK_ALIGN16(data,in->nt)
 	CHECK_ALIGN16(tada,in->nt)
-	if (plan && lastdim && lastdim!=in->dim && chans!=lastchans && real==lastreal) {fftwf_destroy_plan(plan); plan=0;}
+	if (plan && haslastdim && !lastdim.equal(in->dim) && chans!=lastchans && real==lastreal) {fftwf_destroy_plan(plan); plan=0;}
 	int v[] = {in->dim->v[0],in->dim->v[1],in->dim->n>2?in->dim->v[2]:1};
 //	if (chans==1) {
 //		if (skip==0) plan = fftwf_plan_dft_2d(v[0],v[1],data,tada,sign,0);

Modified: trunk/src/gem.cxx
==============================================================================
--- trunk/src/gem.cxx (original)
+++ trunk/src/gem.cxx Wed May  5 18:58:19 2010
@@ -251,7 +251,7 @@
 		  default: ::post("can't produce grid from pix type %d (0x%x)",  im.type, im.type  ); return;}
 		// on OSX, one was GL_UNSIGNED_INT_8_8_8_8 and the other was...?
 		int32 v[] = { im.ysize, im.xsize, channels };
-		GridOutlet out(this,0,new Dim(3,v),cast);
+		GridOutlet out(this,0,Dim(3,v),cast);
 		long sxc = im.xsize*channels;
 		long sy = v[0];
 		bool f = yflip^im.upsidedown;

Modified: trunk/src/grid.cxx
==============================================================================
--- trunk/src/grid.cxx (original)
+++ trunk/src/grid.cxx Wed May  5 18:58:19 2010
@@ -36,8 +36,8 @@
 #define CHECK_TYPE(d,NT) if (NumberTypeE_type_of(&d)!=NT) RAISE("(%s): " \
 		"type mismatch during transmission (got %s expecting %s)", __PRETTY_FUNCTION__, \
 		number_type_table[NumberTypeE_type_of(&d)].name, number_type_table[NT].name);
-#define CHECK_BUSY1(s) if (!dim) RAISE(#s " not busy");
-#define CHECK_BUSY(s)  if (!dim) RAISE(#s " not busy (wanting to write %ld values)",(long)n);
+#define CHECK_BUSY1(s) if (!this->sender) RAISE(#s " not busy");
+#define CHECK_BUSY(s)  if (!this->sender) RAISE(#s " not busy (wanting to write %ld values)",(long)n);
 #define CHECK_ALIGN(d,nt) {int bytes = number_type_table[nt].size/8; int align = ((long)(void*)d)%bytes; \
 	if (align) {post("(%s): Alignment Warning: %p is not %d-aligned: %d", __PRETTY_FUNCTION__, (void*)d,bytes,align);}}
 
@@ -51,7 +51,7 @@
 			int32 v[i];
 			if (i!=0 && a[i-1].a_type==A_SYMBOL) nt=NumberTypeE_find(a[--i]);
 			for (int j=0; j<i; j++) v[j] = convert(a[j],(int32*)0);
-			init(new Dim(i,v),nt);
+			init(Dim(i,v),nt);
 			CHECK_ALIGN(this->data,nt);
 			if (a[i] != delim) i++;
 			i++; a+=i; n-=i;
@@ -59,7 +59,7 @@
 		}
 	}
 	if (n!=0 && a[0].a_type==A_SYMBOL) {nt = NumberTypeE_find(a[0]); a++; n--;}
-	init(new Dim(n),nt);
+	init(Dim(n),nt);
 	CHECK_ALIGN(this->data,nt);
 	fill:
 	int nn = dim->prod();
@@ -79,7 +79,7 @@
 		t_binbuf *b = a;
 		init_from_list(binbuf_getnatom(b),binbuf_getvec(b));
 	} else if (x.a_type==A_FLOAT) {
-		init(new Dim(),int32_e);
+		init(Dim(),int32_e);
 		CHECK_ALIGN(this->data,nt);
 		((int32 *)*this)[0] = (int32)a.a_float;
 	} else {
@@ -97,9 +97,8 @@
 	chunk = whichdim;
 	long n = dim->prod(whichdim);
 	if (!n) n=1;
-	if(!dim) RAISE("huh?");
 	if (n>1) {
-		buf=new Grid(new Dim(n), sender->nt);
+		buf=new Grid(Dim(n), sender->nt);
 		bufi=0;
 	} else buf=0;
 }
@@ -111,7 +110,7 @@
 }
 
 void GridInlet::begin(GridOutlet *sender) {
-	if (dim) RAISE("grid inlet aborting from %s at %ld/%ld because of %s",
+	if (this->sender) RAISE("grid inlet aborting from %s at %ld/%ld because of %s",
 		ARGS(this->sender->parent),long(dex),long(dim->prod()),ARGS(sender->parent));
 	this->sender = sender;
 	if (!supports_type(sender->nt)) RAISE("number type %s not supported here", number_type_table[sender->nt].name);
@@ -123,7 +122,7 @@
 #define FOO(T) gh->flow(this,dex,-1,(T *)0); break;
 		TYPESWITCH(sender->nt,FOO,)
 #undef FOO
-	} catch (Barf &barf) {this->dim=0; throw;}
+	} catch (Barf &barf) {this->sender=0; throw;}
 	this->dim = dim;
 	sender->callback(this);
 #ifdef TRACEBUFS
@@ -168,13 +167,13 @@
 }
 
 void GridInlet::finish() {
-	if (!dim) RAISE("inlet not busy");
+	CHECK_BUSY1(inlet);
 	if (dim->prod() != dex) post("%s: incomplete grid: %ld of %ld from [%s] to [%s]",
 	    ARGS(parent),dex,long(dim->prod()),ARGS(sender->parent),ARGS(parent));
 #define FOO(T) try {gh->flow(this,dex,-2,(T *)0);} CATCH_IT;
 	TYPESWITCH(sender->nt,FOO,)
 #undef FOO
-	dim=0; buf=0; dex=0;
+	dim=0; buf=0; dex=0; sender=0;
 }
 
 template <class T> void GridInlet::from_grid2(Grid *g, T foo) {
@@ -193,8 +192,8 @@
 
 /* **************** GridOutlet ************************************ */
 
-GridOutlet::GridOutlet(FObject *parent_, int woutlet, P<Dim> dim_, NumberTypeE nt_) {
-	parent=parent_; dim=dim_; nt=nt_; dex=0; bufi=0; buf=0;
+GridOutlet::GridOutlet(FObject *parent_, int woutlet, const Dim &dim_, NumberTypeE nt_) {
+	parent=parent_; dim=dim_; nt=nt_; dex=0; bufi=0; buf=0; sender=this;
 	t_atom a[1];
 	SETGRIDOUT(a,this);
 	if (parent) {
@@ -210,7 +209,7 @@
 	// biggest packet size divisible by lcm_factor
 	int32 v = (MAX_PACKET_SIZE/lcm_factor)*lcm_factor;
 	if (v==0) v=MAX_PACKET_SIZE; // factor too big. don't have a choice.
-	buf=new Grid(new Dim(v),nt);
+	buf=new Grid(Dim(v),nt);
 #ifdef TRACEBUFS
 	std::ostringstream text;
 	oprintf(text,"GridOutlet: %20s buf for sending to  ",buf->dim->to_s());
@@ -283,7 +282,7 @@
 void GridOutlet::finish () {
 	flush();
 	for (uint32 i=0; i<inlets.size(); i++) inlets[i]->finish();
-	dim=0;
+	sender=0;
 }
 
 // never call this. this is a hack to make some things work.

Modified: trunk/src/jpeg.cxx
==============================================================================
--- trunk/src/jpeg.cxx (original)
+++ trunk/src/jpeg.cxx Wed May  5 18:58:19 2010
@@ -98,7 +98,7 @@
 	jpeg_stdio_src(&djpeg,f);
 	jpeg_read_header(&djpeg,TRUE);
 	int sx=djpeg.image_width, sy=djpeg.image_height, chans=djpeg.num_components;
-	GridOutlet out(this,0,new Dim(sy,sx,chans),cast);
+	GridOutlet out(this,0,Dim(sy,sx,chans),cast);
 	jpeg_start_decompress(&djpeg);
 	uint8 row[sx*chans];
 	uint8 *rows[1] = { row };

Modified: trunk/src/mpeg3.cxx
==============================================================================
--- trunk/src/mpeg3.cxx (original)
+++ trunk/src/mpeg3.cxx Wed May  5 18:58:19 2010
@@ -69,7 +69,7 @@
 	uint8 *rows[sy];
 	for (int i=0; i<sy; i++) rows[i]=buf+i*sx*channels;
 	mpeg3_read_frame(mpeg,rows,0,0,sx,sy,sx,sy,MPEG3_RGB888,track);
-	GridOutlet out(this,0,new Dim(sy,sx,channels),cast);
+	GridOutlet out(this,0,Dim(sy,sx,channels),cast);
 	int bs = out.dim->prod(1);
 	for(int y=0; y<sy; y++) out.send(bs,buf+channels*sx*y);
 	DELBUF(buf);

Modified: trunk/src/opencv.cxx
==============================================================================
--- trunk/src/opencv.cxx (original)
+++ trunk/src/opencv.cxx Wed May  5 18:58:19 2010
@@ -119,7 +119,6 @@
 }
 
 CvArr *cvGrid(PtrGrid g, CvMode mode, int reqdims=-1) {
-	P<Dim> d = g->dim;
 	int channels=1;
 	int dims=g->dim->n;
 	//post("mode=%d",(int)mode);
@@ -145,7 +144,7 @@
 }
 
 IplImage *cvImageGrid(PtrGrid g /*, CvMode mode */) {
-	P<Dim> d = g->dim;
+	Dim &d = g->dim;
 	if (d->n!=3) RAISE("expected 3 dimensions, got %s",d->to_s());
 	int channels=g->dim->v[2];
 	if (channels>64) RAISE("too many channels. max 64, got %d",channels);
@@ -155,12 +154,12 @@
 	return a;
 }
 
-void cvMatSend(const CvMat *self, FObject *obj, int outno, Dim *dim=0) {
+void cvMatSend(const CvMat *self, FObject *obj, int outno, Dim &dim) { // was defaulting to dim=Dim(m,n) before 9.10
 	int m = self->rows;
 	int n = self->cols;
 	int e = CV_MAT_TYPE(cvGetElemType(self));
 	int c = CV_MAT_CN(  cvGetElemType(self));
-	GridOutlet *out = new GridOutlet(obj,0,dim?dim:new Dim(m,n));
+	GridOutlet *out = new GridOutlet(obj,0,dim);
 	for (int i=0; i<m; i++) {
 		uchar *meuh = cvPtr2D(self,i,0,0);
 		switch (e) {
@@ -208,7 +207,7 @@
 
 \class CvOp2 : CvOp1 {
 	PtrGrid r;
-	\constructor (Grid *r=0) {this->r = r?r:new Grid(new Dim(),int32_e,true);}
+	\constructor (Grid *r=0) {this->r = r?r:new Grid(Dim(),int32_e,true);}
 	virtual void func(CvArr *l, CvArr *r, CvArr *o) {/* rien */}
 	\grin 0
 	\grin 1
@@ -446,7 +445,7 @@
 	IplImage *img = cvImageGrid(l);
 	CvSeq *ret = cvHaarDetectObjects(img,cascade,storage,scale_factor,min_neighbors,flags);
 	int n = ret ? ret->total : 0;
-	out = new GridOutlet(this,0,new Dim(n,2,2));
+	out = new GridOutlet(this,0,Dim(n,2,2));
 	for (int i=0; i<n; i++) {
 		CvRect *r = (CvRect *)cvGetSeqElem(ret,i);
 		int32 duh[] = {r->y,r->x,r->y+r->height,r->x+r->width};
@@ -478,16 +477,15 @@
 	in->set_chunk(0);
 } GRID_FLOW {
 	int32 v[] = {in->dim->prod(0)/in->dim->prod(-1),in->dim->prod(-1)};
-	PtrGrid l = new Grid(new Dim(2,v),(T *)data);
+	PtrGrid l = new Grid(Dim(2,v),(T *)data);
 	CvArr *a = (CvMat *)cvGrid(l,mode,2);
-	PtrGrid o = new Grid(new Dim(1,v),int32_e);
+	PtrGrid o = new Grid(Dim(1,v),int32_e);
 	CvArr *c = (CvMat *)cvGrid(o,mode);
 	cvKMeans2(a,numClusters,c,termcrit);
 	int w[in->dim->n];
 	COPY(w,in->dim->v,in->dim->n);
 	w[in->dim->n-1] = 1;
-	P<Dim> d = new Dim(in->dim->n,w);
-	out = new GridOutlet(this,0,d);
+	out = new GridOutlet(this,0,Dim(in->dim->n,w));
 	out->send(v[0],(int32 *)*o);
 	cvRelease(&a);
 	cvRelease(&c);

Modified: trunk/src/png.cxx
==============================================================================
--- trunk/src/png.cxx (original)
+++ trunk/src/png.cxx Wed May  5 18:58:19 2010
@@ -123,7 +123,7 @@
 	delete[] row_pointers;
 	row_pointers = 0;
 	png_read_end(png, 0);
-	GridOutlet out(this,0,new Dim(height, width, channels), cast);
+	GridOutlet out(this,0,Dim(height,width,channels),cast);
 	out.send(rowbytes*height,image_data);
 	delete[] image_data;
 	png_destroy_read_struct(&png, &info, NULL);

Modified: trunk/src/quicktimehw.cxx
==============================================================================
--- trunk/src/quicktimehw.cxx (original)
+++ trunk/src/quicktimehw.cxx Wed May  5 18:58:19 2010
@@ -35,20 +35,22 @@
 \class FormatQuickTimeHW : Format {
 	quicktime_t *anim;
 	int track;
-	P<Dim> dim;
+	Dim dim;
+	bool gotdim;
 	char *m_codec;
 	int colorspace;
 	int channels;
 	bool started;
-	P<Dim> force;
+	Dim force;
+	bool doforce;
 	float64 m_framerate;
 	P<BitPacking> bit_packing;
 	int jpeg_quality; // in theory we shouldn't need this, but...
 	float advance;
 	~FormatQuickTimeHW() {if (anim) quicktime_close(anim);}
 	\constructor (t_symbol *mode, string filename) {
-		track=0; dim=0; m_codec=const_cast<char *>(QUICKTIME_RAW);
-		started=false; force=0; m_framerate=29.97; bit_packing=0; jpeg_quality=75;
+		track=0; gotdim=false; m_codec=const_cast<char *>(QUICKTIME_RAW);
+		started=false; doforce=false; m_framerate=29.97; bit_packing=0; jpeg_quality=75;
 		advance = 0;
 // libquicktime may be nice, but it won't take a filehandle, only filename
 		filename = gf_find_file(filename);
@@ -84,7 +86,7 @@
 	\attr bool with_audio;
 };
 
-\def 0 force_size (int32 height, int32 width) { force = new Dim(height, width); }
+\def 0 force_size (int32 height, int32 width) {force = Dim(height, width); doforce=true;}
 \def 0 seek (int32 frame) {
 	quicktime_set_video_position(anim,clip(frame,int32(0),int32(quicktime_video_length(anim,track)-1)),track);
 }
@@ -106,7 +108,7 @@
 		lqt_decode_audio_track(anim,0,output_f,samples,track);
 		float sound2[samples*achannels];
 		for (int i=0; i<samples; i++) for (int j=0; j<achannels; j++) sound2[i*achannels+j] = sound[j*samples+i];
-		GridOutlet out(this,0,new Dim(samples,achannels),float32_e);
+		GridOutlet out(this,0,Dim(samples,achannels),float32_e);
 		out.send(samples*achannels,sound2);
 		advance += samples;
 	    }
@@ -127,11 +129,11 @@
 	case 32: colorspace=BC_RGBA8888; break;
 	default: post("strange quicktime. ask matju."); break;
 	}
-	if (force) {sy = force->get(0); sx = force->get(1);}
+	if (doforce) {sy = force->get(0); sx = force->get(1);}
 	uint8 buf[sy*sx*channels];
 	uint8 *rows[sy]; for (int i=0; i<sy; i++) rows[i]=buf+i*sx*channels;
 	quicktime_decode_scaled(anim,0,0,sx,sy,sx,sy,colorspace,rows,track);
-	GridOutlet out(this,0,new Dim(sy,sx,channels),cast);
+	GridOutlet out(this,0,Dim(sy,sx,channels),cast);
 	out.send(sy*sx*channels,buf);
 	started=true;
 //	return INT2NUM(nframe);
@@ -148,9 +150,10 @@
 \def 0 framerate (float64 f) {m_framerate=f; quicktime_set_framerate(anim, f);}
 
 \def 0 size (int32 height, int32 width) {
-	if (dim) RAISE("video size already set!");
+	if (gotdim) RAISE("video size already set!");
 	// first frame: have to do setup
-	dim = new Dim(height, width, 3);
+	dim = Dim(height,width,3);
+	gotdim = true;
 	quicktime_set_video(anim,1,dim->get(1),dim->get(0),m_framerate,m_codec);
 	quicktime_set_cmodel(anim,colorspace);
 }
@@ -159,7 +162,7 @@
 	if (in->dim->n != 3)           RAISE("expecting 3 dimensions: rows,columns,channels");
 	if (in->dim->get(2)!=channels) RAISE("expecting %d channels (got %d)",channels,in->dim->get(2));
 	in->set_chunk(0);
-	if (dim) {
+	if (gotdim) {
 		if (!dim->equal(in->dim)) RAISE("all frames should be same size");
 	} else {
 		// first frame: have to do setup

Modified: trunk/src/v4l2.cxx
==============================================================================
--- trunk/src/v4l2.cxx (original)
+++ trunk/src/v4l2.cxx Wed May  5 18:58:19 2010
@@ -142,7 +142,7 @@
 	int queuesize, queuemax, next_frame;
 	int current_channel, current_tuner;
 	P<BitPacking> bit_packing3, bit_packing4;
-	P<Dim> dim;
+	Dim dim;
 	int fd;
 	int palette;
 	v4l2_format         fmt;
@@ -218,7 +218,7 @@
 
 \def 0 size (int sy, int sx) {
 	// !@#$ bug here: won't flush the frame queue
-	dim = new Dim(sy,sx,3);
+	dim = Dim(sy,sx,3);
 	WIOCTL(fd, VIDIOC_G_FMT, &fmt); if (debug) gfpost(&fmt);
 	fmt.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	v4l2_pix_format &f = fmt.fmt.pix;
@@ -293,7 +293,7 @@
 	int palette = fmt.fmt.pix.pixelformat;
 	if (palette==V4L2_PIX_FMT_YUYV) {
 		uint8 *bufy = buf;
-		GridOutlet out(this,0,cs=="magic"?new Dim(sy>>downscale,sx>>downscale,3):(Dim *)dim,cast);
+		GridOutlet out(this,0,cs=="magic"?Dim(sy>>downscale,sx>>downscale,3):dim,cast);
 		if (cs=="y") {
 		    for(int y=0; y<sy; bufy+=sx, y++) {
 			for (int x=0,xx=0; x<sx; x+=2,xx+=4) {
@@ -324,7 +324,7 @@
 		}
 	} else if (palette==V4L2_PIX_FMT_YVU420) {
 		uint8 *bufy = buf, *bufu = buf+sx*sy, *bufv = buf+sx*sy*5/4;
-		GridOutlet out(this,0,cs=="magic"?new Dim(sy>>downscale,sx>>downscale,3):(Dim *)dim,cast);
+		GridOutlet out(this,0,cs=="magic"?Dim(sy>>downscale,sx>>downscale,3):dim,cast);
 		if (cs=="y") {
 		    out.send(sy*sx,buf);
 		} else if (cs=="rgb") {
@@ -481,7 +481,7 @@
 		bit_packing4 = new BitPacking(is_le(),3,4,masks);
 	} // else RAISE("huh?");
 	this->colorspace=gensym(c.data());
-	dim = new Dim(dim->v[0],dim->v[1],c=="y"?1:3);
+	dim = Dim(dim->v[0],dim->v[1],c=="y"?1:3);
 }
 
 \def int auto_gain()        {return v4l2_get_control(fd,V4L2_CID_AUTOGAIN);}

Modified: trunk/src/videodev.cxx
==============================================================================
--- trunk/src/videodev.cxx (original)
+++ trunk/src/videodev.cxx Wed May  5 18:58:19 2010
@@ -219,7 +219,7 @@
 	int current_channel, current_tuner;
 	bool use_pwc;
 	P<BitPacking> bit_packing3, bit_packing4;
-	P<Dim> dim;
+	Dim dim;
 	bool has_frequency, has_tuner, has_norm;
 	bool use_libv4l;
 	int fd;
@@ -236,7 +236,7 @@
 		else 	    fd =      open(filename.data(),O_RDWR);
 		if (fd<0) RAISE("can't open device '%s': %s",filename.data(),strerror(errno));
 		WIOCTL(fd, VIDIOCGCAP, &vcaps);
-		dim = new Dim(0,0,0);
+		dim = Dim(0,0,0);
 		name = safe_gensym(vcaps.name);
 		WIOCTL(fd, VIDIOCGPICT,&vp);
 		detect_palettes();
@@ -327,7 +327,7 @@
 \def 0 size (int sy, int sx) {
 	VideoWindow grab_win;
 	// !@#$ bug here: won't flush the frame queue
-	dim = new Dim(sy,sx,dim->v[2]);
+	dim = Dim(sy,sx,dim->v[2]);
 	WIOCTL(fd, VIDIOCGWIN, &grab_win);
 	if (debug) gfpost(&grab_win);
 	grab_win.clipcount = 0;
@@ -370,7 +370,7 @@
 	int bs = dim->prod(1); if (downscale) bs/=2;
 	uint8 b2[bs];
 	//post("frame_finished sy=%d sx=%d bs=%d, vp.palette = %d; colorspace = %s",sy,sx,bs,vp.palette,cs.data());
-	GridOutlet out(this,0,cs=="magic"?new Dim(sy>>downscale,sx>>downscale,3):(Dim *)dim,cast);
+	GridOutlet out(this,0,cs=="magic"?Dim(sy>>downscale,sx>>downscale,3):dim,cast);
 	if (vp.palette==VIDEO_PALETTE_YUYV) {
 		uint8 *bufy = buf;
 		if (cs=="y") {
@@ -599,7 +599,7 @@
 	if (palette==VIDEO_PALETTE_RGB24 ) RGB(0xff0000,0x00ff00,0x0000ff,3); else
 	if (palette==VIDEO_PALETTE_RGB32 ) RGB(0xff0000,0x00ff00,0x0000ff,4);
 	this->colorspace=gensym(c.data());
-	dim = new Dim(dim->v[0],dim->v[1],c=="y"?1:c=="rgba"?4:3);
+	dim = Dim(dim->v[0],dim->v[1],c=="y"?1:c=="rgba"?4:3);
 }
 
 \def bool pwc ()         {return use_pwc;}

Modified: trunk/src/x11.cxx
==============================================================================
--- trunk/src/x11.cxx (original)
+++ trunk/src/x11.cxx Wed May  5 18:58:19 2010
@@ -81,7 +81,7 @@
 	MotifWmHints motifWmHints;
 	int32 pos[2];
 	P<BitPacking> bit_packing;
-	P<Dim> dim;
+	Dim dim;
 	t_clock *clock;
 	std::string title;
 #ifdef HAVE_X11_SHARED_MEMORY
@@ -464,7 +464,7 @@
 }
 
 bool FormatX11::alloc_image (int sx, int sy) {
-	dim = new Dim(sy,sx,3);
+	dim = Dim(sy,sx,3);
 	dealloc_image();
 	if (sx==0 || sy==0) return false;
 	current_x11 = this;



More information about the Gridflow-cvs mailing list