Commit 53fd2de9 authored by Gilles Caulier's avatar Gilles Caulier 🗼
Browse files

backport commit #a0ea6361 from git/master to frameworks branch

CCBUGS: 333540
CCBUGS: 319383
CCBUGS: 345168
parent 5a9689d7
......@@ -1264,7 +1264,7 @@ static inline int normalizeAndClamp(int norm, int sum, int max)
DColor DImg::getSubPixelColor(float x, float y) const
{
if (isNull() || x >= width() || y >= height())
if (isNull() || x < 0 || y < 0 || x >= width() || y >= height())
{
return DColor();
}
......@@ -1302,7 +1302,6 @@ DColor DImg::getSubPixelColor(float x, float y) const
{
uchar* data = bits() + (int)(xs * bytesDepth()) + (int)(width() * ys * bytesDepth());
DColor src = DColor(data, sixteenBit());
float d = dx * dx + dy * dy;
if (d >= LANCZOS_SUPPORT * LANCZOS_SUPPORT)
......@@ -1381,6 +1380,16 @@ DColor DImg::getSubPixelColor(float x, float y) const
DColor DImg::getSubPixelColorFast(float x, float y) const
{
if (x < 0)
{
x = 0;
}
if (y < 0)
{
y = 0;
}
int xx = (int)x;
int yy = (int)y;
float d_x = x - (int)x;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment