Skip to content

Commit

Permalink
clear canvas only once
Browse files Browse the repository at this point in the history
  • Loading branch information
quentin23soleil committed Oct 23, 2015
1 parent 9d2a99b commit 33e1e25
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions app/src/main/java/com/refugeye/DrawingView.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class DrawingView extends View {

public Path drawPath;
private Paint canvasPaint;
private Bitmap canvasBitmap;
private Bitmap canvasBitmap = null;
public Paint drawPaint;
public Canvas drawCanvas;

Expand Down Expand Up @@ -58,10 +58,12 @@ public void setupDrawing() {
@Override
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
super.onSizeChanged(w, h, oldw, oldh);
canvasBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
drawCanvas = new Canvas(canvasBitmap);
drawCanvas.drawColor(Color.WHITE);
invalidate();
if (canvasBitmap == null) {
canvasBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
drawCanvas = new Canvas(canvasBitmap);
drawCanvas.drawColor(Color.WHITE);
invalidate();
}
}

@Override
Expand Down

0 comments on commit 33e1e25

Please sign in to comment.