diff options
author | nicolasroard <nicolasroard@google.com> | 2013-04-26 14:51:48 -0700 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-04-29 17:50:17 -0700 |
commit | ae1dbae668753a2765fccdd28a9b7359dc7ecb3f (patch) | |
tree | f0951886b2febd070a1c7d5a4390c31b2684c419 /src/com/android/gallery3d | |
parent | 1307043784aca5f1014f93898d58e1a7d14608bf (diff) | |
download | android_packages_apps_Snap-ae1dbae668753a2765fccdd28a9b7359dc7ecb3f.tar.gz android_packages_apps_Snap-ae1dbae668753a2765fccdd28a9b7359dc7ecb3f.tar.bz2 android_packages_apps_Snap-ae1dbae668753a2765fccdd28a9b7359dc7ecb3f.zip |
Modifications for simple edit
Change-Id: Ic200a4f1e843deb119d68f627d5b8adb201f0f7f
Diffstat (limited to 'src/com/android/gallery3d')
13 files changed, 120 insertions, 76 deletions
diff --git a/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java b/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java index 5603a2795..1ea40f202 100644 --- a/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java +++ b/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java @@ -29,8 +29,9 @@ import com.android.gallery3d.filtershow.imageshow.GeometryMetadata; import com.android.gallery3d.filtershow.imageshow.MasterImage; import com.android.gallery3d.filtershow.presets.FilterEnvironment; import com.android.gallery3d.filtershow.presets.ImagePreset; +import com.android.gallery3d.filtershow.presets.PipelineInterface; -public class CachingPipeline { +public class CachingPipeline implements PipelineInterface { private static final String LOGTAG = "CachingPipeline"; private boolean DEBUG = false; @@ -65,22 +66,10 @@ public class CachingPipeline { mName = name; } - public static synchronized Resources getResources() { - return sResources; - } - - public static synchronized void setResources(Resources resources) { - sResources = resources; - } - public static synchronized RenderScript getRenderScriptContext() { return sRS; } - public static synchronized void setRenderScriptContext(RenderScript RS) { - sRS = RS; - } - public static synchronized void createRenderscriptContext(Activity context) { if (sRS != null) { Log.w(LOGTAG, "A prior RS context exists when calling setRenderScriptContext"); @@ -128,6 +117,10 @@ public class CachingPipeline { } } + public Resources getResources() { + return sRS.getApplicationContext().getResources(); + } + private synchronized void destroyPixelAllocations() { if (DEBUG) { Log.v(LOGTAG, "destroyPixelAllocations in " + getName()); @@ -167,14 +160,14 @@ public class CachingPipeline { } private void setupEnvironment(ImagePreset preset, boolean highResPreview) { - mEnvironment.setCachingPipeline(this); + mEnvironment.setPipeline(this); mEnvironment.setFiltersManager(mFiltersManager); if (highResPreview) { mEnvironment.setScaleFactor(mHighResPreviewScaleFactor); } else { mEnvironment.setScaleFactor(mPreviewScaleFactor); } - mEnvironment.setQuality(ImagePreset.QUALITY_PREVIEW); + mEnvironment.setQuality(FilterEnvironment.QUALITY_PREVIEW); mEnvironment.setImagePreset(preset); mEnvironment.setStop(false); } @@ -293,11 +286,11 @@ public class CachingPipeline { || request.getType() == RenderingRequest.STYLE_ICON_RENDERING) { if (request.getType() == RenderingRequest.ICON_RENDERING) { - mEnvironment.setQuality(ImagePreset.QUALITY_ICON); + mEnvironment.setQuality(FilterEnvironment.QUALITY_ICON); } else if (request.getType() == RenderingRequest.STYLE_ICON_RENDERING) { mEnvironment.setQuality(ImagePreset.STYLE_ICON); } else { - mEnvironment.setQuality(ImagePreset.QUALITY_PREVIEW); + mEnvironment.setQuality(FilterEnvironment.QUALITY_PREVIEW); } Bitmap bmp = preset.apply(bitmap, mEnvironment); @@ -331,7 +324,7 @@ public class CachingPipeline { return bitmap; } setupEnvironment(preset, false); - mEnvironment.setQuality(ImagePreset.QUALITY_FINAL); + mEnvironment.setQuality(FilterEnvironment.QUALITY_FINAL); mEnvironment.setScaleFactor(1.0f); mFiltersManager.freeFilterResources(preset); bitmap = preset.applyGeometry(bitmap, mEnvironment); @@ -348,7 +341,7 @@ public class CachingPipeline { } mGeometry.useRepresentation(preset.getGeometry()); return mGeometry.apply(bitmap, mPreviewScaleFactor, - ImagePreset.QUALITY_PREVIEW); + FilterEnvironment.QUALITY_PREVIEW); } public synchronized void compute(TripleBufferBitmap buffer, ImagePreset preset, int type) { @@ -461,4 +454,7 @@ public class CachingPipeline { return mName; } + public RenderScript getRSContext() { + return CachingPipeline.getRenderScriptContext(); + } } diff --git a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java index fc2cb1340..1c7294c3a 100644 --- a/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java +++ b/src/com/android/gallery3d/filtershow/filters/BaseFiltersManager.java @@ -26,7 +26,7 @@ import com.android.gallery3d.filtershow.presets.ImagePreset; import java.util.HashMap; import java.util.Vector; -public abstract class BaseFiltersManager { +public abstract class BaseFiltersManager implements FiltersManagerInterface { protected HashMap<Class, ImageFilter> mFilters = null; protected HashMap<String, FilterRepresentation> mRepresentationLookup = null; private static final String LOGTAG = "BaseFiltersManager"; diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java index 66edf3169..37d66f829 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java @@ -16,7 +16,7 @@ package com.android.gallery3d.filtershow.filters; -import com.android.gallery3d.app.Log; +import android.util.Log; import com.android.gallery3d.filtershow.editors.BasicEditor; public class FilterRepresentation implements Cloneable { diff --git a/src/com/android/gallery3d/filtershow/filters/FiltersManagerInterface.java b/src/com/android/gallery3d/filtershow/filters/FiltersManagerInterface.java new file mode 100644 index 000000000..710128f99 --- /dev/null +++ b/src/com/android/gallery3d/filtershow/filters/FiltersManagerInterface.java @@ -0,0 +1,21 @@ +/* + * Copyright (C) 2013 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; + +public interface FiltersManagerInterface { + ImageFilter getFilterForRepresentation(FilterRepresentation representation); +} diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java index 96ab84f9d..b80fc7f15 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilter.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilter.java @@ -16,12 +16,12 @@ package com.android.gallery3d.filtershow.filters; +import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Matrix; import android.support.v8.renderscript.Allocation; import android.widget.Toast; -import com.android.gallery3d.filtershow.FilterShowActivity; import com.android.gallery3d.filtershow.imageshow.GeometryMetadata; import com.android.gallery3d.filtershow.presets.FilterEnvironment; import com.android.gallery3d.filtershow.presets.ImagePreset; @@ -35,9 +35,9 @@ public abstract class ImageFilter implements Cloneable { // TODO: Temporary, for dogfood note memory issues with toasts for better // feedback. Remove this when filters actually work in low memory // situations. - private static FilterShowActivity sActivity = null; + private static Activity sActivity = null; - public static void setActivityForMemoryToasts(FilterShowActivity activity) { + public static void setActivityForMemoryToasts(Activity activity) { sActivity = activity; } @@ -76,10 +76,6 @@ public abstract class ImageFilter implements Cloneable { return bitmap; } - public ImagePreset getImagePreset() { - return getEnvironment().getImagePreset(); - } - public abstract void useRepresentation(FilterRepresentation representation); native protected void nativeApplyGradientFilter(Bitmap bitmap, int w, int h, @@ -90,10 +86,11 @@ public abstract class ImageFilter implements Cloneable { } protected Matrix getOriginalToScreenMatrix(int w, int h) { - GeometryMetadata geo = getImagePreset().mGeoData; + ImagePreset preset = getEnvironment().getImagePreset(); + GeometryMetadata geo = getEnvironment().getImagePreset().mGeoData; Matrix originalToScreen = geo.getOriginalToScreen(true, - getImagePreset().getImageLoader().getOriginalBounds().width(), - getImagePreset().getImageLoader().getOriginalBounds().height(), + preset.getImageLoader().getOriginalBounds().width(), + preset.getImageLoader().getOriginalBounds().height(), w, h); return originalToScreen; } diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterDraw.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterDraw.java index 1fd9071f7..812ab02f0 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterDraw.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterDraw.java @@ -31,6 +31,7 @@ import android.graphics.PorterDuffColorFilter; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.filters.FilterDrawRepresentation.StrokeData; import com.android.gallery3d.filtershow.imageshow.MasterImage; +import com.android.gallery3d.filtershow.presets.FilterEnvironment; import com.android.gallery3d.filtershow.presets.ImagePreset; import java.util.Vector; @@ -204,7 +205,7 @@ public class ImageFilterDraw extends ImageFilter { public void drawData(Canvas canvas, Matrix originalRotateToScreen, int quality) { Paint paint = new Paint(); - if (quality == ImagePreset.QUALITY_FINAL) { + if (quality == FilterEnvironment.QUALITY_FINAL) { paint.setAntiAlias(true); } paint.setStyle(Style.STROKE); @@ -214,7 +215,7 @@ public class ImageFilterDraw extends ImageFilter { if (mParameters.getDrawing().isEmpty() && mParameters.getCurrentDrawing() == null) { return; } - if (quality == ImagePreset.QUALITY_FINAL) { + if (quality == FilterEnvironment.QUALITY_FINAL) { for (FilterDrawRepresentation.StrokeData strokeData : mParameters.getDrawing()) { paint(strokeData, canvas, originalRotateToScreen, quality); } @@ -248,17 +249,17 @@ public class ImageFilterDraw extends ImageFilter { int n = v.size(); for (int i = mCachedStrokes; i < n; i++) { - paint(v.get(i), drawCache, originalRotateToScreen, ImagePreset.QUALITY_PREVIEW); + paint(v.get(i), drawCache, originalRotateToScreen, FilterEnvironment.QUALITY_PREVIEW); } mCachedStrokes = n; } public void draw(Canvas canvas, Matrix originalRotateToScreen) { for (FilterDrawRepresentation.StrokeData strokeData : mParameters.getDrawing()) { - paint(strokeData, canvas, originalRotateToScreen, ImagePreset.QUALITY_PREVIEW); + paint(strokeData, canvas, originalRotateToScreen, FilterEnvironment.QUALITY_PREVIEW); } mDrawingsTypes[mCurrentStyle].paint( - null, canvas, originalRotateToScreen, ImagePreset.QUALITY_PREVIEW); + null, canvas, originalRotateToScreen, FilterEnvironment.QUALITY_PREVIEW); } @Override diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java index be494574a..806f30435 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java @@ -22,7 +22,7 @@ import android.support.v8.renderscript.*; import android.util.Log; import android.content.res.Resources; import com.android.gallery3d.R; -import com.android.gallery3d.filtershow.cache.CachingPipeline; +import com.android.gallery3d.filtershow.presets.PipelineInterface; public abstract class ImageFilterRS extends ImageFilter { private static final String LOGTAG = "ImageFilterRS"; @@ -52,16 +52,17 @@ public abstract class ImageFilterRS extends ImageFilter { } protected RenderScript getRenderScriptContext() { - return CachingPipeline.getRenderScriptContext(); + PipelineInterface pipeline = getEnvironment().getPipeline(); + return pipeline.getRSContext(); } protected Allocation getInPixelsAllocation() { - CachingPipeline pipeline = getEnvironment().getCachingPipeline(); + PipelineInterface pipeline = getEnvironment().getPipeline(); return pipeline.getInPixelsAllocation(); } protected Allocation getOutPixelsAllocation() { - CachingPipeline pipeline = getEnvironment().getCachingPipeline(); + PipelineInterface pipeline = getEnvironment().getPipeline(); return pipeline.getOutPixelsAllocation(); } @@ -80,7 +81,7 @@ public abstract class ImageFilterRS extends ImageFilter { long startFilter = 0; long endFilter = 0; if (!mResourcesLoaded) { - CachingPipeline pipeline = getEnvironment().getCachingPipeline(); + PipelineInterface pipeline = getEnvironment().getPipeline(); createFilter(pipeline.getResources(), getEnvironment().getScaleFactor(), getEnvironment().getQuality(), in); mResourcesLoaded = true; @@ -112,7 +113,7 @@ public abstract class ImageFilterRS extends ImageFilter { return bitmap; } try { - CachingPipeline pipeline = getEnvironment().getCachingPipeline(); + PipelineInterface pipeline = getEnvironment().getPipeline(); if (DEBUG) { Log.v(LOGTAG, "apply filter " + getName() + " in pipeline " + pipeline.getName()); } @@ -147,18 +148,16 @@ public abstract class ImageFilterRS extends ImageFilter { displayLowMemoryToast(); Log.e(LOGTAG, "not enough memory for filter " + getName(), e); } - return bitmap; } - protected static Allocation convertBitmap(Bitmap bitmap) { - return Allocation.createFromBitmap(CachingPipeline.getRenderScriptContext(), bitmap, + protected static Allocation convertBitmap(RenderScript RS, Bitmap bitmap) { + return Allocation.createFromBitmap(RS, bitmap, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT | Allocation.USAGE_GRAPHICS_TEXTURE); } - private static Allocation convertRGBAtoA(Bitmap bitmap) { - RenderScript RS = CachingPipeline.getRenderScriptContext(); + private static Allocation convertRGBAtoA(RenderScript RS, Bitmap bitmap) { if (RS != mRScache || mGreyConvert == null) { mGreyConvert = new ScriptC_grey(RS, RS.getApplicationContext().getResources(), R.raw.grey); @@ -167,7 +166,7 @@ public abstract class ImageFilterRS extends ImageFilter { Type.Builder tb_a8 = new Type.Builder(RS, Element.A_8(RS)); - Allocation bitmapTemp = convertBitmap(bitmap); + Allocation bitmapTemp = convertBitmap(RS, bitmap); if (bitmapTemp.getType().getElement().isCompatible(Element.A_8(RS))) { return bitmapTemp; } @@ -183,20 +182,20 @@ public abstract class ImageFilterRS extends ImageFilter { } public Allocation loadScaledResourceAlpha(int resource, int inSampleSize) { - Resources res = CachingPipeline.getResources(); + Resources res = getEnvironment().getPipeline().getResources(); final BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ALPHA_8; options.inSampleSize = inSampleSize; Bitmap bitmap = BitmapFactory.decodeResource( res, resource, options); - Allocation ret = convertRGBAtoA(bitmap); + Allocation ret = convertRGBAtoA(getRenderScriptContext(), bitmap); bitmap.recycle(); return ret; } public Allocation loadScaledResourceAlpha(int resource, int w, int h, int inSampleSize) { - Resources res = CachingPipeline.getResources(); + Resources res = getEnvironment().getPipeline().getResources(); final BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ALPHA_8; options.inSampleSize = inSampleSize; @@ -204,7 +203,7 @@ public abstract class ImageFilterRS extends ImageFilter { res, resource, options); Bitmap resizeBitmap = Bitmap.createScaledBitmap(bitmap, w, h, true); - Allocation ret = convertRGBAtoA(resizeBitmap); + Allocation ret = convertRGBAtoA(getRenderScriptContext(), resizeBitmap); resizeBitmap.recycle(); bitmap.recycle(); return ret; @@ -215,13 +214,13 @@ public abstract class ImageFilterRS extends ImageFilter { } public Allocation loadResource(int resource) { - Resources res = CachingPipeline.getResources(); + Resources res = getEnvironment().getPipeline().getResources(); final BitmapFactory.Options options = new BitmapFactory.Options(); options.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap bitmap = BitmapFactory.decodeResource( res, resource, options); - Allocation ret = convertBitmap(bitmap); + Allocation ret = convertBitmap(getRenderScriptContext(), bitmap); bitmap.recycle(); return ret; } @@ -242,7 +241,7 @@ public abstract class ImageFilterRS extends ImageFilter { /** * RS Script objects (and all other RS objects) should be cleared here */ - abstract protected void resetScripts(); + public abstract void resetScripts(); /** * Scripts values should be bound here diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java index 057c980f9..1dc2c0516 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterSharpen.java @@ -53,7 +53,7 @@ public class ImageFilterSharpen extends ImageFilterRS { } @Override - protected void resetScripts() { + public void resetScripts() { if (mScript != null) { mScript.destroy(); mScript = null; diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterTinyPlanet.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterTinyPlanet.java index 37d5739a0..f265c4dcc 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterTinyPlanet.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterTinyPlanet.java @@ -76,7 +76,7 @@ public class ImageFilterTinyPlanet extends SimpleImageFilter { int w = bitmapIn.getWidth(); int h = bitmapIn.getHeight(); int outputSize = (int) (w / 2f); - ImagePreset preset = getImagePreset(); + ImagePreset preset = getEnvironment().getImagePreset(); Bitmap mBitmapOut = null; if (preset != null) { XMPMeta xmp = preset.getImageLoader().getXmpObject(); diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java index e06f54493..cfe135033 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterVignette.java @@ -22,7 +22,7 @@ import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Rect; import com.android.gallery3d.R; -import com.android.gallery3d.filtershow.presets.ImagePreset; +import com.android.gallery3d.filtershow.presets.FilterEnvironment; public class ImageFilterVignette extends SimpleImageFilter { private static final String LOGTAG = "ImageFilterVignette"; @@ -57,9 +57,9 @@ public class ImageFilterVignette extends SimpleImageFilter { @Override public Bitmap apply(Bitmap bitmap, float scaleFactor, int quality) { - if (SIMPLE_ICONS && ImagePreset.QUALITY_ICON == quality) { + if (SIMPLE_ICONS && FilterEnvironment.QUALITY_ICON == quality) { if (mOverlayBitmap == null) { - Resources res = getEnvironment().getCachingPipeline().getResources(); + Resources res = getEnvironment().getPipeline().getResources(); mOverlayBitmap = IconUtilities.getFXBitmap(res, R.drawable.filtershow_icon_vignette); } diff --git a/src/com/android/gallery3d/filtershow/presets/FilterEnvironment.java b/src/com/android/gallery3d/filtershow/presets/FilterEnvironment.java index c454c1ab6..47f8dfccb 100644 --- a/src/com/android/gallery3d/filtershow/presets/FilterEnvironment.java +++ b/src/com/android/gallery3d/filtershow/presets/FilterEnvironment.java @@ -18,11 +18,9 @@ package com.android.gallery3d.filtershow.presets; import android.graphics.Bitmap; import android.support.v8.renderscript.Allocation; -import android.util.Log; -import com.android.gallery3d.filtershow.cache.CachingPipeline; import com.android.gallery3d.filtershow.filters.FilterRepresentation; -import com.android.gallery3d.filtershow.filters.FiltersManager; +import com.android.gallery3d.filtershow.filters.FiltersManagerInterface; import com.android.gallery3d.filtershow.filters.ImageFilter; import java.lang.ref.WeakReference; @@ -33,10 +31,14 @@ public class FilterEnvironment { private ImagePreset mImagePreset; private float mScaleFactor; private int mQuality; - private FiltersManager mFiltersManager; - private CachingPipeline mCachingPipeline; + private FiltersManagerInterface mFiltersManager; + private PipelineInterface mPipeline; private volatile boolean mStop = false; + public static final int QUALITY_ICON = 0; + public static final int QUALITY_PREVIEW = 1; + public static final int QUALITY_FINAL = 2; + public synchronized boolean needsStop() { return mStop; } @@ -98,11 +100,11 @@ public class FilterEnvironment { return mQuality; } - public void setFiltersManager(FiltersManager filtersManager) { + public void setFiltersManager(FiltersManagerInterface filtersManager) { mFiltersManager = filtersManager; } - public FiltersManager getFiltersManager() { + public FiltersManagerInterface getFiltersManager() { return mFiltersManager; } @@ -126,12 +128,12 @@ public class FilterEnvironment { return ret; } - public CachingPipeline getCachingPipeline() { - return mCachingPipeline; + public PipelineInterface getPipeline() { + return mPipeline; } - public void setCachingPipeline(CachingPipeline cachingPipeline) { - mCachingPipeline = cachingPipeline; + public void setPipeline(PipelineInterface cachingPipeline) { + mPipeline = cachingPipeline; } } diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java index 1b7a425e7..b594d9a02 100644 --- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java @@ -50,9 +50,6 @@ public class ImagePreset { private static final String LOGTAG = "ImagePreset"; private FilterRepresentation mBorder = null; - public static final int QUALITY_ICON = 0; - public static final int QUALITY_PREVIEW = 1; - public static final int QUALITY_FINAL = 2; public static final int STYLE_ICON = 3; public static final String PRESET_NAME = "PresetName"; @@ -472,7 +469,7 @@ public class ImagePreset { if (mBorder != null && mDoApplyGeometry) { mBorder.synchronizeRepresentation(); bitmap = environment.applyRepresentation(mBorder, bitmap); - if (environment.getQuality() == QUALITY_FINAL) { + if (environment.getQuality() == FilterEnvironment.QUALITY_FINAL) { UsageStatistics.onEvent(UsageStatistics.COMPONENT_EDITOR, "SaveBorder", mBorder.getName(), 1); } @@ -499,7 +496,7 @@ public class ImagePreset { representation.synchronizeRepresentation(); } bitmap = environment.applyRepresentation(representation, bitmap); - if (environment.getQuality() == QUALITY_FINAL) { + if (environment.getQuality() == FilterEnvironment.QUALITY_FINAL) { UsageStatistics.onEvent(UsageStatistics.COMPONENT_EDITOR, "SaveFilter", representation.getName(), 1); } diff --git a/src/com/android/gallery3d/filtershow/presets/PipelineInterface.java b/src/com/android/gallery3d/filtershow/presets/PipelineInterface.java new file mode 100644 index 000000000..05f0a1aa8 --- /dev/null +++ b/src/com/android/gallery3d/filtershow/presets/PipelineInterface.java @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2013 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 android.content.res.Resources; +import android.graphics.Bitmap; +import android.support.v8.renderscript.Allocation; +import android.support.v8.renderscript.RenderScript; + +public interface PipelineInterface { + public String getName(); + public Resources getResources(); + public Allocation getInPixelsAllocation(); + public Allocation getOutPixelsAllocation(); + public boolean prepareRenderscriptAllocations(Bitmap bitmap); + public RenderScript getRSContext(); +} |