diff --git a/data/basic_hdpi.skn b/data/basic_hdpi.skn index a91d18f32d..52eba156ad 100644 --- a/data/basic_hdpi.skn +++ b/data/basic_hdpi.skn @@ -301,116 +301,125 @@ - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + diff --git a/data/basic_ldpi.skn b/data/basic_ldpi.skn index d45f53e212..459797d35e 100644 --- a/data/basic_ldpi.skn +++ b/data/basic_ldpi.skn @@ -301,116 +301,125 @@ - + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - + - + - + - + - + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + diff --git a/data/basic_mdpi.skn b/data/basic_mdpi.skn index 0e253c0939..bbea2a3e4f 100644 --- a/data/basic_mdpi.skn +++ b/data/basic_mdpi.skn @@ -301,116 +301,125 @@ - + - + - + - + - + - + - + - - + + - - - - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + + + + + + + + + + + + + + diff --git a/data/drules_proto.txt b/data/drules_proto.txt index d8357cde82..a9ba9e28e2 100644 --- a/data/drules_proto.txt +++ b/data/drules_proto.txt @@ -3080,6 +3080,30 @@ cont { } cont { name: "boundary-administrative-2" + element { + scale: 4 + lines { + width: 1 + color: 0xA0A090 + dashdot { + dd: 3.125 + dd: 3.125 + } + priority: 3 + } + } + element { + scale: 5 + lines { + width: 1 + color: 0xD9775B + dashdot { + dd: 3.125 + dd: 3.125 + } + priority: 3 + } + } element { scale: 6 lines { @@ -11076,19 +11100,11 @@ cont { } cont { name: "highway-motorway" - element { - scale: 6 - lines { - width: 1 - color: 0xf08800 - priority: 600 - } - } element { scale: 7 lines { width: 1 - color: 0xf08800 + color: 0xEFBB6E priority: 600 } } @@ -11096,7 +11112,7 @@ cont { scale: 8 lines { width: 2 - color: 0xf08800 + color: 0xEF9721 priority: 600 } } @@ -12544,7 +12560,7 @@ cont { lines { width: 9 color: 0xf08800 - priority: 407 + priority: 600 } path_text { primary { @@ -12560,7 +12576,7 @@ cont { lines { width: 12 color: 0xf08800 - priority: 722 + priority: 600 } path_text { primary { @@ -12576,7 +12592,7 @@ cont { lines { width: 12 color: 0xf08800 - priority: 764 + priority: 600 } path_text { primary { @@ -15684,27 +15700,19 @@ cont { } cont { name: "highway-primary" - element { - scale: 6 - lines { - width: 0.5 - color: 0xffb84f - priority: 540 - } - } element { scale: 7 lines { - width: 1.2 - color: 0xffb84f + width: 1 + color: 0xEED4A6 priority: 540 } } element { scale: 8 lines { - width: 1.8 - color: 0xffb84f + width: 1 + color: 0xF7D396 priority: 540 } } @@ -20713,7 +20721,7 @@ cont { lines { width: 1.6875 color: 0xfffb80 - priority: 222 + priority: 510 } } element { @@ -20721,7 +20729,7 @@ cont { lines { width: 2.75 color: 0xfffb80 - priority: 233 + priority: 510 } } element { @@ -20745,7 +20753,7 @@ cont { lines { width: 9 color: 0xfffb80 - priority: 403 + priority: 510 } path_text { primary { @@ -20761,7 +20769,7 @@ cont { lines { width: 12 color: 0xfffb80 - priority: 718 + priority: 510 } path_text { primary { @@ -20777,7 +20785,7 @@ cont { lines { width: 12 color: 0xfffb80 - priority: 760 + priority: 510 } path_text { primary { @@ -27886,27 +27894,19 @@ cont { } cont { name: "highway-trunk" - element { - scale: 6 - lines { - width: 0.5 - color: 0xffb84f - priority: 540 - } - } element { scale: 7 lines { width: 1.2 - color: 0xffb84f + color: 0xEED4A6 priority: 540 } } element { scale: 8 lines { - width: 1.8 - color: 0xffb84f + width: 1 + color: 0xF7D396 priority: 540 } } @@ -29420,7 +29420,7 @@ cont { lines { width: 9 color: 0xffb84f - priority: 406 + priority: 540 } path_text { primary { @@ -29436,12 +29436,12 @@ cont { lines { width: 15.6 color: 0xfffb80 - priority: 598 + priority: 490 } lines { width: 12 color: 0xffb84f - priority: 721 + priority: 540 } path_text { primary { @@ -29457,12 +29457,12 @@ cont { lines { width: 17.2 color: 0xfffb80 - priority: 650 + priority: 490 } lines { width: 12 color: 0xffb84f - priority: 763 + priority: 540 } path_text { primary { @@ -47334,9 +47334,8 @@ cont { scale: 5 caption { primary { - height: 7 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 8 + color: 0x505050 } priority: 1 } @@ -47346,8 +47345,7 @@ cont { caption { primary { height: 10 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 } priority: 5 } @@ -47357,8 +47355,7 @@ cont { caption { primary { height: 11 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 } priority: 5 } @@ -47368,8 +47365,7 @@ cont { caption { primary { height: 11 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 } priority: 5 } @@ -47379,8 +47375,7 @@ cont { caption { primary { height: 11 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 } priority: 5 } @@ -47390,8 +47385,7 @@ cont { caption { primary { height: 15 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 } priority: 5 } @@ -47444,20 +47438,25 @@ cont { scale: 5 caption { primary { - height: 7 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 10 + color: 0x404040 + stroke_color: 0xEEEEDD } - priority: 2 + secondary { + height: 8 + color: 0xFF6060 + stroke_color: 0xEEEEDD + } + priority: 6 } } element { scale: 6 caption { primary { - height: 10 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 12 + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 6 } @@ -47466,9 +47465,9 @@ cont { scale: 7 caption { primary { - height: 11 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 14 + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 6 } @@ -47477,9 +47476,9 @@ cont { scale: 8 caption { primary { - height: 11 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 16 + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 6 } @@ -47488,9 +47487,9 @@ cont { scale: 9 caption { primary { - height: 11 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 16 + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 6 } @@ -47499,9 +47498,9 @@ cont { scale: 10 caption { primary { - height: 15 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 18 + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 6 } @@ -47511,8 +47510,8 @@ cont { caption { primary { height: 18 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 6 } @@ -47521,9 +47520,9 @@ cont { scale: 12 caption { primary { - height: 20 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 22 + color: 0x606060 + stroke_color: 0xEEEEDD } priority: 10501 } @@ -47532,22 +47531,12 @@ cont { scale: 13 caption { primary { - height: 22 - color: 0x606060 + height: 24 + color: 0x808080 } priority: 10501 } } - element { - scale: 14 - caption { - primary { - height: 22 - color: 0x606060 - } - priority: 10651 - } - } } cont { name: "place-continent" @@ -47555,9 +47544,8 @@ cont { scale: 1 caption { primary { - height: 12 - color: 0x606060 - stroke_color: 0xFFFFFF + height: 16 + color: 0x505050 } priority: 1 } @@ -47566,9 +47554,8 @@ cont { scale: 2 caption { primary { - height: 12 - color: 0x606060 - stroke_color: 0xFFFFFF + height: 18 + color: 0x808078 } priority: 1 } @@ -47580,9 +47567,8 @@ cont { scale: 3 caption { primary { - height: 8 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 10 + color: 0x404040 } priority: 1 } @@ -47591,9 +47577,8 @@ cont { scale: 4 caption { primary { - height: 9 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 12 + color: 0x404040 } priority: 1 } @@ -47602,11 +47587,11 @@ cont { scale: 5 caption { primary { - height: 11 - color: 0xFFFFFF - stroke_color: 0xFFFFFF + height: 14 + color: 0x606060 + stroke_color: 0xEEEEDD } - priority: 10 + priority: 40 } } } @@ -47616,11 +47601,11 @@ cont { scale: 6 caption { primary { - height: 0 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 14 + color: 0x606060 + stroke_color: 0xEEEEDD } - priority: 2 + priority: 20 } } element { @@ -47628,8 +47613,8 @@ cont { caption { primary { height: 0 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 2 } @@ -47639,8 +47624,8 @@ cont { caption { primary { height: 9 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 2 } @@ -47650,8 +47635,8 @@ cont { caption { primary { height: 3 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 2 } @@ -47661,8 +47646,8 @@ cont { caption { primary { height: 7 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x404040 + stroke_color: 0xEEEEDD } priority: 2 } @@ -48011,7 +47996,6 @@ cont { primary { height: 12 color: 0x202020 - stroke_color: 0xFFFFFF } priority: 70 } @@ -48022,7 +48006,6 @@ cont { primary { height: 5 color: 0x202020 - stroke_color: 0xFFFFFF } priority: 70 } @@ -48036,7 +48019,6 @@ cont { primary { height: 10 color: 0x202020 - stroke_color: 0xFFFFFF } priority: 10484 } @@ -48047,7 +48029,6 @@ cont { primary { height: 10 color: 0x202020 - stroke_color: 0xFFFFFF } priority: 10634 } @@ -48058,7 +48039,6 @@ cont { primary { height: 16 color: 0x202020 - stroke_color: 0xFFFFFF } priority: 10899 } @@ -48069,7 +48049,6 @@ cont { primary { height: 24 color: 0x202020 - stroke_color: 0xFFFFFF } priority: 11559 } @@ -48080,7 +48059,6 @@ cont { primary { height: 24 color: 0x202020 - stroke_color: 0xFFFFFF } priority: 11795 } @@ -48093,8 +48071,8 @@ cont { caption { primary { height: 3 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 + stroke_color: 0xEEEEDD } priority: 3 } @@ -48104,8 +48082,8 @@ cont { caption { primary { height: 4 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 + stroke_color: 0xEEEEDD } priority: 3 } @@ -48115,8 +48093,8 @@ cont { caption { primary { height: 5 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 + stroke_color: 0xEEEEDD } priority: 3 } @@ -48126,8 +48104,8 @@ cont { caption { primary { height: 6 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 + stroke_color: 0xEEEEDD } priority: 3 } @@ -48137,8 +48115,8 @@ cont { caption { primary { height: 6 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 + stroke_color: 0xEEEEDD } priority: 3 } @@ -48148,8 +48126,8 @@ cont { caption { primary { height: 12 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 + stroke_color: 0xEEEEDD } priority: 3 } @@ -48159,8 +48137,8 @@ cont { caption { primary { height: 12 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 + stroke_color: 0xEEEEDD } priority: 10453 } @@ -48170,8 +48148,8 @@ cont { caption { primary { height: 15 - color: 0x202020 - stroke_color: 0xFFFFFF + color: 0x505050 + stroke_color: 0xEEEEDD } priority: 10480 } @@ -48180,9 +48158,9 @@ cont { scale: 14 caption { primary { - height: 12 - color: 0x202020 - stroke_color: 0xFFFFFF + height: 16 + color: 0x505050 + stroke_color: 0xEEEEDD } priority: 10625 } @@ -50466,10 +50444,9 @@ cont { } priority: 11569 } - circle { - radius: 4 - color: 0x3050D8 - priority: 1276 + symbol { + name: "railway-station-mini" + priority: 1358 } } element { @@ -50482,10 +50459,9 @@ cont { } priority: 11805 } - circle { - radius: 3.2 - color: 0x3050D8 - priority: 1437 + symbol { + name: "railway-station" + priority: 1358 } } } @@ -50857,51 +50833,19 @@ cont { } cont { name: "railway-light_rail" - element { - scale: 6 - lines { - width: 0.0078125 - color: 0x666666 - priority: 128 - } - } - element { - scale: 7 - lines { - width: 0.015625 - color: 0x666666 - priority: 129 - } - } - element { - scale: 10 - lines { - width: 0.125 - color: 0x666666 - priority: 138 - } - } - element { - scale: 11 - lines { - width: 0.25 - color: 0x666666 - priority: 138 - } - } element { scale: 12 lines { width: 1 - color: 0x8000 + color: 0x90D090 priority: 239 } } element { scale: 13 lines { - width: 1.35 - color: 0x8000 + width: 1 + color: 0x90D090 priority: 490 } } @@ -53905,8 +53849,8 @@ cont { radius: 3 color: 0x3050D8 border { - color: 0xF8FCFF - width: 2 + color: 0xF8FCFF + width: 2 } priority: 750 } @@ -53921,14 +53865,9 @@ cont { } priority: 15567 } - circle { - radius: 4 - color: 0x3050D8 - border { - color: 0xF8FCFF - width: 2 - } - priority: 1275 + symbol { + name: "railway-station-mini" + priority: 1358 } } element { @@ -53941,149 +53880,14 @@ cont { } priority: 15803 } - circle { - radius: 4 - color: 0x3050D8 - border { - color: 0xF8FCFF - width: 4 - } - priority: 1436 + symbol { + name: "railway-station" + priority: 1358 } } } cont { name: "railway-subway" - element { - scale: 6 - lines { - width: 0.0078125 - color: 0x666666 - dashdot { - dd: 0.01171875 - dd: 0.00390625 - } - priority: 130 - } - } - element { - scale: 7 - lines { - width: 0.015625 - color: 0x666666 - dashdot { - dd: 0.0234375 - dd: 0.0078125 - } - priority: 131 - } - } - element { - scale: 10 - lines { - width: 0.125 - color: 0x666666 - dashdot { - dd: 0.1875 - dd: 0.0625 - } - priority: 140 - } - } - element { - scale: 11 - lines { - width: 0.25 - color: 0x666666 - dashdot { - dd: 0.375 - dd: 0.125 - } - priority: 140 - } - } - element { - scale: 12 - lines { - width: 1 - color: 0x80 - priority: 241 - } - } - element { - scale: 13 - lines { - width: 1.35 - color: 0x80 - priority: 252 - } - } - element { - scale: 14 - lines { - width: 2.4 - color: 0x90959 - priority: 217 - } - lines { - width: 1.7 - color: 0xB7B7E6 - priority: 314 - } - lines { - width: 1.7 - color: 0x90959 - dashdot { - dd: 3.6 - dd: 5.4 - } - priority: 332 - } - } - element { - scale: 15 - lines { - width: 3.2 - color: 0xF0F4C - priority: 316 - } - lines { - width: 2 - color: 0xB7B7E6 - priority: 422 - } - lines { - width: 2 - color: 0xF0F4C - dashdot { - dd: 7.2 - dd: 10.8 - } - priority: 440 - } - } - element { - scale: 16 - lines { - width: 3.2 - color: 0xF0F4C - priority: 631 - } - lines { - width: 2 - color: 0xB7B7E6 - priority: 738 - } - lines { - width: 2 - color: 0xF0F4C - dashdot { - dd: 9.6 - dd: 14.4 - } - priority: 757 - } - } element { scale: 17 lines { @@ -54362,65 +54166,17 @@ cont { } cont { name: "railway-tram" - element { - scale: 6 - lines { - width: 0.0078125 - color: 0x666666 - priority: 129 - } - } - element { - scale: 7 - lines { - width: 0.015625 - color: 0x666666 - priority: 130 - } - } - element { - scale: 10 - lines { - width: 0.125 - color: 0x666666 - priority: 139 - } - } - element { - scale: 11 - lines { - width: 0.25 - color: 0x666666 - priority: 139 - } - } - element { - scale: 12 - lines { - width: 1 - color: 0x800080 - priority: 240 - } - } - element { - scale: 13 - lines { - width: 1.35 - color: 0x800080 - priority: 251 - } - } element { scale: 14 lines { - width: 2.4 + width: 2 color: 0x590959 - priority: 216 + priority: 650 } lines { width: 1.7 color: 0xE6B7E6 - priority: 313 + priority: 650 } lines { width: 1.7 @@ -54437,12 +54193,12 @@ cont { lines { width: 3.2 color: 0x4C0F4C - priority: 315 + priority: 650 } lines { width: 2 color: 0xE6B7E6 - priority: 421 + priority: 655 } lines { width: 2 @@ -54451,7 +54207,7 @@ cont { dd: 7.2 dd: 10.8 } - priority: 439 + priority: 660 } } element { @@ -54459,12 +54215,12 @@ cont { lines { width: 3.2 color: 0x4C0F4C - priority: 630 + priority: 650 } lines { width: 2 color: 0xE6B7E6 - priority: 737 + priority: 655 } lines { width: 2 @@ -54473,7 +54229,7 @@ cont { dd: 9.6 dd: 14.4 } - priority: 756 + priority: 660 } } element { @@ -54481,12 +54237,12 @@ cont { lines { width: 3.2 color: 0x4C0F4C - priority: 666 + priority: 650 } lines { width: 2 color: 0xE6B7E6 - priority: 779 + priority: 655 } lines { width: 2 @@ -54495,7 +54251,7 @@ cont { dd: 9.6 dd: 14.4 } - priority: 798 + priority: 660 } } } @@ -54737,14 +54493,6 @@ cont { } cont { name: "railway-tram_stop" - element { - scale: 13 - circle { - radius: 1 - color: 0x202020 - priority: 449 - } - } element { scale: 14 circle { @@ -54763,6 +54511,10 @@ cont { } element { scale: 16 + symbol { + name: "tramway-mini" + priority: 1358 + } caption { primary { height: 10 @@ -54771,14 +54523,13 @@ cont { } priority: 11571 } - circle { - radius: 4 - color: 0x3050D8 - priority: 1277 - } } element { scale: 17 + symbol { + name: "tramway" + priority: 1358 + } caption { primary { height: 10 @@ -54787,11 +54538,6 @@ cont { } priority: 11807 } - circle { - radius: 3.2 - color: 0x3050D8 - priority: 1438 - } } } cont { diff --git a/data/styles/symbols/railway-station-mini.svg b/data/styles/symbols/railway-station-mini.svg new file mode 100644 index 0000000000..5946d96bb9 --- /dev/null +++ b/data/styles/symbols/railway-station-mini.svg @@ -0,0 +1,76 @@ + + + +Train Map Iconimage/svg+xmlTrain Map IconYury Melnichekmapsforhumans.com + + + + \ No newline at end of file diff --git a/data/styles/symbols/tramway-mini.svg b/data/styles/symbols/tramway-mini.svg new file mode 100644 index 0000000000..c0481e2110 --- /dev/null +++ b/data/styles/symbols/tramway-mini.svg @@ -0,0 +1,132 @@ + + + Tramway Stop Map Icon + + + + image/svg+xml + + Tramway Stop Map Icon + + + Yury Melnichek + + + mapsforhumans.com + + + + + + + + + + + + + + + + diff --git a/data/symbols_hdpi.png b/data/symbols_hdpi.png index 0054382197..c146b91e4f 100644 Binary files a/data/symbols_hdpi.png and b/data/symbols_hdpi.png differ diff --git a/data/symbols_ldpi.png b/data/symbols_ldpi.png index 4d66c31432..a402719311 100644 Binary files a/data/symbols_ldpi.png and b/data/symbols_ldpi.png differ diff --git a/data/symbols_mdpi.png b/data/symbols_mdpi.png index b00de5778c..f95c345bfa 100644 Binary files a/data/symbols_mdpi.png and b/data/symbols_mdpi.png differ diff --git a/data/visibility.txt b/data/visibility.txt index c4857960d6..ebbd37e6e7 100644 --- a/data/visibility.txt +++ b/data/visibility.txt @@ -48,7 +48,7 @@ world 000000000000000000 + [religion] 000000000000000000 - christian 000000000000001111 - {} - hospital 000000000000001111 - + hospital 000000000000000111 - hunting_stand 000000000000000001 - kindergarten 000000000000000111 - library 000000000000000001 - @@ -933,9 +933,9 @@ world 000000000000000000 + tunnel 000000000000111111 - {} level_crossing 000000000000000011 - - light_rail 000000000011111111 + + light_rail 000000000000111111 + bridge 000000000000000011 - - tunnel 000000000011111111 - + tunnel 000000000000111111 - {} monorail 000000000000111111 + bridge 000000000000000011 - @@ -980,7 +980,7 @@ world 000000000000000000 + bridge 000000000000000011 - tunnel 000000000011111111 - {} - tram_stop 000000000000001111 - + tram_stop 000000000000000111 - yard 000000000000001111 + bridge 000000000000000011 - tunnel 000000000000111111 - diff --git a/map/map_tests/screen_coverage_test.cpp b/map/map_tests/screen_coverage_test.cpp new file mode 100644 index 0000000000..b8eb75dcea --- /dev/null +++ b/map/map_tests/screen_coverage_test.cpp @@ -0,0 +1,201 @@ +#include "../../testing/testing.hpp" + +#include "../screen_coverage.hpp" + +#include "../coverage_generator.hpp" +#include "../tile_renderer.hpp" +#include "../../yg/rendercontext.hpp" +#include "../../std/bind.hpp" +#include "../../platform/platform.hpp" +#include "../../yg/internal/opengl.hpp" + +class RenderContextMock : public yg::gl::RenderContext +{ +public: + + void makeCurrent() + {} + + shared_ptr createShared() + { + return shared_ptr(new RenderContextMock()); + } + + void endThreadDrawing() + {} +}; + +class TileRendererMock : public TileRenderer +{ +public: + TileRendererMock(string const & skinName, + unsigned scaleEtalonSize, + unsigned maxTilesCount, + unsigned tasksCount, + yg::Color const & bgColor, + RenderPolicy::TRenderFn const & renderFn) + : TileRenderer(skinName, scaleEtalonSize, maxTilesCount, tasksCount, bgColor, renderFn) + {} + + void DrawTile(core::CommandsQueue::Environment const & env, + Tiler::RectInfo const & rectInfo, + int sequenceID) + { + shared_ptr tileTarget = m_resourceManager->renderTargets().Front(true); + + shared_ptr layer(new yg::InfoLayer()); + + ScreenBase frameScreen; + + unsigned tileWidth = m_resourceManager->tileTextureWidth(); + unsigned tileHeight = m_resourceManager->tileTextureHeight(); + + m2::RectI renderRect(1, 1, tileWidth - 1, tileHeight - 1); + + frameScreen.OnSize(renderRect); + frameScreen.SetFromRect(rectInfo.m_rect); + + LOG(LINFO, ("drawTile : ", rectInfo.m_y, rectInfo.m_x, rectInfo.m_tileScale, rectInfo.m_drawScale, ", id=", rectInfo.toUInt64Cell())); + + if (sequenceID < m_sequenceID) + return; + + if (HasTile(rectInfo)) + return; + + threads::Sleep(500); + + AddTile(rectInfo, Tile(tileTarget, layer, frameScreen, rectInfo, 0)); + } +}; + +class WindowHandleMock : public WindowHandle +{ +public: + void invalidateImpl() + {} +}; + +void foo() +{} + +void ScreenCoverageTestImpl(int executorsNum) +{ + yg::gl::g_doFakeOpenGLCalls = true; + + shared_ptr windowHandle(new WindowHandleMock()); + shared_ptr primaryContext(new RenderContextMock()); + shared_ptr resourceManager = make_shared_ptr(new yg::ResourceManager( + 30000 * sizeof(yg::gl::Vertex), + 50000 * sizeof(unsigned short), + 20, + 3000 * sizeof(yg::gl::Vertex), + 5000 * sizeof(unsigned short), + 100, + 10 * sizeof(yg::gl::AuxVertex), + 10 * sizeof(unsigned short), + 30, + 512, 256, 10, + 512, 256, 5, + 512, 512, 20, + "unicode_blocks.txt", + "fonts_whitelist.txt", + "fonts_blacklist.txt", + 2 * 1024 * 1024, + GetPlatform().CpuCores() + 1, + yg::Rt8Bpp, + false)); + + TileRendererMock tileRenderer("basic.skn", 512 + 256, 10, executorsNum, yg::Color(), bind(&foo)); + + CoverageGenerator gen( + GetPlatform().TileSize(), + GetPlatform().ScaleEtalonSize(), + &tileRenderer, + windowHandle + ); + + gen.Initialize(); + tileRenderer.Initialize(primaryContext, resourceManager, 1); + + ScreenBase screen0(m2::RectI(0, 0, 347, 653), m2::RectD(14.672034256593292412, 56.763875246806442476, 16.337299222955756761, 59.897644765638396791)); + ScreenBase screen1(m2::RectI(0, 0, 347, 653), m2::RectD(13.539462118087413955, 56.759076212321247112, 15.204727084449878305, 59.892845731153201427)); + ScreenBase screen2(m2::RectI(0, 0, 347, 653), m2::RectD(16.154935912518372021, 56.749478143350856385, 17.82020087888083637, 59.8832476621828107)); + ScreenBase screen3(m2::RectI(0, 0, 347, 653), m2::RectD(17.335498395876193456, 56.725482970924879567, 19.000763362238657805, 59.859252489756833882)); + + gen.AddCoverScreenTask(screen0); + + /// waiting for CoverScreen processed + gen.WaitForEmptyAndFinished(); + /// waiting for the tiles to be rendered... + tileRenderer.WaitForEmptyAndFinished(); + /// ...and merged + gen.WaitForEmptyAndFinished(); + + gen.AddCoverScreenTask(screen1); + + gen.WaitForEmptyAndFinished(); + tileRenderer.WaitForEmptyAndFinished(); + gen.WaitForEmptyAndFinished(); + + gen.AddCoverScreenTask(screen0); + + gen.WaitForEmptyAndFinished(); + tileRenderer.WaitForEmptyAndFinished(); + gen.WaitForEmptyAndFinished(); + + /// checking that erased tiles are completely unlocked + + TileCache * tileCache = &tileRenderer.GetTileCache(); + + vector erasedRects; + + erasedRects.push_back(Tiler::RectInfo(8, 8, 9, 40)); + erasedRects.push_back(Tiler::RectInfo(8, 8, 9, 41)); + erasedRects.push_back(Tiler::RectInfo(8, 8, 9, 42)); + + for (unsigned i = 0; i < erasedRects.size(); ++i) + CHECK(tileCache->lockCount(erasedRects[i]) == 0, ()); + + /// checking, that tiles in coverage are present and locked + + vector coveredRects; + + coveredRects.push_back(Tiler::RectInfo(8, 8, 10, 40)); + coveredRects.push_back(Tiler::RectInfo(8, 8, 10, 41)); + coveredRects.push_back(Tiler::RectInfo(8, 8, 10, 42)); + + for (unsigned i = 0; i < coveredRects.size(); ++i) + CHECK(tileCache->lockCount(coveredRects[i]) > 0, (coveredRects[i].m_x, coveredRects[i].m_y, coveredRects[i].m_tileScale, coveredRects[i].m_drawScale, coveredRects[i].toUInt64Cell())); + + gen.AddCoverScreenTask(screen2); + gen.WaitForEmptyAndFinished(); + tileRenderer.WaitForEmptyAndFinished(); + gen.WaitForEmptyAndFinished(); + + for (unsigned i = 0; i < coveredRects.size(); ++i) + CHECK(tileCache->lockCount(coveredRects[i]) == 0, (coveredRects[i].m_x, coveredRects[i].m_y, coveredRects[i].m_tileScale, coveredRects[i].m_drawScale, coveredRects[i].toUInt64Cell())); + + coveredRects.clear(); + + coveredRects.push_back(Tiler::RectInfo(8, 8, 11, 40)); + coveredRects.push_back(Tiler::RectInfo(8, 8, 11, 41)); + coveredRects.push_back(Tiler::RectInfo(8, 8, 11, 42)); + + for (unsigned i = 0; i < coveredRects.size(); ++i) + CHECK(tileCache->lockCount(coveredRects[i]) == 0, (coveredRects[i].m_x, coveredRects[i].m_y, coveredRects[i].m_tileScale, coveredRects[i].m_drawScale, coveredRects[i].toUInt64Cell())); + + gen.AddCoverScreenTask(screen3); + gen.WaitForEmptyAndFinished(); + tileRenderer.WaitForEmptyAndFinished(); + gen.WaitForEmptyAndFinished(); + + gen.Cancel(); +} + +UNIT_TEST(ScreenCoverageTest) +{ + ScreenCoverageTestImpl(2); +// ScreenCoverageTestImpl(2); +} +