Using java Syntax Highlighting
- private synchronized void doDraw(Canvas canvas, Paint paint) {
- Bitmap tmpBitmap;
- Matrix matr = new Matrix();
- matr.postScale(scaleFactor, scaleFactor);
- canvas.setMatrix(matr);
- for (int i = 0; i < 7; i++) {
- for (int j = 0; j < 7; j++) {
- if ((i > 1 && i < 5) && ((j > 1 && j < 5))) {
- tmpBitmap = pmap.getCell(i - 2, j - 2);
- if (tmpBitmap != null) {
- isNew = false;
- canvas.drawBitmap(tmpBitmap, (i - 2) * TILE_SIZE
- + pmap.getGlobalOffset().x, (j - 2) * TILE_SIZE
- + pmap.getGlobalOffset().y, paint);
- }
- } else {
- canvas.drawBitmap(CELL_BACKGROUND, (i - 2) * TILE_SIZE
- + pmap.getGlobalOffset().x, (j - 2) * TILE_SIZE
- + pmap.getGlobalOffset().y, paint);
- }
- }
- }
- canvas.restore();
- }
Parsed in 0.013 seconds, using GeSHi 1.0.8.4
scaleFactor is updated in thread(also its invalidates panel after each step)
scaleFactor changes from 1 to 2, but canvas scaled in 3 or 4!!!