diff --git a/android/core/src/processing/core/PGraphicsAndroid2D.java b/android/core/src/processing/core/PGraphicsAndroid2D.java index e5593602e..9ac42d2f3 100644 --- a/android/core/src/processing/core/PGraphicsAndroid2D.java +++ b/android/core/src/processing/core/PGraphicsAndroid2D.java @@ -913,8 +913,7 @@ public class PGraphicsAndroid2D extends PGraphics { who.format == ARGB, tint ? tintPaint : null); } else { // rect.set(x1, y1, x2, y2); - if (who.bitmap == null || - who.width != who.bitmap.getWidth() || + if (who.width != who.bitmap.getWidth() || who.height != who.bitmap.getHeight()) { // System.out.println("creating bitmap " + who.format + " " + // who.width + "x" + who.height); @@ -925,6 +924,10 @@ public class PGraphicsAndroid2D extends PGraphics { who.modified = true; } if (who.modified) { + //System.out.println("mutable, recycled = " + who.bitmap.isMutable() + ", " + who.bitmap.isRecycled()); + if (!who.bitmap.isMutable()) { + who.bitmap = Bitmap.createBitmap(who.width, who.height, Config.ARGB_8888); + } who.bitmap.setPixels(who.pixels, 0, who.width, 0, 0, who.width, who.height); who.modified = false; } diff --git a/android/core/src/processing/core/PImage.java b/android/core/src/processing/core/PImage.java index 32c411942..e9c8395be 100644 --- a/android/core/src/processing/core/PImage.java +++ b/android/core/src/processing/core/PImage.java @@ -3,7 +3,7 @@ /* Part of the Processing project - http://processing.org - Copyright (c) 2004-08 Ben Fry and Casey Reas + Copyright (c) 2004-10 Ben Fry and Casey Reas Copyright (c) 2001-04 Massachusetts Institute of Technology This library is free software; you can redistribute it and/or @@ -605,6 +605,7 @@ public class PImage implements PConstants, Cloneable { * Set alpha channel for an image using another image as the source. */ public void mask(PImage alpha) { + alpha.loadPixels(); mask(alpha.pixels); }