Skip to content

Commit 64c7f9c

Browse files
author
zmoelnig
committed
make old-images tiny (almost free them) when resizing the array:
important when you resize large arrays; TODO: do not resize buffers that already have the correct size git-svn-id: https://pd-gem.svn.sourceforge.net/svnroot/pd-gem/trunk/Gem@2098 49b2a0ca-c541-4d49-a7ef-d785e4371512
1 parent 22685af commit 64c7f9c

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Pixes/pix_buffer.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,14 @@ void pix_buffer :: resizeMess(int newsize)
117117
size=newsize;
118118

119119
for(i=0; i<size; i++) {
120-
if(0!=m_buffer[i].data)
120+
if(0!=m_buffer[i].data) {
121+
// copy the image
121122
m_buffer[i].copy2Image(buffer+i);
123+
m_buffer[i].xsize=1;
124+
m_buffer[i].ysize=1;
125+
// "free" the old image
126+
m_buffer[i].allocate();
127+
}
122128
}
123129

124130
delete[]m_buffer;

0 commit comments

Comments
 (0)