redraw canvas before leaving surfaceChanged()

pull/6/head
Ahmet Inan 2014-12-16 16:32:41 +01:00
rodzic a2601017cb
commit 801852e73b
1 zmienionych plików z 16 dodań i 10 usunięć

Wyświetl plik

@ -80,16 +80,7 @@ public class ImageView extends SurfaceView implements SurfaceHolder.Callback {
synchronized (this) {
if (quitThread)
return;
if (!cantTouchThis && !takeABreak) {
Canvas canvas = null;
try {
canvas = holder.lockCanvas(null);
drawBitmap(canvas);
} finally {
if (canvas != null)
holder.unlockCanvasAndPost(canvas);
}
}
drawCanvas();
}
decode();
}
@ -232,6 +223,7 @@ public class ImageView extends SurfaceView implements SurfaceHolder.Callback {
synchronized (thread) {
canvasWidth = width;
canvasHeight = height;
drawCanvas();
}
}
public void surfaceCreated(SurfaceHolder holder) {
@ -244,6 +236,20 @@ public class ImageView extends SurfaceView implements SurfaceHolder.Callback {
cantTouchThis = true;
}
}
void drawCanvas() {
if (!cantTouchThis && !takeABreak) {
Canvas canvas = null;
try {
canvas = holder.lockCanvas(null);
drawBitmap(canvas);
} finally {
if (canvas != null)
holder.unlockCanvasAndPost(canvas);
}
}
}
void drawBitmap(Canvas canvas) {
float sx, sy, px, py;
if (imageWidth * canvasHeight < canvasWidth * bitmap.getHeight()) {