/[aagtl_public1]/src/com/zoffcc/applications/aagtl/Rose.java
aagtl

Diff of /src/com/zoffcc/applications/aagtl/Rose.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 3 Revision 4
82 static final int larger_offset_x = 100; 82 static final int larger_offset_x = 100;
83 static final int larger_offset_y = 100; 83 static final int larger_offset_y = 100;
84 84
85 int tile_size_x = 256; 85 int tile_size_x = 256;
86 int tile_size_y = 256; 86 int tile_size_y = 256;
87 int tile_size_x_real_ = 256;
88 int tile_size_y_real_ = 256;
87 int num_tiles_x = 0; 89 int num_tiles_x = 0;
88 int num_tiles_y = 0; 90 int num_tiles_y = 0;
89 double map_center_x = 0.0; 91 double map_center_x = 0.0;
90 double map_center_y = 0.0; 92 double map_center_y = 0.0;
91 int zoom = 0; 93 int zoom = 0;
436 if (!is_in_parent_bitmap_cache) 438 if (!is_in_parent_bitmap_cache)
437 { 439 {
438 // resize tile 440 // resize tile
439 int new_size_x = this.tile_size_x * 2; 441 int new_size_x = this.tile_size_x * 2;
440 int new_size_y = this.tile_size_y * 2; 442 int new_size_y = this.tile_size_y * 2;
443 Bitmap parent_tile_scaled;
444 //parent_tile.setDensity(aagtl.Global_want_dpi);
441 Bitmap parent_tile_scaled = Bitmap.createScaledBitmap(parent_tile, new_size_x, new_size_y, false); 445 parent_tile_scaled = Bitmap.createScaledBitmap(parent_tile, new_size_x, new_size_y, false);
446 parent_tile_scaled.setDensity(aagtl.Global_real_dpi);
442 // 447 //
443 int x_diff = 0; 448 int x_diff = 0;
444 int y_diff = 0; 449 int y_diff = 0;
445 if ((this_tile2[0] - this_tile3_x) > 0.1) 450 if ((this_tile2[0] - this_tile3_x) > 0.1)
446 { 451 {
621 } 626 }
622 // } 627 // }
623 628
624 } 629 }
625 630
631 public void free_stuff()
632 {
633
634 //System.out.println("AAGTL:free_stuff:001");
635 aagtl.logHeap(this.getClass());
636
637 try
638 {
639 for (int dummy = 0; dummy < map_tiles_cache_size; dummy++)
640 {
641 try
642 {
643 map_tiles_cache[dummy].recycle();
644 map_tiles_cache[dummy] = null;
645 }
646 catch (Exception e)
647 {
648 //e.printStackTrace();
649 }
650 }
651 for (int dummy = 0; dummy < map_tiles_parent_cache_size; dummy++)
652 {
653 try
654 {
655 map_tiles_parent_cache[dummy].recycle();
656 map_tiles_parent_cache[dummy] = null;
657 }
658 catch (Exception e)
659 {
660 //e.printStackTrace();
661 }
662 }
663 }
664 catch (Exception e)
665 {
666 //e.printStackTrace();
667 }
668
669 try
670 {
671 for (int y = 0; y < map_tiles_onscreen.length; y++)
672 for (int x = 0; x < map_tiles_onscreen[y].length; x++)
673 {
674 try
675 {
676 //System.out.println("AAGTL:free_stuff:" + y + " " + x + " " + String.valueOf(map_tiles_onscreen[y][x]));
677 map_tiles_onscreen[y][x].recycle();
678 map_tiles_onscreen[y][x] = null;
679 }
680 catch (Exception e)
681 {
682 //e.printStackTrace();
683 }
684 }
685 }
686 catch (Exception e)
687 {
688 //e.printStackTrace();
689 }
690
691 try
692 {
693 for (int y = 0; y < map_tiles_onscreen.length; y++)
694 {
695 for (int x = 0; x < map_tiles_onscreen[y].length; x++)
696 {
697 try
698 {
699 //System.out.println("AAGTL:free_stuff:" + y + " " + x + " " + String.valueOf(copy_bitmaps[y][x]));
700 copy_bitmaps[y][x].recycle();
701 copy_bitmaps[y][x] = null;
702 }
703 catch (Exception e)
704 {
705 //e.printStackTrace();
706 }
707 }
708 }
709 }
710 catch (Exception e)
711 {
712 //e.printStackTrace();
713 }
714
715 try
716 {
717 // try to free the memory of bitmap
718 bitmap_main.recycle();
719 //System.out.println("AAGTL:free_stuff:bitmap_main -> recycle()");
720 bitmap_main = null;
721 }
722 catch (Exception e)
723 {
724 //e.printStackTrace();
725 }
726
727 System.gc();
728
729 //System.out.println("AAGTL:free_stuff:002");
730 aagtl.logHeap(this.getClass());
731 }
732
626 public void clear_stuff() 733 public void clear_stuff()
627 { 734 {
735 //System.out.println("AAGTL:clear_stuff:001");
736 aagtl.logHeap(this.getClass());
737
738 // try
739 // {
740 // for (int dummy = 0; dummy < map_tiles_cache_size; dummy++)
741 // {
742 // try
743 // {
744 // map_tiles_cache[dummy].recycle();
745 // map_tiles_cache[dummy] = null;
746 // }
747 // catch (Exception e)
748 // {
749 // //e.printStackTrace();
750 // }
751 // }
752 // for (int dummy = 0; dummy < map_tiles_parent_cache_size; dummy++)
753 // {
754 // try
755 // {
756 // map_tiles_parent_cache[dummy].recycle();
757 // map_tiles_parent_cache[dummy] = null;
758 // }
759 // catch (Exception e)
760 // {
761 // //e.printStackTrace();
762 // }
763 // }
764 // }
765 // catch (Exception e)
766 // {
767 // //e.printStackTrace();
768 // }
769
770 //System.gc();
771
772 //System.out.println("AAGTL:clear_stuff:002");
773 aagtl.logHeap(this.getClass());
774
628 map_tiles_cache = new Bitmap[map_tiles_cache_size]; 775 map_tiles_cache = new Bitmap[map_tiles_cache_size];
629 map_tiles_parent_cache = new Bitmap[map_tiles_parent_cache_size]; 776 map_tiles_parent_cache = new Bitmap[map_tiles_parent_cache_size];
630 map_tiles_caches_values = new int[map_tiles_cache_size][2]; 777 map_tiles_caches_values = new int[map_tiles_cache_size][2];
631 map_tiles_parent_caches_values = new int[map_tiles_parent_cache_size][2]; 778 map_tiles_parent_caches_values = new int[map_tiles_parent_cache_size][2];
779
780 //System.out.println("AAGTL:clear_stuff:003");
781 aagtl.logHeap(this.getClass());
782
632 for (int dummy = 0; dummy < map_tiles_cache_size; dummy++) 783 for (int dummy = 0; dummy < map_tiles_cache_size; dummy++)
633 { 784 {
634 map_tiles_cache[dummy] = null; 785 map_tiles_cache[dummy] = null;
635 map_tiles_caches_values[dummy][0] = -1; 786 map_tiles_caches_values[dummy][0] = -1;
636 map_tiles_caches_values[dummy][1] = -1; 787 map_tiles_caches_values[dummy][1] = -1;
643 } 794 }
644 } 795 }
645 796
646 public void clear_stuff_2() 797 public void clear_stuff_2()
647 { 798 {
799 //System.out.println("AAGTL:clear_stuff_2:001");
800 aagtl.logHeap(this.getClass());
801
802 // try
803 // {
804 // for (int y = 0; y < map_tiles_onscreen.length; y++)
805 // for (int x = 0; x < map_tiles_onscreen[y].length; x++)
806 // {
807 // //System.out.println("AAGTL:clear_stuff_2:" + y + " " + x + " " + String.valueOf(map_tiles_onscreen[y][x]));
808 // map_tiles_onscreen[y][x].recycle();
809 // map_tiles_onscreen[y][x] = null;
810 // }
811 // }
812 // catch (Exception e)
813 // {
814 // //e.printStackTrace();
815 // }
816
817 // try
818 // {
819 // for (int y = 0; y < map_tiles_onscreen.length; y++)
820 // {
821 // for (int x = 0; x < map_tiles_onscreen[y].length; x++)
822 // {
823 // //System.out.println("AAGTL:clear_stuff_2:" + y + " " + x + " " + String.valueOf(copy_bitmaps[y][x]));
824 // copy_bitmaps[y][x].recycle();
825 // copy_bitmaps[y][x] = null;
826 // }
827 // }
828 // }
829 // catch (Exception e)
830 // {
831 // //e.printStackTrace();
832 // }
833
834 //System.gc();
835
836 //System.out.println("AAGTL:clear_stuff_2:002");
837 aagtl.logHeap(this.getClass());
838
648 map_tiles_onscreen = new Bitmap[num_tiles_x][num_tiles_y]; 839 map_tiles_onscreen = new Bitmap[num_tiles_x][num_tiles_y];
649 map_tile_filename = new String[num_tiles_x][num_tiles_y]; 840 map_tile_filename = new String[num_tiles_x][num_tiles_y];
650 map_tile_num_onscreen = new int[num_tiles_x][num_tiles_y][3]; 841 map_tile_num_onscreen = new int[num_tiles_x][num_tiles_y][3];
651 842
652 copy_bitmaps = new Bitmap[num_tiles_x][num_tiles_y]; 843 copy_bitmaps = new Bitmap[num_tiles_x][num_tiles_y];
653 copy_tiles = new int[num_tiles_x][num_tiles_y][3]; 844 copy_tiles = new int[num_tiles_x][num_tiles_y][3];
654 845
846 //System.out.println("AAGTL:clear_stuff_2:003");
847 aagtl.logHeap(this.getClass());
848
655 for (int y = 0; y < map_tiles_onscreen.length; y++) 849 for (int y = 0; y < map_tiles_onscreen.length; y++)
656 for (int x = 0; x < map_tiles_onscreen[y].length; x++) 850 for (int x = 0; x < map_tiles_onscreen[y].length; x++)
657 { 851 {
658 // System.out.println("xxxxxxx:" + y + " " + x + " " + 852 // System.out.println("xxxxxxx:" + y + " " + x + " " +
659 // String.valueOf(map_tiles_onscreen[y][x])); 853 // String.valueOf(map_tiles_onscreen[y][x]));
685 rectpaint.setDither(false); 879 rectpaint.setDither(false);
686 880
687 bitmap_main = Bitmap.createBitmap(9, 9, Bitmap.Config.ARGB_8888); 881 bitmap_main = Bitmap.createBitmap(9, 9, Bitmap.Config.ARGB_8888);
688 image_main = new Canvas(bitmap_main); 882 image_main = new Canvas(bitmap_main);
689 883
884 this.free_stuff();
690 this.clear_stuff(); 885 this.clear_stuff();
691 886
692 int width = this.getWidth(); 887 int width = this.getWidth();
693 int height = this.getHeight(); 888 int height = this.getHeight();
694 // how many tiles on screen? 889 // how many tiles on screen?
725 { 920 {
726 if (this.zoom > 1) 921 if (this.zoom > 1)
727 { 922 {
728 this.set_zoom(this.zoom - 1); 923 this.set_zoom(this.zoom - 1);
729 } 924 }
925 }
926
927 public void redraw_like_zoom()
928 {
929 this.set_zoom(this.zoom);
730 } 930 }
731 931
732 public void set_zoom(int new_zoom) 932 public void set_zoom(int new_zoom)
733 { 933 {
734 int temp = new_zoom; 934 int temp = new_zoom;
741 this.set_center(new Coordinate(this.main_object.global_settings.map_position_lat, this.main_object.global_settings.map_position_lon)); 941 this.set_center(new Coordinate(this.main_object.global_settings.map_position_lat, this.main_object.global_settings.map_position_lon));
742 __calc_tiles_on_display(); 942 __calc_tiles_on_display();
743 draw_me(); 943 draw_me();
744 this.load_caches_from_db(); 944 this.load_caches_from_db();
745 this.main_object.gcview.invalidate(); 945 this.main_object.gcview.invalidate();
746
747 } 946 }
748 947
749 public int[] __num2point(int xtile, int ytile) 948 public int[] __num2point(int xtile, int ytile)
750 { 949 {
751 int[] ret = new int[2]; 950 int[] ret = new int[2];
768 // c.setDensity(480); 967 // c.setDensity(480);
769 // c.setDensity(160); 968 // c.setDensity(160);
770 969
771 // long a = android.os.SystemClock.elapsedRealtime(); 970 // long a = android.os.SystemClock.elapsedRealtime();
772 971
972 try
973 {
773 int[] dummy = new int[2]; 974 int[] dummy = new int[2];
774 for (int xtemp = 0; xtemp < num_tiles_x; xtemp++) 975 for (int xtemp = 0; xtemp < num_tiles_x; xtemp++)
775 { 976 {
776 for (int ytemp = 0; ytemp < num_tiles_y; ytemp++) 977 for (int ytemp = 0; ytemp < num_tiles_y; ytemp++)
777 { 978 {
778 if (map_tile_num_onscreen == null) 979 if (map_tile_num_onscreen == null)
779 { 980 {
780 return; 981 return;
781 } 982 }
782 if (map_tiles_onscreen == null) 983 if (map_tiles_onscreen == null)
783 { 984 {
784 return; 985 return;
785 } 986 }
786 987
787 // System.out.println("x,y: " + xtemp + " " + ytemp); 988 // System.out.println("x,y: " + xtemp + " " + ytemp);
788 dummy = __num2point(map_tile_num_onscreen[xtemp][ytemp][0], map_tile_num_onscreen[xtemp][ytemp][1]); 989 dummy = __num2point(map_tile_num_onscreen[xtemp][ytemp][0], map_tile_num_onscreen[xtemp][ytemp][1]);
789 // System.out.println("dummy: " + dummy[0] + " " + dummy[1]); 990 // System.out.println("dummy: " + dummy[0] + " " + dummy[1]);
790 // if (false) 991 // if (false)
791 if (map_tiles_onscreen[xtemp][ytemp] != null) 992 if (map_tiles_onscreen[xtemp][ytemp] != null)
792 { 993 {
793 image_main.drawBitmap(map_tiles_onscreen[xtemp][ytemp], dummy[0] + Rose.larger_offset_x, dummy[1] + Rose.larger_offset_y, mainpaint); 994 image_main.drawBitmap(map_tiles_onscreen[xtemp][ytemp], dummy[0] + Rose.larger_offset_x, dummy[1] + Rose.larger_offset_y, mainpaint);
794 } 995 }
795 else 996 else
796 { 997 {
797 rectpaint.setColor(Color.BLACK); 998 rectpaint.setColor(Color.BLACK);
798 rectpaint.setStyle(Paint.Style.FILL); 999 rectpaint.setStyle(Paint.Style.FILL);
799 RectF rectf = new RectF(dummy[0] + Rose.larger_offset_x, dummy[1] + Rose.larger_offset_y, dummy[0] + tile_size_x + Rose.larger_offset_x, dummy[1] + Rose.larger_offset_y + tile_size_y); 1000 RectF rectf = new RectF(dummy[0] + Rose.larger_offset_x, dummy[1] + Rose.larger_offset_y, dummy[0] + tile_size_x + Rose.larger_offset_x, dummy[1] + Rose.larger_offset_y + tile_size_y);
800 image_main.drawRect(rectf, rectpaint); 1001 image_main.drawRect(rectf, rectpaint);
801 1002
802 rectpaint.setColor(Color.RED); 1003 rectpaint.setColor(Color.RED);
803 rectpaint.setStyle(Paint.Style.STROKE); 1004 rectpaint.setStyle(Paint.Style.STROKE);
804 rectf = new RectF(dummy[0] + Rose.larger_offset_x, dummy[1] + Rose.larger_offset_y, dummy[0] + tile_size_x + Rose.larger_offset_x, dummy[1] + tile_size_y + Rose.larger_offset_y); 1005 rectf = new RectF(dummy[0] + Rose.larger_offset_x, dummy[1] + Rose.larger_offset_y, dummy[0] + tile_size_x + Rose.larger_offset_x, dummy[1] + tile_size_y + Rose.larger_offset_y);
805 image_main.drawRect(rectf, rectpaint); 1006 image_main.drawRect(rectf, rectpaint);
806 } 1007 }
807 } 1008 }
1009 }
1010 }
1011 catch (Exception e)
1012 {
1013 System.out.println("AAGTL:error 001 in draw_me");
1014 e.printStackTrace();
808 } 1015 }
809 1016
810 // System.out.println("dm1:" + 1017 // System.out.println("dm1:" +
811 // String.valueOf(android.os.SystemClock.elapsedRealtime() - a)); 1018 // String.valueOf(android.os.SystemClock.elapsedRealtime() - a));
812 // a = android.os.SystemClock.elapsedRealtime(); 1019 // a = android.os.SystemClock.elapsedRealtime();
1041 { 1248 {
1042 // arrow OSD button pressed 1249 // arrow OSD button pressed
1043 this.main_object.set_display_screen(aagtl.DISPLAY_VIEW_ARROW); 1250 this.main_object.set_display_screen(aagtl.DISPLAY_VIEW_ARROW);
1044 return true; 1251 return true;
1045 } 1252 }
1253 else if ((!this.main_object.has_hw_menu_button) && (this.main_object.menu_button_rect_touch.contains(touch_start2.x, touch_start2.y)))
1254 {
1255 // open the options menu
1256 main_object.openOptionsMenu_wrapper();
1257 }
1046 // check if a cache was touched 1258 // check if a cache was touched
1047 else if (this.main_object.gcview.caches_loaded != null) 1259 else if (this.main_object.gcview.caches_loaded != null)
1048 { 1260 {
1049 // only allow to touch caches if a certain zoom level is reached 1261 // only allow to touch caches if a certain zoom level is reached
1050 if (this.zoom >= aagtl.TOUCH_CACHES_AFTER_THIS_ZOOM_LEVEL) 1262 if (this.zoom >= aagtl.TOUCH_CACHES_AFTER_THIS_ZOOM_LEVEL)
1051 { 1263 {
1052 System.out.println("XXXXXXXX zoom=" + this.zoom); 1264 //System.out.println("XXXXXXXX zoom=" + this.zoom);
1053 if (this.main_object.gcview.caches_loaded.size() <= this.main_object.gcview.MAX_DRAW_POINTS) 1265 if (this.main_object.gcview.caches_loaded.size() <= this.main_object.gcview.MAX_DRAW_POINTS)
1054 { 1266 {
1055 GeocacheCoordinate cache_touched = this.check_for_cache((int) touch_start2.x, (int) touch_start2.y); 1267 GeocacheCoordinate cache_touched = this.check_for_cache((int) touch_start2.x, (int) touch_start2.y);
1056 if (cache_touched != null) 1268 if (cache_touched != null)
1057 { 1269 {
1391 { 1603 {
1392 caches_read = this.main_object.pv.get_points_filter(this.main_object.get_visible_area_large(), this.main_object.global_settings.options_hide_found, 50); 1604 caches_read = this.main_object.pv.get_points_filter(this.main_object.get_visible_area_large(), this.main_object.global_settings.options_hide_found, 50);
1393 } 1605 }
1394 catch (Exception e) 1606 catch (Exception e)
1395 { 1607 {
1396 e.printStackTrace(); 1608 //e.printStackTrace();
1397 } 1609 }
1398 this.main_object.gcview.set_loaded_caches(caches_read); 1610 this.main_object.gcview.set_loaded_caches(caches_read);
1399 } 1611 }
1400 1612
1401 public void draw_view() 1613 public void draw_view()
1430 // System.out.println("mcy:" + map_center_y); 1642 // System.out.println("mcy:" + map_center_y);
1431 if (this.main_object.global_settings.options_turn_map_on_heading) 1643 if (this.main_object.global_settings.options_turn_map_on_heading)
1432 { 1644 {
1433 canvas.rotate((int) -this.main_object.cross.get_gps_heading(), this.getWidth() / 2, this.getHeight() / 2); 1645 canvas.rotate((int) -this.main_object.cross.get_gps_heading(), this.getWidth() / 2, this.getHeight() / 2);
1434 } 1646 }
1647 try
1648 {
1435 canvas.drawBitmap(bitmap_main, -Rose.larger_offset_x, -Rose.larger_offset_y, null); 1649 canvas.drawBitmap(bitmap_main, -Rose.larger_offset_x, -Rose.larger_offset_y, null);
1650 }
1651 catch (Exception e)
1652 {
1653 //e.printStackTrace();
1654 }
1436 } 1655 }
1437 } 1656 }
1438 1657
1439 public Rose(Context context, aagtl m) 1658 public Rose(Context context, aagtl m)
1440 { 1659 {
1464 /* Callback invoked when the surface dimensions change. */ 1683 /* Callback invoked when the surface dimensions change. */
1465 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) 1684 public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
1466 { 1685 {
1467 // System.out.println("surfaceChanged:" + String.valueOf(width)); 1686 // System.out.println("surfaceChanged:" + String.valueOf(width));
1468 // System.out.println("surfaceChanged:" + String.valueOf(height)); 1687 // System.out.println("surfaceChanged:" + String.valueOf(height));
1688 //System.out.println("AAGTL:surfaceChanged:");
1469 1689
1470 this.mCanvasWidth = width; 1690 this.mCanvasWidth = width;
1471 this.mCanvasHeight = height; 1691 this.mCanvasHeight = height;
1692
1693 //System.out.println("AAGTL:surfaceChanged:001");
1694 aagtl.logHeap(this.getClass());
1472 1695
1473 // ----------------------------------------- 1696 // -----------------------------------------
1474 // ----------------------------------------- 1697 // -----------------------------------------
1475 // OSD button positions 1698 // OSD button positions
1476 this.main_object.follow_button_rect = new RectF(10, this.mCanvasHeight - this.main_object.follow_current.getHeight() - 10, 10 + this.main_object.follow_current.getWidth(), this.mCanvasHeight - 10); 1699 this.main_object.follow_button_rect = new RectF(10, this.mCanvasHeight - this.main_object.follow_current.getHeight() - 10, 10 + this.main_object.follow_current.getWidth(), this.mCanvasHeight - 10);
1477 1700
1478 this.main_object.arrow_button_rect = new RectF(this.mCanvasWidth - 10 - this.main_object.arrow_button.getWidth(), this.mCanvasHeight - this.main_object.arrow_button.getHeight() - 10, this.mCanvasWidth - 10, this.mCanvasHeight - 10); 1701 this.main_object.arrow_button_rect = new RectF(this.mCanvasWidth - 10 - this.main_object.arrow_button.getWidth(), this.mCanvasHeight - this.main_object.arrow_button.getHeight() - 10, this.mCanvasWidth - 10, this.mCanvasHeight - 10);
1702
1703 if (aagtl.Global_real_dpi >= 320)
1704 {
1705 this.main_object.menu_button_rect = new RectF(this.mCanvasWidth - 10 - this.main_object.menu_button.getWidth(), 10, this.mCanvasWidth - 10, this.main_object.menu_button.getHeight() + 10);
1706 this.main_object.menu_button_rect_touch = new RectF(this.mCanvasWidth - 10 - this.main_object.menu_button.getWidth(), 10, this.mCanvasWidth - 10, this.main_object.menu_button.getHeight() + 10);
1707 }
1708 else
1709 {
1710 final int addon_left = 50;
1711 final int addon_down = 40;
1712 this.main_object.menu_button_rect = new RectF(this.mCanvasWidth - 10 - this.main_object.menu_button.getWidth(), 10, this.mCanvasWidth - 10, this.main_object.menu_button.getHeight() + 10);
1713 this.main_object.menu_button_rect_touch = new RectF(this.mCanvasWidth - 10 - this.main_object.menu_button.getWidth() - addon_left, 10, this.mCanvasWidth - 10, this.main_object.menu_button.getHeight() + 10 + addon_down);
1714 }
1715
1479 // OSD button positions 1716 // OSD button positions
1480 // ----------------------------------------- 1717 // -----------------------------------------
1481 // ----------------------------------------- 1718 // -----------------------------------------
1482 1719
1483 if (bitmap_main != null) 1720 if (bitmap_main != null)
1484 { 1721 {
1485 // try to free the memory of bitmap 1722 // try to free the memory of bitmap
1486 bitmap_main.recycle(); 1723 bitmap_main.recycle();
1724 //System.out.println("AAGTL:bitmap_main -> recycle()");
1725 bitmap_main = null;
1726 //System.gc();
1487 } 1727 }
1488 bitmap_main = Bitmap.createBitmap((this.getWidth() + Rose.larger_offset_x * 2), (this.getHeight() + Rose.larger_offset_x * 2), Bitmap.Config.ARGB_8888); 1728 bitmap_main = Bitmap.createBitmap((this.getWidth() + Rose.larger_offset_x * 2), (this.getHeight() + Rose.larger_offset_x * 2), Bitmap.Config.ARGB_8888);
1489 image_main = new Canvas(bitmap_main); 1729 image_main = new Canvas(bitmap_main);
1730
1731 // DPI
1732 //image_main.setDensity(aagtl.Global_want_dpi);
1733
1734 // DPI
1735 tile_size_x = (int) ((float) tile_size_x_real_ * ((float) aagtl.Global_real_dpi / (float) aagtl.Global_want_dpi));
1736 tile_size_y = (int) ((float) tile_size_y_real_ * ((float) aagtl.Global_real_dpi / (float) aagtl.Global_want_dpi));
1490 1737
1491 // how many tiles on screen? 1738 // how many tiles on screen?
1492 num_tiles_x = (width / tile_size_x) + 2 + more_for_speed_x; 1739 num_tiles_x = (width / tile_size_x) + 2 + more_for_speed_x;
1493 num_tiles_y = (height / tile_size_y) + 2 + more_for_speed_y; 1740 num_tiles_y = (height / tile_size_y) + 2 + more_for_speed_y;
1494 1741
1496 num_tiles_x = num_tiles_x + Math.abs((num_tiles_x % 2) - 1); 1743 num_tiles_x = num_tiles_x + Math.abs((num_tiles_x % 2) - 1);
1497 num_tiles_y = num_tiles_y + Math.abs((num_tiles_y % 2) - 1); 1744 num_tiles_y = num_tiles_y + Math.abs((num_tiles_y % 2) - 1);
1498 1745
1499 // System.out.println("num t x:" + String.valueOf(num_tiles_x)); 1746 // System.out.println("num t x:" + String.valueOf(num_tiles_x));
1500 // System.out.println("num t y:" + String.valueOf(num_tiles_y)); 1747 // System.out.println("num t y:" + String.valueOf(num_tiles_y));
1748
1749 //System.out.println("AAGTL:surfaceChanged:002");
1750 aagtl.logHeap(this.getClass());
1501 1751
1502 this.clear_stuff_2(); 1752 this.clear_stuff_2();
1503 1753
1504 for (int xtemp = 1; xtemp < num_tiles_x + 1; xtemp++) 1754 for (int xtemp = 1; xtemp < num_tiles_x + 1; xtemp++)
1505 { 1755 {

Legend:
Removed from v.3  
changed lines
  Added in v.4

   
Visit the aagtl Website