diff options
author | Antony Riakiotakis <kalast@gmail.com> | 2015-05-11 17:40:38 +0300 |
---|---|---|
committer | Antony Riakiotakis <kalast@gmail.com> | 2015-05-11 17:41:18 +0300 |
commit | 4fc31881127786f244bc67ad45b3787c6d7917a2 (patch) | |
tree | 7577345458bd5ec6fedaf0050c915ec1ed5125b0 /intern | |
parent | d30f664c0438e8378c79d5beb114b1338d0e1d94 (diff) |
Cycles: Get rid of one more OpenGL matrix manipulation/push/pop.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/device/device.cpp | 10 | ||||
-rw-r--r-- | intern/cycles/device/device.h | 2 | ||||
-rw-r--r-- | intern/cycles/device/device_cuda.cpp | 12 | ||||
-rw-r--r-- | intern/cycles/device/device_multi.cpp | 4 | ||||
-rw-r--r-- | intern/cycles/render/buffers.cpp | 6 |
5 files changed, 15 insertions, 19 deletions
diff --git a/intern/cycles/device/device.cpp b/intern/cycles/device/device.cpp index b34e0646384..a9e4284f35f 100644 --- a/intern/cycles/device/device.cpp +++ b/intern/cycles/device/device.cpp @@ -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) diff --git a/intern/cycles/device/device.h b/intern/cycles/device/device.h index b32f7b406c7..8ac3df1797c 100644 --- a/intern/cycles/device/device.h +++ b/intern/cycles/device/device.h @@ -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 diff --git a/intern/cycles/device/device_cuda.cpp b/intern/cycles/device/device_cuda.cpp index be6a1f3502d..4b325947f0f 100644 --- a/intern/cycles/device/device_cuda.cpp +++ b/intern/cycles/device/device_cuda.cpp @@ -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) diff --git a/intern/cycles/device/device_multi.cpp b/intern/cycles/device/device_multi.cpp index c0a1516f2de..c61e550151f 100644 --- a/intern/cycles/device/device_multi.cpp +++ b/intern/cycles/device/device_multi.cpp @@ -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++; } diff --git a/intern/cycles/render/buffers.cpp b/intern/cycles/render/buffers.cpp index dc00da1bf88..011c722c000 100644 --- a/intern/cycles/render/buffers.cpp +++ b/intern/cycles/render/buffers.cpp @@ -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); } } |