Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Graphics
digiKam
Commits
53fd2de9
Commit
53fd2de9
authored
Mar 15, 2015
by
Gilles Caulier
🗼
Browse files
backport commit #
a0ea6361
from git/master to frameworks branch
CCBUGS: 333540
CCBUGS: 319383
CCBUGS: 345168
parent
5a9689d7
Changes
1
Hide whitespace changes
Inline
Side-by-side
libs/dimg/dimg.cpp
View file @
53fd2de9
...
...
@@ -1204,7 +1204,7 @@ void DImg::prepareSubPixelAccess()
}
else
{
float
d
=
sqrt
(((
float
)
i
)
/
LANCZOS_TABLE_RES
);
float
d
=
sqrt
(((
float
)
i
)
/
LANCZOS_TABLE_RES
);
lanczos_func
[
i
]
=
(
LANCZOS_DATA_TYPE
)((
LANCZOS_DATA_ONE
*
LANCZOS_SUPPORT
*
sin
(
M_PI
*
d
)
*
sin
((
M_PI
/
LANCZOS_SUPPORT
)
*
d
))
/
(
M_PI
*
M_PI
*
d
*
d
));
...
...
@@ -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
();
}
...
...
@@ -1301,16 +1301,15 @@ DColor DImg::getSubPixelColor(float x, float y) const
for
(
xc
=
xs
;
xc
<=
xe
;
xc
+=
1.0
,
dx
-=
1.0
)
{
uchar
*
data
=
bits
()
+
(
int
)(
xs
*
bytesDepth
())
+
(
int
)(
width
()
*
ys
*
bytesDepth
());
DColor
src
=
DColor
(
data
,
sixteenBit
());
float
d
=
dx
*
dx
+
dy
*
dy
;
DColor
src
=
DColor
(
data
,
sixteenBit
());
float
d
=
dx
*
dx
+
dy
*
dy
;
if
(
d
>=
LANCZOS_SUPPORT
*
LANCZOS_SUPPORT
)
{
continue
;
}
d
=
lanczos_func
[(
int
)(
d
*
LANCZOS_TABLE_RES
)];
d
=
lanczos_func
[(
int
)(
d
*
LANCZOS_TABLE_RES
)];
norm
+=
d
;
sumR
+=
d
*
src
.
red
();
sumG
+=
d
*
src
.
green
();
...
...
@@ -1361,7 +1360,7 @@ DColor DImg::getSubPixelColor(float x, float y) const
continue
;
}
d
=
lanczos_func
[(
d
*
LANCZOS_TABLE_RES
)
>>
12
];
d
=
lanczos_func
[(
d
*
LANCZOS_TABLE_RES
)
>>
12
];
norm
+=
d
;
sumR
+=
d
*
src
.
red
();
sumG
+=
d
*
src
.
green
();
...
...
@@ -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
;
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment