projects
/
goodguy
/
history.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
sams last ladspa icons, libopus/vp9, mixer fixer, plugin resets, fmt frmsz, shm fixes
[goodguy/history.git]
/
cinelerra-5.1
/
guicast
/
vframe.C
diff --git
a/cinelerra-5.1/guicast/vframe.C
b/cinelerra-5.1/guicast/vframe.C
index d05ff849307050228459fa93e2767774286b14f9..eaa1f078cb826c063f27880296de0b507d4dfb90 100644
(file)
--- a/
cinelerra-5.1/guicast/vframe.C
+++ b/
cinelerra-5.1/guicast/vframe.C
@@
-131,6
+131,7
@@
VFrame::VFrame(VFrame &frame)
{
reset_parameters(1);
params = new BC_Hash;
{
reset_parameters(1);
params = new BC_Hash;
+ use_shm = frame.use_shm;
allocate_data(0, -1, 0, 0, 0, frame.w, frame.h,
frame.color_model, frame.bytes_per_line);
copy_from(&frame);
allocate_data(0, -1, 0, 0, 0, frame.w, frame.h,
frame.color_model, frame.bytes_per_line);
copy_from(&frame);
@@
-139,6
+140,8
@@
VFrame::VFrame(VFrame &frame)
VFrame::VFrame(int w, int h, int color_model, long bytes_per_line)
{
reset_parameters(1);
VFrame::VFrame(int w, int h, int color_model, long bytes_per_line)
{
reset_parameters(1);
+// use bytes_per_line == 0 to allocate default unshared
+ if( !bytes_per_line ) { bytes_per_line = -1; use_shm = 0; }
params = new BC_Hash;
allocate_data(data, -1, 0, 0, 0, w, h,
color_model, bytes_per_line);
params = new BC_Hash;
allocate_data(data, -1, 0, 0, 0, w, h,
color_model, bytes_per_line);
@@
-502,7
+505,8
@@
int VFrame::allocate_data(unsigned char *data, int shmid,
this->data = 0;
int size = calculate_data_size(this->w, this->h,
this->bytes_per_line, this->color_model);
this->data = 0;
int size = calculate_data_size(this->w, this->h,
this->bytes_per_line, this->color_model);
- if(BC_WindowBase::get_resources()->use_vframe_shm() && use_shm) {
+ if( use_shm && size >= SHM_MIN_SIZE &&
+ BC_WindowBase::get_resources()->use_vframe_shm() ) {
this->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
if( this->shmid >= 0 ) {
this->data = (unsigned char*)shmat(this->shmid, NULL, 0);
this->shmid = shmget(IPC_PRIVATE, size, IPC_CREAT | 0777);
if( this->shmid >= 0 ) {
this->data = (unsigned char*)shmat(this->shmid, NULL, 0);
@@
-518,7
+522,7
@@
int VFrame::allocate_data(unsigned char *data, int shmid,
}
}
// Have to use malloc for libpng
}
}
// Have to use malloc for libpng
- if( !data ) {
+ if( !
this->
data ) {
this->data = (unsigned char *)malloc(size);
this->shmid = -1;
}
this->data = (unsigned char *)malloc(size);
this->shmid = -1;
}
@@
-836,7
+840,7
@@
int VFrame::write_png(const char *path)
bc_cmodel = BC_RGBA8888;
png_cmodel = PNG_COLOR_TYPE_RGB_ALPHA;
}
bc_cmodel = BC_RGBA8888;
png_cmodel = PNG_COLOR_TYPE_RGB_ALPHA;
}
- vframe = new VFrame(get_w(), get_h(), bc_cmodel,
-1
);
+ vframe = new VFrame(get_w(), get_h(), bc_cmodel,
0
);
vframe->transfer_from(this);
break;
}
vframe->transfer_from(this);
break;
}