summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-04-18 20:09:56 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-04-18 20:09:56 +0000
commit908a228070678e901ff1775fdd1219f882e2d9fe (patch)
treeae15f2a8b31a50cab13c6d1ee141243d95b4a866 /graphics
parent95b7eaadf3e7570049378b29e533966a5e0cb0d2 (diff)
parentc306ad61a791bae34ed83b339f27cb67a1d91b53 (diff)
downloadframeworks_base-908a228070678e901ff1775fdd1219f882e2d9fe.zip
frameworks_base-908a228070678e901ff1775fdd1219f882e2d9fe.tar.gz
frameworks_base-908a228070678e901ff1775fdd1219f882e2d9fe.tar.bz2
Merge "Add convenience methods to encourage usage of ALL_SAVE_FLAG"
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/Canvas.java51
1 files changed, 34 insertions, 17 deletions
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 1252ee2..f80ce28 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -168,21 +168,10 @@ public class Canvas {
}
/**
- * Gets the native canvas pointer.
- *
- * @return The native pointer.
- *
- * @hide
- */
- public long getNativeCanvas() {
- return mNativeCanvas;
- }
-
- /**
* Returns null.
- *
+ *
* @deprecated This method is not supported and should not be invoked.
- *
+ *
* @hide
*/
@Deprecated
@@ -233,14 +222,14 @@ public class Canvas {
mBitmap = bitmap;
}
-
+
/**
* Set the viewport dimensions if this canvas is GL based. If it is not,
* this method is ignored and no exception is thrown.
*
* @param width The width of the viewport
* @param height The height of the viewport
- *
+ *
* @hide
*/
public void setViewport(int width, int height) {
@@ -389,7 +378,14 @@ public class Canvas {
paint != null ? paint.mNativePaint : 0,
saveFlags);
}
-
+
+ /**
+ * Convenience for saveLayer(bounds, paint, {@link #ALL_SAVE_FLAG})
+ */
+ public int saveLayer(RectF bounds, Paint paint) {
+ return saveLayer(bounds, paint, ALL_SAVE_FLAG);
+ }
+
/**
* Helper version of saveLayer() that takes 4 values rather than a RectF.
*/
@@ -401,6 +397,13 @@ public class Canvas {
}
/**
+ * Convenience for saveLayer(left, top, right, bottom, paint, {@link #ALL_SAVE_FLAG})
+ */
+ public int saveLayer(float left, float top, float right, float bottom, Paint paint) {
+ return saveLayer(left, top, right, bottom, paint, ALL_SAVE_FLAG);
+ }
+
+ /**
* This behaves the same as save(), but in addition it allocates an
* offscreen bitmap. All drawing calls are directed there, and only when
* the balancing call to restore() is made is that offscreen transfered to
@@ -420,7 +423,14 @@ public class Canvas {
alpha = Math.min(255, Math.max(0, alpha));
return native_saveLayerAlpha(mNativeCanvas, bounds, alpha, saveFlags);
}
-
+
+ /**
+ * Convenience for saveLayerAlpha(bounds, alpha, {@link #ALL_SAVE_FLAG})
+ */
+ public int saveLayerAlpha(RectF bounds, int alpha) {
+ return saveLayerAlpha(bounds, alpha, ALL_SAVE_FLAG);
+ }
+
/**
* Helper for saveLayerAlpha() that takes 4 values instead of a RectF.
*/
@@ -431,6 +441,13 @@ public class Canvas {
}
/**
+ * Helper for saveLayerAlpha(left, top, right, bottom, alpha, {@link #ALL_SAVE_FLAG})
+ */
+ public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha) {
+ return saveLayerAlpha(left, top, right, bottom, alpha, ALL_SAVE_FLAG);
+ }
+
+ /**
* This call balances a previous call to save(), and is used to remove all
* modifications to the matrix/clip state since the last save call. It is
* an error to call restore() more times than save() was called.