summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2014-09-12 05:04:40 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-09-12 05:04:40 +0000
commitfa3aeac2d5f221f5079439410448a2acd5d1e422 (patch)
tree02a98b6cec5929bb9e02dd248feecbf2ff700d40 /graphics
parent733e73c3ce4fc1f9bb74a2ca41a3897b3ef3c9b5 (diff)
parent81fba70972348fc08165578156674538422912d5 (diff)
downloadframeworks_base-fa3aeac2d5f221f5079439410448a2acd5d1e422.zip
frameworks_base-fa3aeac2d5f221f5079439410448a2acd5d1e422.tar.gz
frameworks_base-fa3aeac2d5f221f5079439410448a2acd5d1e422.tar.bz2
am f1101afa: Merge "Fix null rect parameter for saveLayer / saveLayerAlpha" into lmp-dev
* commit 'f1101afa1e1b0527df5fa2852f237d0bdd81c61a': Fix null rect parameter for saveLayer / saveLayerAlpha
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/Canvas.java26
1 files changed, 11 insertions, 15 deletions
diff --git a/graphics/java/android/graphics/Canvas.java b/graphics/java/android/graphics/Canvas.java
index 0927ffd..f45c0cb 100644
--- a/graphics/java/android/graphics/Canvas.java
+++ b/graphics/java/android/graphics/Canvas.java
@@ -250,11 +250,6 @@ public class Canvas {
public void insertInorderBarrier() {}
/**
- * @hide
- */
- public void initializeLight(float lightX, float lightY, float lightZ, float lightRadius) {}
-
- /**
* Return true if the device that the current layer draws into is opaque
* (i.e. does not support per-pixel alpha).
*
@@ -416,10 +411,10 @@ public class Canvas {
* @return value to pass to restoreToCount() to balance this save()
*/
public int saveLayer(@Nullable RectF bounds, @Nullable Paint paint, @Saveflags int saveFlags) {
- return native_saveLayer(mNativeCanvasWrapper,
- bounds.left, bounds.top, bounds.right, bounds.bottom,
- paint != null ? paint.mNativePaint : 0,
- saveFlags);
+ if (bounds == null) {
+ bounds = new RectF(getClipBounds());
+ }
+ return saveLayer(bounds.left, bounds.top, bounds.right, bounds.bottom, paint, saveFlags);
}
/**
@@ -462,17 +457,17 @@ public class Canvas {
* @param saveFlags see _SAVE_FLAG constants
* @return value to pass to restoreToCount() to balance this call
*/
- public int saveLayerAlpha(@NonNull RectF bounds, int alpha, @Saveflags int saveFlags) {
- alpha = Math.min(255, Math.max(0, alpha));
- return native_saveLayerAlpha(mNativeCanvasWrapper,
- bounds.left, bounds.top, bounds.right, bounds.bottom,
- alpha, saveFlags);
+ public int saveLayerAlpha(@Nullable RectF bounds, int alpha, @Saveflags int saveFlags) {
+ if (bounds == null) {
+ bounds = new RectF(getClipBounds());
+ }
+ return saveLayerAlpha(bounds.left, bounds.top, bounds.right, bounds.bottom, alpha, saveFlags);
}
/**
* Convenience for saveLayerAlpha(bounds, alpha, {@link #ALL_SAVE_FLAG})
*/
- public int saveLayerAlpha(@NonNull RectF bounds, int alpha) {
+ public int saveLayerAlpha(@Nullable RectF bounds, int alpha) {
return saveLayerAlpha(bounds, alpha, ALL_SAVE_FLAG);
}
@@ -481,6 +476,7 @@ public class Canvas {
*/
public int saveLayerAlpha(float left, float top, float right, float bottom, int alpha,
@Saveflags int saveFlags) {
+ alpha = Math.min(255, Math.max(0, alpha));
return native_saveLayerAlpha(mNativeCanvasWrapper, left, top, right, bottom,
alpha, saveFlags);
}