Fix T49429: incorrect Blender internal viewport border render with DrawPixels method.

This commit is contained in:
Brecht Van Lommel 2017-04-14 16:26:10 +02:00
parent e12c311002
commit 6fc7521ade
Notes: blender-bot 2023-02-14 07:35:03 +01:00
Referenced by issue #49429, Using render border with real-time viewport Blender Internal rendering and DrawPixels Images Draw Method results in the wrong area being rendered
1 changed files with 4 additions and 4 deletions

View File

@ -566,7 +566,7 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
float rast_x = x + off_x * xzoom;
float rast_y = y + off_y * yzoom;
GLfloat scissor[4];
GLfloat viewport[4];
int draw_w, draw_h;
/* Determine the smallest number of pixels we need to draw
@ -581,9 +581,9 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
* fails if we zoom in on one really huge pixel so that it
* covers the entire screen).
*/
glGetFloatv(GL_SCISSOR_BOX, scissor);
draw_w = min_ii(img_w - off_x, ceil((scissor[2] - rast_x) / xzoom));
draw_h = min_ii(img_h - off_y, ceil((scissor[3] - rast_y) / yzoom));
glGetFloatv(GL_VIEWPORT, viewport);
draw_w = min_ii(img_w - off_x, ceil((viewport[2] - rast_x) / xzoom));
draw_h = min_ii(img_h - off_y, ceil((viewport[3] - rast_y) / yzoom));
if (draw_w > 0 && draw_h > 0) {