diff options
author | Yuli Huang <yuli@google.com> | 2011-10-05 16:22:10 +0800 |
---|---|---|
committer | Yuli Huang <yuli@google.com> | 2011-10-05 17:15:25 +0800 |
commit | f94475fb525ef65c40365925da5b5a44ef645c05 (patch) | |
tree | 86799c0aabdc89de1d742cb3ddb205a790157663 /src/com/android/gallery3d/photoeditor | |
parent | 3807c5774cc60d0a8745d8e396ecc679dc7b7270 (diff) | |
download | android_packages_apps_Snap-f94475fb525ef65c40365925da5b5a44ef645c05.tar.gz android_packages_apps_Snap-f94475fb525ef65c40365925da5b5a44ef645c05.tar.bz2 android_packages_apps_Snap-f94475fb525ef65c40365925da5b5a44ef645c05.zip |
Fix b/5413887 and b/5389281.
1. Fix b/5413887 by releasing MFF effects as well as release
MFF effect-context.
2. Fix b/5389281 by removing photoView.setPhoto(null).
Change-Id: I1b848f6c87b03ba2539432fd6d6f13f4ac3a2907
Diffstat (limited to 'src/com/android/gallery3d/photoeditor')
28 files changed, 102 insertions, 116 deletions
diff --git a/src/com/android/gallery3d/photoeditor/FilterStack.java b/src/com/android/gallery3d/photoeditor/FilterStack.java index 5b8d0d743..67b904d55 100644 --- a/src/com/android/gallery3d/photoeditor/FilterStack.java +++ b/src/com/android/gallery3d/photoeditor/FilterStack.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor; import android.graphics.Bitmap; -import android.media.effect.EffectContext; import com.android.gallery3d.photoeditor.filters.Filter; @@ -44,7 +43,6 @@ public class FilterStack { private final PhotoView photoView; private final StackListener stackListener; - private EffectContext effectContext; private Photo source; private Runnable queuedTopFilterChange; private volatile boolean paused; @@ -54,15 +52,6 @@ public class FilterStack { this.stackListener = stackListener; } - private void clearBuffers() { - for (int i = 0; i < buffers.length; i++) { - if (buffers[i] != null) { - buffers[i].clear(); - buffers[i] = null; - } - } - } - private void reallocateBuffer(int target) { int other = target ^ 1; buffers[target] = Photo.create(buffers[other].width(), buffers[other].height()); @@ -70,7 +59,12 @@ public class FilterStack { private void invalidate() { // In/out buffers need redrawn by re-applying filters on source photo. - clearBuffers(); + for (int i = 0; i < buffers.length; i++) { + if (buffers[i] != null) { + buffers[i].clear(); + buffers[i] = null; + } + } if (source != null) { buffers[0] = Photo.create(source.width(), source.height()); reallocateBuffer(1); @@ -98,7 +92,7 @@ public class FilterStack { buffers[out].clear(); reallocateBuffer(out); } - appliedStack.get(filterIndex).process(effectContext, input, buffers[out]); + appliedStack.get(filterIndex).process(input, buffers[out]); return buffers[out]; } return null; @@ -229,19 +223,18 @@ public class FilterStack { public void onPause() { // Flush pending queued operations and release effect-context before GL context is lost. - // Use pause-flag to avoid lengthy runnable in GL thread blocking onPause(). + // Use the flag to break from lengthy invalidate() in GL thread for not blocking onPause(). paused = true; photoView.flush(); photoView.queueEvent(new Runnable() { @Override public void run() { - if (effectContext != null) { - effectContext.release(); - effectContext = null; + Filter.releaseContext(); + for (int i = 0; i < buffers.length; i++) { + // Textures will be automatically deleted when GL context is lost. + buffers[i] = null; } - photoView.setPhoto(null); - clearBuffers(); } }); photoView.onPause(); @@ -254,7 +247,7 @@ public class FilterStack { @Override public void run() { // Create effect context after GL context is created or recreated. - effectContext = EffectContext.createWithCurrentGlContext(); + Filter.createContextWithCurrentGlContext(); } }); paused = false; diff --git a/src/com/android/gallery3d/photoeditor/filters/AutoFixFilter.java b/src/com/android/gallery3d/photoeditor/filters/AutoFixFilter.java index a219abe8d..78153d0a8 100644 --- a/src/com/android/gallery3d/photoeditor/filters/AutoFixFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/AutoFixFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class AutoFixFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_AUTOFIX); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_AUTOFIX); effect.setParameter("scale", scale); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/ColorTemperatureFilter.java b/src/com/android/gallery3d/photoeditor/filters/ColorTemperatureFilter.java index dc6f1a7b6..f9c640059 100644 --- a/src/com/android/gallery3d/photoeditor/filters/ColorTemperatureFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/ColorTemperatureFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class ColorTemperatureFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_TEMPERATURE); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_TEMPERATURE); effect.setParameter("scale", scale); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/CropFilter.java b/src/com/android/gallery3d/photoeditor/filters/CropFilter.java index 372279ee2..f984f3bc2 100644 --- a/src/com/android/gallery3d/photoeditor/filters/CropFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/CropFilter.java @@ -18,7 +18,6 @@ package com.android.gallery3d.photoeditor.filters; import android.graphics.RectF; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -39,11 +38,11 @@ public class CropFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { + public void process(Photo src, Photo dst) { dst.changeDimension(Math.round(bounds.width() * src.width()), Math.round(bounds.height() * src.height())); - Effect effect = getEffect(context, EffectFactory.EFFECT_CROP); + Effect effect = getEffect(EffectFactory.EFFECT_CROP); effect.setParameter("xorigin", Math.round(bounds.left * src.width())); effect.setParameter("yorigin", Math.round(bounds.top * src.height())); effect.setParameter("width", dst.width()); diff --git a/src/com/android/gallery3d/photoeditor/filters/CrossProcessFilter.java b/src/com/android/gallery3d/photoeditor/filters/CrossProcessFilter.java index f03bf5fe9..bea8a272c 100644 --- a/src/com/android/gallery3d/photoeditor/filters/CrossProcessFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/CrossProcessFilter.java @@ -16,7 +16,6 @@ package com.android.gallery3d.photoeditor.filters; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -31,8 +30,8 @@ public class CrossProcessFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - getEffect(context, EffectFactory.EFFECT_CROSSPROCESS).apply( + public void process(Photo src, Photo dst) { + getEffect(EffectFactory.EFFECT_CROSSPROCESS).apply( src.texture(), src.width(), src.height(), dst.texture()); } } diff --git a/src/com/android/gallery3d/photoeditor/filters/DocumentaryFilter.java b/src/com/android/gallery3d/photoeditor/filters/DocumentaryFilter.java index 800d59a05..4075b27cc 100644 --- a/src/com/android/gallery3d/photoeditor/filters/DocumentaryFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/DocumentaryFilter.java @@ -16,7 +16,6 @@ package com.android.gallery3d.photoeditor.filters; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -31,8 +30,8 @@ public class DocumentaryFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - getEffect(context, EffectFactory.EFFECT_DOCUMENTARY).apply( + public void process(Photo src, Photo dst) { + getEffect(EffectFactory.EFFECT_DOCUMENTARY).apply( src.texture(), src.width(), src.height(), dst.texture()); } } diff --git a/src/com/android/gallery3d/photoeditor/filters/DoodleFilter.java b/src/com/android/gallery3d/photoeditor/filters/DoodleFilter.java index 4b7b4c953..d9e904a94 100644 --- a/src/com/android/gallery3d/photoeditor/filters/DoodleFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/DoodleFilter.java @@ -23,7 +23,6 @@ import android.graphics.Paint; import android.graphics.Path; import android.graphics.RectF; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -64,7 +63,7 @@ public class DoodleFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { + public void process(Photo src, Photo dst) { Bitmap bitmap = Bitmap.createBitmap(src.width(), src.height(), Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap); @@ -81,7 +80,7 @@ public class DoodleFilter extends Filter { canvas.drawPath(drawingPath, paint); } - Effect effect = getEffect(context, EffectFactory.EFFECT_BITMAPOVERLAY); + Effect effect = getEffect(EffectFactory.EFFECT_BITMAPOVERLAY); effect.setParameter("bitmap", bitmap); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/DuotoneFilter.java b/src/com/android/gallery3d/photoeditor/filters/DuotoneFilter.java index 68db831ac..89e95b9c8 100644 --- a/src/com/android/gallery3d/photoeditor/filters/DuotoneFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/DuotoneFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -37,8 +36,8 @@ public class DuotoneFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_DUOTONE); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_DUOTONE); effect.setParameter("first_color", firstColor); effect.setParameter("second_color", secondColor); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); diff --git a/src/com/android/gallery3d/photoeditor/filters/FaceliftFilter.java b/src/com/android/gallery3d/photoeditor/filters/FaceliftFilter.java index 3bbbfa17f..3c7a7315d 100644 --- a/src/com/android/gallery3d/photoeditor/filters/FaceliftFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/FaceliftFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import com.android.gallery3d.photoeditor.Photo; @@ -39,9 +38,8 @@ public class FaceliftFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, - "com.google.android.media.effect.effects.FaceliftEffect"); + public void process(Photo src, Photo dst) { + Effect effect = getEffect("com.google.android.media.effect.effects.FaceliftEffect"); effect.setParameter("blend", scale); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/FillLightFilter.java b/src/com/android/gallery3d/photoeditor/filters/FillLightFilter.java index 29fab3cd8..2346953d7 100644 --- a/src/com/android/gallery3d/photoeditor/filters/FillLightFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/FillLightFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class FillLightFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_FILLLIGHT); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_FILLLIGHT); effect.setParameter("strength", backlight); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/Filter.java b/src/com/android/gallery3d/photoeditor/filters/Filter.java index c2d3fe5af..1fd1f7e73 100644 --- a/src/com/android/gallery3d/photoeditor/filters/Filter.java +++ b/src/com/android/gallery3d/photoeditor/filters/Filter.java @@ -21,31 +21,59 @@ import android.media.effect.EffectContext; import com.android.gallery3d.photoeditor.Photo; +import java.util.HashMap; + /** - * Image filter for photo editing. + * Image filter for photo editing; most of its methods must be called from a single GL thread except + * validate()/isValid() that are called from UI thread. */ public abstract class Filter { // TODO: This should be set in MFF instead. private static final int DEFAULT_TILE_SIZE = 640; + private static final HashMap<Filter, Effect> effects = new HashMap<Filter, Effect>(); + private static EffectContext context; + private boolean isValid; - private EffectContext context; - private Effect effect; - protected void validate() { - isValid = true; + public static void createContextWithCurrentGlContext() { + context = EffectContext.createWithCurrentGlContext(); + } + + public static void releaseContext() { + if (context != null) { + // Release all effects created with the releasing context. + for (Effect effect : effects.values()) { + effect.release(); + } + effects.clear(); + context.release(); + context = null; + } } - protected Effect getEffect(EffectContext context, String name) { - if (this.context != context) { + public void release() { + Effect effect = effects.remove(this); + if (effect != null) { + effect.release(); + } + } + + protected Effect getEffect(String name) { + Effect effect = effects.get(this); + if (effect == null) { effect = context.getFactory().createEffect(name); effect.setParameter("tile_size", DEFAULT_TILE_SIZE); - this.context = context; + effects.put(this, effect); } return effect; } + protected void validate() { + isValid = true; + } + /** * Some filters, e.g. lighting filters, are initially invalid until set up with parameters while * others, e.g. Sepia or Posterize filters, are initially valid without parameters. @@ -54,19 +82,11 @@ public abstract class Filter { return isValid; } - public void release() { - if (effect != null) { - effect.release(); - effect = null; - } - } - /** * Processes the source bitmap and matrix and output the destination bitmap and matrix. * - * @param context effect context bound to a GL context to create GL effect. * @param src source photo as the input. * @param dst destination photo having the same dimension as source photo as the output. */ - public abstract void process(EffectContext context, Photo src, Photo dst); + public abstract void process(Photo src, Photo dst); } diff --git a/src/com/android/gallery3d/photoeditor/filters/FisheyeFilter.java b/src/com/android/gallery3d/photoeditor/filters/FisheyeFilter.java index b1eb2d131..6bd406c1c 100644 --- a/src/com/android/gallery3d/photoeditor/filters/FisheyeFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/FisheyeFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class FisheyeFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_FISHEYE); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_FISHEYE); effect.setParameter("scale", scale); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/FlipFilter.java b/src/com/android/gallery3d/photoeditor/filters/FlipFilter.java index 184f590a3..7035912a5 100644 --- a/src/com/android/gallery3d/photoeditor/filters/FlipFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/FlipFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -37,8 +36,8 @@ public class FlipFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_FLIP); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_FLIP); effect.setParameter("horizontal", flipHorizontal); effect.setParameter("vertical", flipVertical); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); diff --git a/src/com/android/gallery3d/photoeditor/filters/GrainFilter.java b/src/com/android/gallery3d/photoeditor/filters/GrainFilter.java index 191cb4416..ddaad7a25 100644 --- a/src/com/android/gallery3d/photoeditor/filters/GrainFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/GrainFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class GrainFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_GRAIN); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_GRAIN); effect.setParameter("strength", scale); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/GrayscaleFilter.java b/src/com/android/gallery3d/photoeditor/filters/GrayscaleFilter.java index ce6cdef9c..d5ef8a0c0 100644 --- a/src/com/android/gallery3d/photoeditor/filters/GrayscaleFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/GrayscaleFilter.java @@ -16,7 +16,6 @@ package com.android.gallery3d.photoeditor.filters; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -31,8 +30,8 @@ public class GrayscaleFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - getEffect(context, EffectFactory.EFFECT_GRAYSCALE).apply( + public void process(Photo src, Photo dst) { + getEffect(EffectFactory.EFFECT_GRAYSCALE).apply( src.texture(), src.width(), src.height(), dst.texture()); } } diff --git a/src/com/android/gallery3d/photoeditor/filters/HighlightFilter.java b/src/com/android/gallery3d/photoeditor/filters/HighlightFilter.java index 3169d043f..dfaaa6580 100644 --- a/src/com/android/gallery3d/photoeditor/filters/HighlightFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/HighlightFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class HighlightFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_BLACKWHITE); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_BLACKWHITE); effect.setParameter("black", 0f); effect.setParameter("white", white); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); diff --git a/src/com/android/gallery3d/photoeditor/filters/LomoishFilter.java b/src/com/android/gallery3d/photoeditor/filters/LomoishFilter.java index 95ff62740..140f2d6f6 100644 --- a/src/com/android/gallery3d/photoeditor/filters/LomoishFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/LomoishFilter.java @@ -16,7 +16,6 @@ package com.android.gallery3d.photoeditor.filters; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -31,8 +30,8 @@ public class LomoishFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - getEffect(context, EffectFactory.EFFECT_LOMOISH).apply( + public void process(Photo src, Photo dst) { + getEffect(EffectFactory.EFFECT_LOMOISH).apply( src.texture(), src.width(), src.height(), dst.texture()); } } diff --git a/src/com/android/gallery3d/photoeditor/filters/NegativeFilter.java b/src/com/android/gallery3d/photoeditor/filters/NegativeFilter.java index 0b3837f34..94bf87e95 100644 --- a/src/com/android/gallery3d/photoeditor/filters/NegativeFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/NegativeFilter.java @@ -16,7 +16,6 @@ package com.android.gallery3d.photoeditor.filters; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -31,8 +30,8 @@ public class NegativeFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - getEffect(context, EffectFactory.EFFECT_NEGATIVE).apply( + public void process(Photo src, Photo dst) { + getEffect(EffectFactory.EFFECT_NEGATIVE).apply( src.texture(), src.width(), src.height(), dst.texture()); } } diff --git a/src/com/android/gallery3d/photoeditor/filters/PosterizeFilter.java b/src/com/android/gallery3d/photoeditor/filters/PosterizeFilter.java index 51202dcc1..96f598563 100644 --- a/src/com/android/gallery3d/photoeditor/filters/PosterizeFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/PosterizeFilter.java @@ -16,7 +16,6 @@ package com.android.gallery3d.photoeditor.filters; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -31,8 +30,8 @@ public class PosterizeFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - getEffect(context, EffectFactory.EFFECT_POSTERIZE).apply( + public void process(Photo src, Photo dst) { + getEffect(EffectFactory.EFFECT_POSTERIZE).apply( src.texture(), src.width(), src.height(), dst.texture()); } } diff --git a/src/com/android/gallery3d/photoeditor/filters/RedEyeFilter.java b/src/com/android/gallery3d/photoeditor/filters/RedEyeFilter.java index 559819d9c..b49915427 100644 --- a/src/com/android/gallery3d/photoeditor/filters/RedEyeFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/RedEyeFilter.java @@ -18,7 +18,6 @@ package com.android.gallery3d.photoeditor.filters; import android.graphics.PointF; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -41,8 +40,8 @@ public class RedEyeFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_REDEYE); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_REDEYE); float[] centers = new float[redeyes.size() * 2]; int i = 0; for (PointF eye : redeyes) { diff --git a/src/com/android/gallery3d/photoeditor/filters/RotateFilter.java b/src/com/android/gallery3d/photoeditor/filters/RotateFilter.java index 17f99fdab..548cc592b 100644 --- a/src/com/android/gallery3d/photoeditor/filters/RotateFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/RotateFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -35,11 +34,11 @@ public class RotateFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { + public void process(Photo src, Photo dst) { if (degrees % 180 != 0) { dst.changeDimension(src.height(), src.width()); } - Effect effect = getEffect(context, EffectFactory.EFFECT_ROTATE); + Effect effect = getEffect(EffectFactory.EFFECT_ROTATE); effect.setParameter("angle", (int) degrees); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/SaturationFilter.java b/src/com/android/gallery3d/photoeditor/filters/SaturationFilter.java index d3b5f704f..b2c7ccedc 100644 --- a/src/com/android/gallery3d/photoeditor/filters/SaturationFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/SaturationFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class SaturationFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_SATURATE); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_SATURATE); effect.setParameter("scale", scale); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/SepiaFilter.java b/src/com/android/gallery3d/photoeditor/filters/SepiaFilter.java index 3fdda15f8..170b95d88 100644 --- a/src/com/android/gallery3d/photoeditor/filters/SepiaFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/SepiaFilter.java @@ -16,7 +16,6 @@ package com.android.gallery3d.photoeditor.filters; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -31,8 +30,8 @@ public class SepiaFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - getEffect(context, EffectFactory.EFFECT_SEPIA).apply( + public void process(Photo src, Photo dst) { + getEffect(EffectFactory.EFFECT_SEPIA).apply( src.texture(), src.width(), src.height(), dst.texture()); } } diff --git a/src/com/android/gallery3d/photoeditor/filters/ShadowFilter.java b/src/com/android/gallery3d/photoeditor/filters/ShadowFilter.java index b23ef1c67..793187473 100644 --- a/src/com/android/gallery3d/photoeditor/filters/ShadowFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/ShadowFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class ShadowFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_BLACKWHITE); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_BLACKWHITE); effect.setParameter("black", black); effect.setParameter("white", 1f); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); diff --git a/src/com/android/gallery3d/photoeditor/filters/SharpenFilter.java b/src/com/android/gallery3d/photoeditor/filters/SharpenFilter.java index a8097126f..e6f7cd59a 100644 --- a/src/com/android/gallery3d/photoeditor/filters/SharpenFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/SharpenFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class SharpenFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_SHARPEN); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_SHARPEN); effect.setParameter("scale", scale); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/StraightenFilter.java b/src/com/android/gallery3d/photoeditor/filters/StraightenFilter.java index ffeb445a9..30a8ac58f 100644 --- a/src/com/android/gallery3d/photoeditor/filters/StraightenFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/StraightenFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -37,8 +36,8 @@ public class StraightenFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_STRAIGHTEN); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_STRAIGHTEN); effect.setParameter("maxAngle", MAX_DEGREES); effect.setParameter("angle", angle); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); diff --git a/src/com/android/gallery3d/photoeditor/filters/TintFilter.java b/src/com/android/gallery3d/photoeditor/filters/TintFilter.java index bbaf9c787..e5e467bc0 100644 --- a/src/com/android/gallery3d/photoeditor/filters/TintFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/TintFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -35,8 +34,8 @@ public class TintFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_TINT); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_TINT); effect.setParameter("tint", tint); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } diff --git a/src/com/android/gallery3d/photoeditor/filters/VignetteFilter.java b/src/com/android/gallery3d/photoeditor/filters/VignetteFilter.java index 2c1597245..ec393938f 100644 --- a/src/com/android/gallery3d/photoeditor/filters/VignetteFilter.java +++ b/src/com/android/gallery3d/photoeditor/filters/VignetteFilter.java @@ -17,7 +17,6 @@ package com.android.gallery3d.photoeditor.filters; import android.media.effect.Effect; -import android.media.effect.EffectContext; import android.media.effect.EffectFactory; import com.android.gallery3d.photoeditor.Photo; @@ -40,8 +39,8 @@ public class VignetteFilter extends Filter { } @Override - public void process(EffectContext context, Photo src, Photo dst) { - Effect effect = getEffect(context, EffectFactory.EFFECT_VIGNETTE); + public void process(Photo src, Photo dst) { + Effect effect = getEffect(EffectFactory.EFFECT_VIGNETTE); effect.setParameter("scale", scale); effect.apply(src.texture(), src.width(), src.height(), dst.texture()); } |