summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/filters
diff options
context:
space:
mode:
authorJohn Hoford <hoford@google.com>2013-07-30 16:02:10 -0700
committerJohn Hoford <hoford@google.com>2013-07-30 16:15:16 -0700
commitdb7b89f63ec342d217efe6af90a3949f47e2fd33 (patch)
tree100e0295fa977fe6049c1611b3b51da379be7f3a /src/com/android/gallery3d/filtershow/filters
parent41c10a66ee55978b0673ac68a097d556b719887a (diff)
downloadandroid_packages_apps_Gallery2-db7b89f63ec342d217efe6af90a3949f47e2fd33.tar.gz
android_packages_apps_Gallery2-db7b89f63ec342d217efe6af90a3949f47e2fd33.tar.bz2
android_packages_apps_Gallery2-db7b89f63ec342d217efe6af90a3949f47e2fd33.zip
clean up some bugs and update the icons
Change-Id: I6952bae8cfea2ec64064f3126eece93687c02eae
Diffstat (limited to 'src/com/android/gallery3d/filtershow/filters')
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterGradRepresentation.java62
-rw-r--r--src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java11
-rw-r--r--src/com/android/gallery3d/filtershow/filters/grad.rs10
3 files changed, 23 insertions, 60 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/FilterGradRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterGradRepresentation.java
index 1bfce6f05..64e7fb0c9 100644
--- a/src/com/android/gallery3d/filtershow/filters/FilterGradRepresentation.java
+++ b/src/com/android/gallery3d/filtershow/filters/FilterGradRepresentation.java
@@ -42,7 +42,7 @@ public class FilterGradRepresentation extends FilterRepresentation
super("Grad");
setSerializationName(SERIALIZATION_NAME);
creatExample();
- setOverlayId(R.drawable.filtershow_button_colors_vignette);
+ setOverlayId(R.drawable.filtershow_button_grad);
setFilterClass(ImageFilterGrad.class);
setTextId(R.string.grad);
setEditorId(EditorGrad.ID);
@@ -63,7 +63,7 @@ public class FilterGradRepresentation extends FilterRepresentation
static class Band {
private boolean mask = true;
- private boolean active = true;
+
private int xPos1 = -1;
private int yPos1 = 100;
private int xPos2 = -1;
@@ -71,7 +71,7 @@ public class FilterGradRepresentation extends FilterRepresentation
private int brightness = 40;
private int contrast = 0;
private int saturation = 0;
- private boolean inking;
+
public Band() {
}
@@ -85,7 +85,6 @@ public class FilterGradRepresentation extends FilterRepresentation
public Band(Band copy) {
mask = copy.mask;
- active = copy.active;
xPos1 = copy.xPos1;
yPos1 = copy.yPos1;
xPos2 = copy.xPos2;
@@ -93,7 +92,6 @@ public class FilterGradRepresentation extends FilterRepresentation
brightness = copy.brightness;
contrast = copy.contrast;
saturation = copy.saturation;
- inking = copy.inking;
}
}
@@ -112,7 +110,6 @@ public class FilterGradRepresentation extends FilterRepresentation
private void creatExample() {
Band p = new Band();
p.mask = false;
- p.active = true;
p.xPos1 = -1;
p.yPos1 = 100;
p.xPos2 = -1;
@@ -120,7 +117,6 @@ public class FilterGradRepresentation extends FilterRepresentation
p.brightness = 40;
p.contrast = 0;
p.saturation = 0;
- p.inking = false;
mBands.add(0, p);
mCurrentBand = p;
trimVector();
@@ -155,7 +151,26 @@ public class FilterGradRepresentation extends FilterRepresentation
@Override
public boolean equals(FilterRepresentation representation) {
if (representation instanceof FilterGradRepresentation) {
- return true; // TODO much more extensive equals needed
+ FilterGradRepresentation rep = (FilterGradRepresentation) representation;
+ int n = getNumberOfBands();
+ if (rep.getNumberOfBands() != n) {
+ return false;
+ }
+ for (int i = 0; i < mBands.size(); i++) {
+ Band b1 = mBands.get(i);
+ Band b2 = rep.mBands.get(i);
+ if (b1.mask != b2.mask
+ || b1.brightness != b2.brightness
+ || b1.contrast != b2.contrast
+ || b1.saturation != b2.saturation
+ || b1.xPos1 != b2.xPos1
+ || b1.xPos2 != b2.xPos2
+ || b1.yPos1 != b2.yPos1
+ || b1.yPos2 != b2.yPos2) {
+ return false;
+ }
+ }
+ return true;
}
return false;
}
@@ -170,17 +185,6 @@ public class FilterGradRepresentation extends FilterRepresentation
return count;
}
- public void toggleInking() {
- mCurrentBand.inking = !mCurrentBand.inking;
- }
-
- public void setInking(boolean on) {
- for (Band point : mBands) {
- point.inking = false;
- }
- mCurrentBand.inking = on;
- }
-
public int addBand(Rect rect) {
mBands.add(0, mCurrentBand = new Band(rect.centerX(), rect.centerY()));
mCurrentBand.mask = false;
@@ -278,17 +282,6 @@ public class FilterGradRepresentation extends FilterRepresentation
return ret;
}
- public boolean[] getActive() {
- boolean[] ret = new boolean[mBands.size()];
- int i = 0;
- String s = "";
- for (Band point : mBands) {
- ret[i++] = point.active;
- s += (point.active) ? "1" : "0";
- }
- return ret;
- }
-
public int[] getXPos1() {
int[] ret = new int[mBands.size()];
int i = 0;
@@ -352,15 +345,6 @@ public class FilterGradRepresentation extends FilterRepresentation
return ret;
}
- public boolean[] getInking() {
- boolean[] ret = new boolean[mBands.size()];
- int i = 0;
- for (Band point : mBands) {
- ret[i++] = point.inking;
- }
- return ret;
- }
-
public int getParameter(int type) {
switch (type){
case PARAM_BRIGHTNESS:
diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java
index e5e9f13f5..cbdfaa623 100644
--- a/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java
+++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterGrad.java
@@ -117,15 +117,6 @@ public class ImageFilterGrad extends ImageFilterRS {
mScript.set_inputHeight(height);
}
- private boolean hasInk() {
- boolean[] ink = mParameters.getInking();
- for (int i = 0; i < ink.length; i++) {
- if (ink[i])
- return true;
- }
- return false;
- }
-
@Override
protected void runFilter() {
int[] x1 = mParameters.getXPos1();
@@ -151,7 +142,6 @@ public class ImageFilterGrad extends ImageFilterRS {
}
mScript.set_mask(mParameters.getMask());
- mScript.set_active(mParameters.getActive());
mScript.set_xPos1(x1);
mScript.set_yPos1(y1);
mScript.set_xPos2(x2);
@@ -160,7 +150,6 @@ public class ImageFilterGrad extends ImageFilterRS {
mScript.set_brightness(mParameters.getBrightness());
mScript.set_contrast(mParameters.getContrast());
mScript.set_saturation(mParameters.getSaturation());
- mScript.set_inking(mParameters.getInking());
mScript.invoke_setupGradParams();
runSelectiveAdjust(
diff --git a/src/com/android/gallery3d/filtershow/filters/grad.rs b/src/com/android/gallery3d/filtershow/filters/grad.rs
index 42e1e5faf..ddbafd349 100644
--- a/src/com/android/gallery3d/filtershow/filters/grad.rs
+++ b/src/com/android/gallery3d/filtershow/filters/grad.rs
@@ -27,8 +27,6 @@ static const float Bf = 0.114f;
//static const float size_scale = 0.01f;
typedef struct {
- bool active;
- bool inking;
rs_matrix3x3 colorMatrix;
float rgbOff;
float dx;
@@ -38,7 +36,6 @@ typedef struct {
int mNumberOfLines;
// input data
bool mask[MAX_POINTS];
-bool active[MAX_POINTS];
int xPos1[MAX_POINTS];
int yPos1[MAX_POINTS];
int xPos2[MAX_POINTS];
@@ -47,8 +44,6 @@ int size[MAX_POINTS];
int brightness[MAX_POINTS];
int contrast[MAX_POINTS];
int saturation[MAX_POINTS];
-bool inking[MAX_POINTS];
-
// generated data
static UPointData grads[MAX_POINTS];
@@ -56,7 +51,6 @@ static UPointData grads[MAX_POINTS];
void setupGradParams() {
int k = 0;
for (int i = 0; i < MAX_POINTS; i++) {
- grads[i].active = false;
if (!mask[i]) {
continue;
}
@@ -67,7 +61,6 @@ void setupGradParams() {
float denom = (y2 * y2 - 2 * y1 * y2 + x2 * x2 - 2 * x1 * x2 + y1 * y1 + x1 * x1);
if (denom == 0) {
- grads[i].active = false;
continue;
}
grads[k].dy = (y1 - y2) / denom;
@@ -94,9 +87,6 @@ void setupGradParams() {
rsMatrixSet(&grads[i].colorMatrix, 1, 2, b * Gt);
rsMatrixSet(&grads[i].colorMatrix, 2, 2, b * (Bt + S));
-
- grads[k].active = true;
- grads[k].inking = inking[i];
k++;
}
mNumberOfLines = k;