File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -104,6 +104,12 @@ public class PGraphicsAndroid2D extends PGraphics {
104104 Paint tintPaint ;
105105
106106
107+ /**
108+ * Marks when changes to the size have occurred, so that the backing bitmap
109+ * can be recreated.
110+ */
111+ protected boolean sized ;
112+
107113 //////////////////////////////////////////////////////////////
108114
109115 // INTERNAL
@@ -135,6 +141,12 @@ public PGraphicsAndroid2D() {
135141 //public void setPath(String path)
136142
137143
144+ @ Override
145+ public void setSize (int iwidth , int iheight ) {
146+ super .setSize (iwidth , iheight );
147+ sized = true ;
148+ }
149+
138150
139151 @ Override
140152 public void dispose () {
@@ -165,15 +177,16 @@ public void requestDraw() {
165177
166178// @Override
167179// public void requestDraw() {
168- // parent.handleDraw();
180+ //parent.handleDraw();
169181// }
170182
171183
172184 protected Canvas checkCanvas () {
173- if (canvas == null && (useBitmap || !primaryGraphics )) {
185+ if (( canvas == null || sized ) && (useBitmap || !primaryGraphics )) {
174186 if (bitmap != null ) bitmap .recycle ();
175187 bitmap = Bitmap .createBitmap (width , height , Config .ARGB_8888 );
176188 canvas = new Canvas (bitmap );
189+ sized = false ;
177190 }
178191 return canvas ;
179192 }
You can’t perform that action at this time.
0 commit comments