summaryrefslogtreecommitdiffstats
path: root/jni/filters/contrast.c
diff options
context:
space:
mode:
Diffstat (limited to 'jni/filters/contrast.c')
-rw-r--r--jni/filters/contrast.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/jni/filters/contrast.c b/jni/filters/contrast.c
index 6c1b976..b04e936 100644
--- a/jni/filters/contrast.c
+++ b/jni/filters/contrast.c
@@ -27,6 +27,15 @@ unsigned char clamp(int c)
return (unsigned char) c;
}
+int clampMax(int c,int max)
+{
+ c &= ~(c >> 31);
+ c -= max;
+ c &= (c >> 31);
+ c += max;
+ return c;
+}
+
void JNIFUNCF(ImageFilterContrast, nativeApplyFilter, jobject bitmap, jint width, jint height, jfloat bright)
{
char* destination = 0;