Skip to content

Commit

Permalink
Release 0.0.12
Browse files Browse the repository at this point in the history
  • Loading branch information
Utyff committed Dec 28, 2015
1 parent 1b8c2cd commit 48eb05d
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions app/src/main/java/com/utyf/pmetro/util/TouchView.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public TouchView(Context context) {
}

@Override
protected void onSizeChanged (int w, int h, int oldw, int oldh) {
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
DrawCache cc[] = cache;
cache = null;

Expand Down Expand Up @@ -127,7 +127,7 @@ void drawThread() {
if( drawBMP ==0 ) n=1;
else n=0;

drawBMP(n);
drawBMP(cache[n]);

synchronized (this) { drawBMP = n; }
postInvalidate();
Expand Down Expand Up @@ -262,8 +262,10 @@ protected void onDraw(Canvas c) {
}
newState=null;
}
cache[0].bmp.eraseColor(Color.WHITE);
cache[1].bmp.eraseColor(Color.WHITE);
if( cache != null ) {
cache[0].bmp.eraseColor(Color.WHITE);
cache[1].bmp.eraseColor(Color.WHITE);
}
startDraw = true;
}

Expand All @@ -288,14 +290,14 @@ protected void onDraw(Canvas c) {
//Log.i("TouchView /256", "Scale = "+bmpScale[drawBMP] + " BMP = "+cacheBMP[drawBMP] );
}

void drawBMP(int n) {
void drawBMP(DrawCache drawCache) {

cache[n].shift.x = shift.x;
cache[n].shift.y = shift.y;
cache[n].scale = Scale;
drawCache.shift.x = shift.x;
drawCache.shift.y = shift.y;
drawCache.scale = Scale;

cache[n].bmp.eraseColor(Color.WHITE);
Canvas canvas = new Canvas(cache[n].bmp);
drawCache.bmp.eraseColor(Color.WHITE);
Canvas canvas = new Canvas(drawCache.bmp);
canvas.translate(shift.x+shiftCache.x, shift.y+shiftCache.y); // Math.round
canvas.scale(Scale, Scale);

Expand Down

0 comments on commit 48eb05d

Please sign in to comment.