OSDN Git Service

Refactoring: removed unused filters.
authorRuben Brunk <rubenbrunk@google.com>
Fri, 14 Dec 2012 06:42:33 +0000 (22:42 -0800)
committerRuben Brunk <rubenbrunk@google.com>
Fri, 14 Dec 2012 06:50:09 +0000 (22:50 -0800)
Change-Id: If6344fde16607ab9dddb25922d295b1df205df6b

jni/Android.mk
jni/filters/bw.c [deleted file]
src/com/android/gallery3d/filtershow/filters/ImageFilterBW.java [deleted file]
src/com/android/gallery3d/filtershow/filters/ImageFilterBWBlue.java [deleted file]
src/com/android/gallery3d/filtershow/filters/ImageFilterBWGreen.java [deleted file]
src/com/android/gallery3d/filtershow/filters/ImageFilterBWRed.java [deleted file]
src/com/android/gallery3d/filtershow/presets/ImagePresetBW.java [deleted file]
src/com/android/gallery3d/filtershow/presets/ImagePresetBWBlue.java [deleted file]
src/com/android/gallery3d/filtershow/presets/ImagePresetBWGreen.java [deleted file]
src/com/android/gallery3d/filtershow/presets/ImagePresetBWRed.java [deleted file]

index adc5bd3..1843c77 100644 (file)
@@ -25,8 +25,7 @@ LOCAL_CPP_EXTENSION := .cc
 LOCAL_LDFLAGS  := -llog -ljnigraphics
 LOCAL_SDK_VERSION := 9
 LOCAL_MODULE    := libjni_filtershow_filters
-LOCAL_SRC_FILES := filters/bw.c \
-                   filters/gradient.c \
+LOCAL_SRC_FILES := filters/gradient.c \
                    filters/saturated.c \
                    filters/exposure.c \
                    filters/edge.c \
