summaryrefslogtreecommitdiffstats
path: root/rs
diff options
context:
space:
mode:
authorChris Craik <ccraik@google.com>2015-06-01 10:39:36 -0700
committerChris Craik <ccraik@google.com>2015-06-01 10:59:35 -0700
commit5c705d63d76eb29f55f3fb97d616baf664fbc162 (patch)
tree6c7ae26655498362a2a8dab88fa6aa42f5282ac4 /rs
parent85b883cae410bd2b8e1dc5c34265ed253d758e86 (diff)
downloadframeworks_base-5c705d63d76eb29f55f3fb97d616baf664fbc162.zip
frameworks_base-5c705d63d76eb29f55f3fb97d616baf664fbc162.tar.gz
frameworks_base-5c705d63d76eb29f55f3fb97d616baf664fbc162.tar.bz2
Fix RenderScript copy tracing sections
bug:21560057 Change-Id: I3b44d04bd908d9549ef7ada5f48f5d94e239d186
Diffstat (limited to 'rs')
-rw-r--r--rs/java/android/renderscript/Allocation.java28
1 files changed, 16 insertions, 12 deletions
diff --git a/rs/java/android/renderscript/Allocation.java b/rs/java/android/renderscript/Allocation.java
index 70a5821..bea138e 100644
--- a/rs/java/android/renderscript/Allocation.java
+++ b/rs/java/android/renderscript/Allocation.java
@@ -1052,6 +1052,7 @@ public class Allocation extends BaseObj {
mSelectedLOD, mSelectedFace.mID,
count, 1, data.getID(mRS), dataOff, 0,
data.mSelectedLOD, data.mSelectedFace.mID);
+ Trace.traceEnd(RenderScript.TRACE_TAG);
}
private void validate2DRange(int xoff, int yoff, int w, int h) {
@@ -1213,19 +1214,22 @@ public class Allocation extends BaseObj {
* @param data the Bitmap to be copied
*/
public void copy2DRangeFrom(int xoff, int yoff, Bitmap data) {
- Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom");
- mRS.validate();
- if (data.getConfig() == null) {
- Bitmap newBitmap = Bitmap.createBitmap(data.getWidth(), data.getHeight(), Bitmap.Config.ARGB_8888);
- Canvas c = new Canvas(newBitmap);
- c.drawBitmap(data, 0, 0, null);
- copy2DRangeFrom(xoff, yoff, newBitmap);
- return;
+ try {
+ Trace.traceBegin(RenderScript.TRACE_TAG, "copy2DRangeFrom");
+ mRS.validate();
+ if (data.getConfig() == null) {
+ Bitmap newBitmap = Bitmap.createBitmap(data.getWidth(), data.getHeight(), Bitmap.Config.ARGB_8888);
+ Canvas c = new Canvas(newBitmap);
+ c.drawBitmap(data, 0, 0, null);
+ copy2DRangeFrom(xoff, yoff, newBitmap);
+ return;
+ }
+ validateBitmapFormat(data);
+ validate2DRange(xoff, yoff, data.getWidth(), data.getHeight());
+ mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, data);
+ } finally {
+ Trace.traceEnd(RenderScript.TRACE_TAG);
}
- validateBitmapFormat(data);
- validate2DRange(xoff, yoff, data.getWidth(), data.getHeight());
- mRS.nAllocationData2D(getIDSafe(), xoff, yoff, mSelectedLOD, mSelectedFace.mID, data);
- Trace.traceEnd(RenderScript.TRACE_TAG);
}
private void validate3DRange(int xoff, int yoff, int zoff, int w, int h, int d) {