summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-02-21 15:52:49 -0800
committernicolasroard <nicolasroard@google.com>2013-02-21 17:43:58 -0800
commit841196959e1a2906ca1141dda8ae4bc21496e3d8 (patch)
treee5966aff34eff17adef29e86be665038daa1a5d7
parent304e05b54abfa5e3ba4c366ce6bffae78b5133fd (diff)
downloadandroid_packages_apps_Snap-841196959e1a2906ca1141dda8ae4bc21496e3d8.tar.gz
android_packages_apps_Snap-841196959e1a2906ca1141dda8ae4bc21496e3d8.tar.bz2
android_packages_apps_Snap-841196959e1a2906ca1141dda8ae4bc21496e3d8.zip
Pinch to zoom refine
Change-Id: I538defa55a4ed898dd7c936ec813f052ac1b9e0a
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterCurvesRepresentation.java1
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterFxRepresentation.java1
-rw-r--r--src/com/android/gallery3d/filtershow/filters/FilterRepresentation.java11
-rw-r--r--src/com/android/gallery3d/filtershow/presets/ImagePreset.java32
4 files changed, 45 insertions, 0 deletions
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;
+ }
}