forked from enlightenment/efl
Evas filters: fix clip to target calculation
It was possible to keep negative values for dx,dy which would then draw pixels out of bounds (= crash). Make check crashed after the previous commit. @fix
This commit is contained in:
parent
e05885e0e3
commit
8e795109ac
|
@ -1558,6 +1558,7 @@ _clip_to_target(int *sx /* OUT */, int *sy /* OUT */, int sw, int sh,
|
||||||
{
|
{
|
||||||
if (ox > 0)
|
if (ox > 0)
|
||||||
{
|
{
|
||||||
|
(*sx) = 0;
|
||||||
(*dx) = ox;
|
(*dx) = ox;
|
||||||
(*cols) = sw;
|
(*cols) = sw;
|
||||||
if (((*dx) + (*cols)) > (dw))
|
if (((*dx) + (*cols)) > (dw))
|
||||||
|
@ -1565,18 +1566,21 @@ _clip_to_target(int *sx /* OUT */, int *sy /* OUT */, int sw, int sh,
|
||||||
}
|
}
|
||||||
else if (ox < 0)
|
else if (ox < 0)
|
||||||
{
|
{
|
||||||
|
(*dx) = 0;
|
||||||
(*sx) = (-ox);
|
(*sx) = (-ox);
|
||||||
(*cols) = sw - (*sx);
|
(*cols) = sw - (*sx);
|
||||||
if ((*cols) > dw) (*cols) = dw;
|
if ((*cols) > dw) (*cols) = dw;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
(*dx) = 0;
|
||||||
(*cols) = sw;
|
(*cols) = sw;
|
||||||
if ((*cols) > dw) (*cols) = dw;
|
if ((*cols) > dw) (*cols) = dw;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oy > 0)
|
if (oy > 0)
|
||||||
{
|
{
|
||||||
|
(*sy) = 0;
|
||||||
(*dy) = oy;
|
(*dy) = oy;
|
||||||
(*rows) = sh;
|
(*rows) = sh;
|
||||||
if (((*dy) + (*rows)) > (dh))
|
if (((*dy) + (*rows)) > (dh))
|
||||||
|
@ -1584,12 +1588,14 @@ _clip_to_target(int *sx /* OUT */, int *sy /* OUT */, int sw, int sh,
|
||||||
}
|
}
|
||||||
else if (oy < 0)
|
else if (oy < 0)
|
||||||
{
|
{
|
||||||
|
(*dy) = 0;
|
||||||
(*sy) = (-oy);
|
(*sy) = (-oy);
|
||||||
(*rows) = sh - (*sy);
|
(*rows) = sh - (*sy);
|
||||||
if ((*rows) > dh) (*rows) = dh;
|
if ((*rows) > dh) (*rows) = dh;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
(*dy) = 0;
|
||||||
(*rows) = sh;
|
(*rows) = sh;
|
||||||
if ((*rows) > dh) (*rows) = dh;
|
if ((*rows) > dh) (*rows) = dh;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue