diff options
author | blafoo <github@blafoo.de> | 2012-03-12 22:20:47 +0100 |
---|---|---|
committer | blafoo <github@blafoo.de> | 2012-03-12 22:20:47 +0100 |
commit | f4d2aff9ed315a96d7b4eb6028d35cf2db92a090 (patch) | |
tree | 69735fa8ccbcb7e604c60b2ee4f531d87dce6bc1 /main/src/cgeo/geocaching/connector/gc/IconDecoder.java | |
parent | ac8d792e2558a4c7b4d3fbbec0223f68956ad66d (diff) | |
download | cgeo-f4d2aff9ed315a96d7b4eb6028d35cf2db92a090.zip cgeo-f4d2aff9ed315a96d7b4eb6028d35cf2db92a090.tar.gz cgeo-f4d2aff9ed315a96d7b4eb6028d35cf2db92a090.tar.bz2 |
Tests for #1262
Diffstat (limited to 'main/src/cgeo/geocaching/connector/gc/IconDecoder.java')
-rw-r--r-- | main/src/cgeo/geocaching/connector/gc/IconDecoder.java | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/main/src/cgeo/geocaching/connector/gc/IconDecoder.java b/main/src/cgeo/geocaching/connector/gc/IconDecoder.java index 2935ef0..43ca2ce 100644 --- a/main/src/cgeo/geocaching/connector/gc/IconDecoder.java +++ b/main/src/cgeo/geocaching/connector/gc/IconDecoder.java @@ -7,10 +7,18 @@ import android.graphics.Bitmap; /** * icon decoder for cache icons - * + * */ public abstract class IconDecoder { + public static void parseMapPNG(final cgCache cache, Bitmap bitmap, UTFGridPosition xy, int zoomlevel) { + if (zoomlevel >= 14) { + parseMapPNG14(cache, bitmap, xy); + } else { + parseMapPNG13(cache, bitmap, xy); + } + } + private static final int[] OFFSET_X = new int[] { 0, -1, -1, 0, 1, 1, 1, 0, -1, -2, -2, -2, -2, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2 }; private static final int[] OFFSET_Y = new int[] { 0, 0, 1, 1, 1, 0, -1, -1, -1, -1, 0, 1, 2, 2, 2, 2, 2, 1, 0, -1, -2, -2, -2, -2, -2 }; @@ -22,7 +30,7 @@ public abstract class IconDecoder { * @param bitmap * @param xy */ - public static void parseMapPNG13(final cgCache cache, Bitmap bitmap, UTFGridPosition xy) { + private static void parseMapPNG13(final cgCache cache, Bitmap bitmap, UTFGridPosition xy) { final int xCenter = xy.getX() * 4 + 2; final int yCenter = xy.getY() * 4 + 2; final int bitmapWidth = bitmap.getWidth(); @@ -111,7 +119,7 @@ public abstract class IconDecoder { * @param bitmap * @param xy */ - public static void parseMapPNG14(cgCache cache, Bitmap bitmap, UTFGridPosition xy) { + private static void parseMapPNG14(cgCache cache, Bitmap bitmap, UTFGridPosition xy) { int x = xy.getX() * 4 + 2; int y = xy.getY() * 4 + 2; |