mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-01 01:07:51 -04:00
resizing issues
This commit is contained in:
parent
cf12fbfef7
commit
f119c9c63c
@ -223,7 +223,7 @@ begin_flip() {
|
||||
}
|
||||
|
||||
XPutImage(_display, _xwindow, _gc, _ximage, 0, 0, 0, 0,
|
||||
_properties.get_x_size(), _properties.get_y_size());
|
||||
_frame_buffer->xsize, _frame_buffer->ysize);
|
||||
XFlush(_display);
|
||||
}
|
||||
|
||||
@ -316,7 +316,7 @@ process_events() {
|
||||
properties.set_size(event.xconfigure.width, event.xconfigure.height);
|
||||
system_changed_properties(properties);
|
||||
ZB_resize(_frame_buffer, NULL, _properties.get_x_size(), _properties.get_y_size());
|
||||
_pitch = _properties.get_x_size() * _bytes_per_pixel;
|
||||
_pitch = (_frame_buffer->xsize * _bytes_per_pixel + 3) & ~3;
|
||||
create_ximage();
|
||||
}
|
||||
break;
|
||||
@ -1588,7 +1588,7 @@ create_frame_buffer() {
|
||||
}
|
||||
|
||||
_frame_buffer = ZB_open(_properties.get_x_size(), _properties.get_y_size(), mode, 0, 0, 0, 0);
|
||||
_pitch = _properties.get_x_size() * _bytes_per_pixel;
|
||||
_pitch = (_frame_buffer->xsize * _bytes_per_pixel + 3) & ~3;
|
||||
}
|
||||
|
||||
|
||||
@ -1609,15 +1609,15 @@ create_ximage() {
|
||||
_ximage = NULL;
|
||||
}
|
||||
|
||||
int image_size = _properties.get_x_size() * _properties.get_y_size() * _bytes_per_pixel;
|
||||
int image_size = _frame_buffer->ysize * _pitch;
|
||||
char *data = NULL;
|
||||
if (_bytes_per_pixel != 4) {
|
||||
data = (char *)PANDA_MALLOC_ARRAY(image_size);
|
||||
}
|
||||
|
||||
_ximage = XCreateImage(_display, _visual, _depth, ZPixmap, 0, data,
|
||||
_properties.get_x_size(), _properties.get_y_size(),
|
||||
8, 0);
|
||||
_frame_buffer->xsize, _frame_buffer->ysize,
|
||||
32, 0);
|
||||
}
|
||||
|
||||
#endif // IS_LINUX
|
||||
|
@ -22,6 +22,9 @@ ZBuffer *ZB_open(int xsize, int ysize, int mode,
|
||||
if (zb == NULL)
|
||||
return NULL;
|
||||
|
||||
/* xsize must be a multiple of 4 */
|
||||
xsize = xsize & ~3;
|
||||
|
||||
zb->xsize = xsize;
|
||||
zb->ysize = ysize;
|
||||
zb->mode = mode;
|
||||
@ -98,7 +101,6 @@ void ZB_resize(ZBuffer * zb, void *frame_buffer, int xsize, int ysize)
|
||||
zb->linesize = (xsize * PSZB + 3) & ~3;
|
||||
|
||||
size = zb->xsize * zb->ysize * sizeof(unsigned short);
|
||||
|
||||
gl_free(zb->zbuf);
|
||||
zb->zbuf = gl_malloc(size);
|
||||
|
||||
@ -331,7 +333,7 @@ void ZB_clear_viewport(ZBuffer * zb, int clear_z, int z,
|
||||
}
|
||||
if (clear_color) {
|
||||
color = RGBA_TO_PIXEL(r, g, b, a);
|
||||
pp = zb->pbuf + xmin + ymin * zb->xsize;
|
||||
pp = zb->pbuf + xmin + ymin * (zb->linesize / PSZB);
|
||||
for (y = 0; y < ysize; ++y) {
|
||||
memset_l(pp, color, xsize);
|
||||
pp += zb->xsize;
|
||||
|
Loading…
x
Reference in New Issue
Block a user