fix java IllegalArgumentException (#1570)

* fix java IllegalArgumentException

* Remove multiple parameter checks
This commit is contained in:
wen xing liao
2018-10-30 11:59:31 +08:00
committed by leda
parent 77e5eb3e56
commit 5bef70b34d
@@ -110,6 +110,12 @@ public:
{
if (_bufferWidth < 1.0f || _bufferHeight < 1.0f)
return;
if (x >= _bufferWidth || y >= _bufferHeight)
return;
if (x + w > _bufferWidth)
w = _bufferWidth - x;
if (y + h > _bufferHeight)
h = _bufferHeight - y;
JniHelper::callObjectVoidMethod(_obj, JCLS_CANVASIMPL, "clearRect", x, y, w, h);
fillData();
}
@@ -118,6 +124,12 @@ public:
{
if (_bufferWidth < 1.0f || _bufferHeight < 1.0f)
return;
if (x >= _bufferWidth || y >= _bufferHeight)
return;
if (x + w > _bufferWidth)
w = _bufferWidth - x;
if (y + h > _bufferHeight)
h = _bufferHeight - y;
JniHelper::callObjectVoidMethod(_obj, JCLS_CANVASIMPL, "fillRect", x, y, w, h);
fillData();
}