diff options
author | Chris Craik <ccraik@google.com> | 2014-09-12 05:46:30 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-12 05:46:30 +0000 |
commit | 3c813371be98b191cd2a7095be46932d6362f9ab (patch) | |
tree | db414626faa23b82edcd376e8114ddf45fe94e56 /graphics/java | |
parent | 4626fdbbaf6a1d527f63e811c81bcbe042c2f9fd (diff) | |
parent | fa3aeac2d5f221f5079439410448a2acd5d1e422 (diff) | |
download | frameworks_base-3c813371be98b191cd2a7095be46932d6362f9ab.zip frameworks_base-3c813371be98b191cd2a7095be46932d6362f9ab.tar.gz frameworks_base-3c813371be98b191cd2a7095be46932d6362f9ab.tar.bz2 |
am d6ec00a6: am f1101afa: Merge "Fix null rect parameter for saveLayer / saveLayerAlpha" into lmp-dev
* commit 'd6ec00a609c31d40493bfa15314763ec8937f09d':
Fix null rect parameter for saveLayer / saveLayerAlpha
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/graphics/Canvas.java | 26 |
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); } |