diff --git a/jni/filters/bw.c b/jni/filters/bw.c
deleted file mode 100644 (file)
index f075d30..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "filters.h"
-
-void JNIFUNCF(ImageFilterBW, nativeApplyFilter, jobject bitmap, jint width, jint height)
-{
-    char* destination = 0;
-    AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
-    int i;
-    int len = width * height * 4;
-    float Rf = 0.2999f;
-    float Gf = 0.587f;
-    float Bf = 0.114f;
-
-    for (i = 0; i < len; i+=4)
-    {
-        int r = destination[RED];
-        int g = destination[GREEN];
-        int b = destination[BLUE];
-        int t = CLAMP(Rf * r + Gf * g + Bf *b);
-
-        destination[RED] = t;
-        destination[GREEN] = t;
-        destination[BLUE] = t;
-    }
-    AndroidBitmap_unlockPixels(env, bitmap);
-}
-
-void JNIFUNCF(ImageFilterBWRed, nativeApplyFilter, jobject bitmap, jint width, jint height)
-{
-    char* destination = 0;
-    AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
-    int i;
-    int len = width * height * 4;
-    for (i = 0; i < len; i+=4)
-    {
-        int r = destination[RED];
-        int g = destination[GREEN];
-        int b = destination[BLUE];
-        int t = (g + b) / 2;
-        r = t;
-        g = t;
-        b = t;
-        destination[RED] = r;
-        destination[GREEN] = g;
-        destination[BLUE] = b;
-    }
-    AndroidBitmap_unlockPixels(env, bitmap);
-}
-
-void JNIFUNCF(ImageFilterBWGreen, nativeApplyFilter, jobject bitmap, jint width, jint height)
-{
-    char* destination = 0;
-    AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
-    int i;
-    int len = width * height * 4;
-    for (i = 0; i < len; i+=4)
-    {
-        int r = destination[RED];
-        int g = destination[GREEN];
-        int b = destination[BLUE];
-        int t = (r + b) / 2;
-        r = t;
-        g = t;
-        b = t;
-        destination[RED] = r;
-        destination[GREEN] = g;
-        destination[BLUE] = b;
-    }
-    AndroidBitmap_unlockPixels(env, bitmap);
-}
-
-void JNIFUNCF(ImageFilterBWBlue, nativeApplyFilter, jobject bitmap, jint width, jint height)
-{
-    char* destination = 0;
-    AndroidBitmap_lockPixels(env, bitmap, (void**) &destination);
-    int i;
-    int len = width * height * 4;
-    for (i = 0; i < len; i+=4)
-    {
-        int r = destination[RED];
-        int g = destination[GREEN];
-        int b = destination[BLUE];
-        int t = (r + g) / 2;
-        r = t;
-        g = t;
-        b = t;
-        destination[RED] = r;
-        destination[GREEN] = g;
-        destination[BLUE] = b;
-    }
-    AndroidBitmap_unlockPixels(env, bitmap);
-}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterBW.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterBW.java
deleted file mode 100644 (file)
index f4a7717..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.filtershow.filters;
-
-import android.graphics.Bitmap;
-
-public class ImageFilterBW extends ImageFilter {
-
-    public ImageFilterBW() {
-        mName = "Black & White";
-    }
-
-    native protected void nativeApplyFilter(Bitmap bitmap, int w, int h);
-
-    @Override
-    public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
-        int w = bitmap.getWidth();
-        int h = bitmap.getHeight();
-        nativeApplyFilter(bitmap, w, h);
-        return bitmap;
-    }
-
-}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterBWBlue.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterBWBlue.java
deleted file mode 100644 (file)
index 45f4916..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.filtershow.filters;
-
-import android.graphics.Bitmap;
-
-public class ImageFilterBWBlue extends ImageFilter {
-
-    public ImageFilterBWBlue() {
-        mName = "B&W - Blue";
-    }
-
-    native protected void nativeApplyFilter(Bitmap bitmap, int w, int h);
-
-    @Override
-    public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
-        int w = bitmap.getWidth();
-        int h = bitmap.getHeight();
-        nativeApplyFilter(bitmap, w, h);
-        return bitmap;
-    }
-
-}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterBWGreen.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterBWGreen.java
deleted file mode 100644 (file)
index 8f91c3c..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.filtershow.filters;
-
-import android.graphics.Bitmap;
-
-public class ImageFilterBWGreen extends ImageFilter {
-
-    public ImageFilterBWGreen() {
-        mName = "B&W - Green";
-    }
-
-    native protected void nativeApplyFilter(Bitmap bitmap, int w, int h);
-
-    @Override
-    public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
-        int w = bitmap.getWidth();
-        int h = bitmap.getHeight();
-        nativeApplyFilter(bitmap, w, h);
-        return bitmap;
-    }
-
-}
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterBWRed.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterBWRed.java
deleted file mode 100644 (file)
index f0c65d7..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.filtershow.filters;
-
-import android.graphics.Bitmap;
-
-public class ImageFilterBWRed extends ImageFilter {
-
-    public ImageFilterBWRed() {
-        mName = "B&W - Red";
-    }
-
-    native protected void nativeApplyFilter(Bitmap bitmap, int w, int h);
-
-    @Override
-    public Bitmap apply(Bitmap bitmap, float scaleFactor, boolean highQuality) {
-        int w = bitmap.getWidth();
-        int h = bitmap.getHeight();
-        nativeApplyFilter(bitmap, w, h);
-        return bitmap;
-    }
-
-}
diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePresetBW.java b/src/com/android/gallery3d/filtershow/presets/ImagePresetBW.java
deleted file mode 100644 (file)
index bfa6dac..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.filtershow.presets;
-
-import com.android.gallery3d.filtershow.filters.ImageFilterBW;
-
-public class ImagePresetBW extends ImagePreset {
-
-    @Override
-    public String name() {
-        return "B&W";
-    }
-
-    @Override
-    public void setup() {
-        mFilters.add(new ImageFilterBW());
-    }
-
-}
diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePresetBWBlue.java b/src/com/android/gallery3d/filtershow/presets/ImagePresetBWBlue.java
deleted file mode 100644 (file)
index 5d56aa1..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.filtershow.presets;
-
-import com.android.gallery3d.filtershow.filters.ImageFilterBWBlue;
-
-public class ImagePresetBWBlue extends ImagePreset {
-
-    @Override
-    public String name() {
-        return "B&W - Blue";
-    }
-
-    @Override
-    public void setup() {
-        mFilters.add(new ImageFilterBWBlue());
-    }
-
-}
diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePresetBWGreen.java b/src/com/android/gallery3d/filtershow/presets/ImagePresetBWGreen.java
deleted file mode 100644 (file)
index d1b4e5d..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.filtershow.presets;
-
-import com.android.gallery3d.filtershow.filters.ImageFilterBWGreen;
-
-public class ImagePresetBWGreen extends ImagePreset {
-
-    @Override
-    public String name() {
-        return "B&W - Green";
-    }
-
-    @Override
-    public void setup() {
-        mFilters.add(new ImageFilterBWGreen());
-    }
-
-}
diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePresetBWRed.java b/src/com/android/gallery3d/filtershow/presets/ImagePresetBWRed.java
deleted file mode 100644 (file)
index 9653bed..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package com.android.gallery3d.filtershow.presets;
-
-import com.android.gallery3d.filtershow.filters.ImageFilterBWRed;
-
-public class ImagePresetBWRed extends ImagePreset {
-
-    @Override
-    public String name() {
-        return "B&W - Red";
-    }
-
-    @Override
-    public void setup() {
-        mFilters.add(new ImageFilterBWRed());
-    }
-
-}