From: nicolasroard Date: Thu, 21 Feb 2013 23:52:49 +0000 (-0800) Subject: Pinch to zoom refine X-Git-Tag: android-x86-6.0-r3~2042^2~240 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=841196959e1a2906ca1141dda8ae4bc21496e3d8;p=android-x86%2Fpackages-apps-Camera2.git Pinch to zoom refine Change-Id: I538defa55a4ed898dd7c936ec813f052ac1b9e0a --- diff --git a/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java index 6c831708e..3511c67af 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java @@ -19,6 +19,7 @@ public class FilterCurvesRepresentation extends FilterRepresentation { setShowEditingControls(false); setShowParameterValue(false); setShowUtilityPanel(true); + setSupportsPartialRendering(true); for (int i = 0; i < mSplines.length; i++) { mSplines[i] = new Spline(); mSplines[i].reset(); diff --git a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java index 859bf327c..d4128dc79 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java @@ -37,6 +37,7 @@ public class FilterFxRepresentation extends FilterRepresentation { setShowEditingControls(false); setShowParameterValue(false); setShowUtilityPanel(false); + setSupportsPartialRendering(true); } public String toString() { diff --git a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java index 513cdcdef..83f2a1b87 100644 --- a/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java +++ b/src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java @@ -25,6 +25,7 @@ public class FilterRepresentation implements Cloneable { private String mName; private int mPriority = TYPE_NORMAL; private Class mFilterClass; + private boolean mSupportsPartialRendering = false; private int mTextId = 0; private int mEditorId = BasicEditor.ID; private int mButtonId = 0; @@ -52,6 +53,7 @@ public class FilterRepresentation implements Cloneable { representation.setName(getName()); representation.setPriority(getPriority()); representation.setFilterClass(getFilterClass()); + representation.setSupportsPartialRendering(supportsPartialRendering()); representation.setTextId(getTextId()); representation.setEditorId(getEditorId()); representation.setButtonId(getButtonId()); @@ -70,6 +72,7 @@ public class FilterRepresentation implements Cloneable { if (representation.mFilterClass == representation.mFilterClass && representation.mName.equalsIgnoreCase(mName) && representation.mPriority == mPriority + && representation.mSupportsPartialRendering == mSupportsPartialRendering && representation.mTextId == mTextId && representation.mEditorId == mEditorId && representation.mButtonId == mButtonId @@ -106,6 +109,14 @@ public class FilterRepresentation implements Cloneable { return false; } + public boolean supportsPartialRendering() { + return mSupportsPartialRendering; + } + + public void setSupportsPartialRendering(boolean value) { + mSupportsPartialRendering = value; + } + public void useParametersFrom(FilterRepresentation a) { } diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java index 84266c55d..ae5a03414 100644 --- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java @@ -17,6 +17,7 @@ package com.android.gallery3d.filtershow.presets; import android.graphics.Bitmap; +import android.graphics.Rect; import android.util.Log; import com.android.gallery3d.filtershow.ImageStateAdapter; @@ -52,6 +53,8 @@ public class ImagePreset { private boolean mDoApplyFilters = true; public final GeometryMetadata mGeoData = new GeometryMetadata(); + private boolean mPartialRendering = false; + private Rect mPartialRenderingBounds; public ImagePreset() { setup(); @@ -421,6 +424,22 @@ public class ImagePreset { return bitmap; } + public boolean canDoPartialRendering() { + if (mGeoData.hasModifications()) { + return false; + } + for (int i = 0; i < mFilters.size(); i++) { + FilterRepresentation representation = null; + synchronized (mFilters) { + representation = mFilters.elementAt(i); + } + if (!representation.supportsPartialRendering()) { + return false; + } + } + return true; + } + public void fillImageStateAdapter(ImageStateAdapter imageStateAdapter) { if (imageStateAdapter == null) { return; @@ -446,4 +465,17 @@ public class ImagePreset { public void setScaleFactor(float value) { mScaleFactor = value; } + + public void setPartialRendering(boolean partialRendering, Rect bounds) { + mPartialRendering = partialRendering; + mPartialRenderingBounds = bounds; + } + + public boolean isPartialRendering() { + return mPartialRendering; + } + + public Rect getPartialRenderingBounds() { + return mPartialRenderingBounds; + } }