Skip to content

Commit

Permalink
Correct sub clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
hgy29 committed Jul 31, 2015
1 parent 1078251 commit a26c12e
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions 2dsg/gfxbackends/Shaders.h
Expand Up @@ -141,10 +141,10 @@ class ShaderEngine
Scissor(int x,int y,int w,int h) : x(x), y(y), w(w), h(h) {}
Scissor(const Scissor &p,int nx,int ny,int nw,int nh) : x(nx), y(ny), w(nw), h(nh)
{
int x2=x+w-1;
int y2=y+h-1;
int px2=p.x+p.w-1;
int py2=p.y+p.h-1;
int x2=x+w;
int y2=y+h;
int px2=p.x+p.w;
int py2=p.y+p.h;
if (p.x>x)
x=p.x;
if (p.y>y)
Expand All @@ -153,8 +153,13 @@ class ShaderEngine
x2=px2;
if (py2<y2)
y2=py2;
w=x2+1-x;
h=y2+1-y;
w=x2-x;
h=y2-y;
if ((w<0)||(h<0))
{
w=0;
h=0;
}
}

int x,y,w,h;
Expand Down

0 comments on commit a26c12e

Please sign in to comment.