Cycles: Get rid of one more OpenGL matrix manipulation/push/pop.

This commit is contained in:
Antonis Ryakiotakis 2015-05-11 16:40:38 +02:00
parent d30f664c04
commit 4fc3188112
Notes: blender-bot 2023-02-14 09:08:26 +01:00
Referenced by issue #44707, viewport render in broken with border render activated
5 changed files with 15 additions and 19 deletions

View File

@ -58,7 +58,7 @@ void Device::pixels_free(device_memory& mem)
mem_free(mem);
}
void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int width, int height, bool transparent,
void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dx, int dy, int width, int height, bool transparent,
const DeviceDrawParams &draw_params)
{
pixels_copy_from(rgba, y, w, h);
@ -114,22 +114,22 @@ void Device::draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int w
/* texture coordinate - vertex pair */
vp[0] = 0.0f;
vp[1] = 0.0f;
vp[2] = 0.0f;
vp[2] = dx;
vp[3] = dy;
vp[4] = 1.0f;
vp[5] = 0.0f;
vp[6] = (float)width;
vp[6] = (float)width + dx;
vp[7] = dy;
vp[8] = 1.0f;
vp[9] = 1.0f;
vp[10] = (float)width;
vp[10] = (float)width + dx;
vp[11] = (float)height + dy;
vp[12] = 0.0f;
vp[13] = 1.0f;
vp[14] = 0.0f;
vp[14] = dx;
vp[15] = (float)height + dy;
if (vertex_buffer)

View File

@ -181,7 +181,7 @@ public:
/* opengl drawing */
virtual void draw_pixels(device_memory& mem, int y, int w, int h,
int dy, int width, int height, bool transparent,
int dx, int dy, int width, int height, bool transparent,
const DeviceDrawParams &draw_params);
#ifdef WITH_NETWORK

View File

@ -880,7 +880,7 @@ public:
}
}
void draw_pixels(device_memory& mem, int y, int w, int h, int dy, int width, int height, bool transparent,
void draw_pixels(device_memory& mem, int y, int w, int h, int dx, int dy, int width, int height, bool transparent,
const DeviceDrawParams &draw_params)
{
if(!background) {
@ -932,22 +932,22 @@ public:
/* texture coordinate - vertex pair */
vpointer[0] = 0.0f;
vpointer[1] = 0.0f;
vpointer[2] = 0.0f;
vpointer[2] = dx;
vpointer[3] = dy;
vpointer[4] = (float)w/(float)pmem.w;
vpointer[5] = 0.0f;
vpointer[6] = (float)width;
vpointer[6] = (float)width + dx;
vpointer[7] = dy;
vpointer[8] = (float)w/(float)pmem.w;
vpointer[9] = (float)h/(float)pmem.h;
vpointer[10] = (float)width;
vpointer[10] = (float)width + dx;
vpointer[11] = (float)height + dy;
vpointer[12] = 0.0f;
vpointer[13] = (float)h/(float)pmem.h;
vpointer[14] = 0.0f;
vpointer[14] = dx;
vpointer[15] = (float)height + dy;
glUnmapBuffer(GL_ARRAY_BUFFER);
@ -981,7 +981,7 @@ public:
return;
}
Device::draw_pixels(mem, y, w, h, dy, width, height, transparent, draw_params);
Device::draw_pixels(mem, y, w, h, dx, dy, width, height, transparent, draw_params);
}
void thread_run(DeviceTask *task)

View File

@ -236,7 +236,7 @@ public:
mem.device_pointer = tmp;
}
void draw_pixels(device_memory& rgba, int y, int w, int h, int dy, int width, int height, bool transparent,
void draw_pixels(device_memory& rgba, int y, int w, int h, int dx, int dy, int width, int height, bool transparent,
const DeviceDrawParams &draw_params)
{
device_ptr tmp = rgba.device_pointer;
@ -251,7 +251,7 @@ public:
/* adjust math for w/width */
rgba.device_pointer = sub.ptr_map[tmp];
sub.device->draw_pixels(rgba, sy, w, sh, sdy, width, sheight, transparent, draw_params);
sub.device->draw_pixels(rgba, sy, w, sh, dx, sdy, width, sheight, transparent, draw_params);
i++;
}

View File

@ -369,13 +369,9 @@ void DisplayBuffer::draw_set(int width, int height)
void DisplayBuffer::draw(Device *device, const DeviceDrawParams& draw_params)
{
if(draw_width != 0 && draw_height != 0) {
glPushMatrix();
glTranslatef(params.full_x, params.full_y, 0.0f);
device_memory& rgba = rgba_data();
device->draw_pixels(rgba, 0, draw_width, draw_height, 0, params.width, params.height, transparent, draw_params);
glPopMatrix();
device->draw_pixels(rgba, 0, draw_width, draw_height, params.full_x, params.full_y, params.width, params.height, transparent, draw_params);
}
}