Commit Graph

595 Commits

Author SHA1 Message Date
Ansis Brammanis
d34f8eb674 [core][ios][osx][android] make SpriteImage accept PremultipliedImage
the SpriteImage constructor signature changes from

SpriteImage(
        uint16_t width, uint16_t height, float pixelRatio,
        std::string&& data, bool sdf = false);

to

SpriteImage(PremultipliedImage&&, float pixelRatio, bool sdf = false)
2016-01-19 18:23:21 -08:00
Ansis Brammanis
26faa6a5ad [core][ios][osx][android] fix icons with non-integer width/height
ref #3031
ref #2198

For example, an icon that has:
- a pixel width of 10
- a pixel ratio of 3
- a scaled with of 3.333
is now supported.
2016-01-19 18:20:54 -08:00
John Firebaugh
9b62661b07 [core] Use experimental optional instead of mapbox::util::optional 2016-01-19 17:56:48 -08:00
John Firebaugh
6709bdcacd Revert WebP support due to broken builds
This reverts commits 2010fbb0e6, a361ce47a1, and d004bb275a.
2016-01-19 13:34:56 -08:00
Bruno de Oliveira Abinader
2010fbb0e6 [linux] Replace PNG with WebP on tile source URL
This is a hack, in the same fashion as adding {ratio} to the tile URLs.
We should update the raster tile sources to use WebP by default.
2016-01-19 16:06:37 +02:00
Bruno de Oliveira Abinader
a361ce47a1 [linux] Added WebP tile support
- Android support is currently disabled due to a libwebp build issue.
- iOS and OS X support will appear after the next Mapbox iOS SDK release.

Related: #https://github.com/mapbox/mapbox-gl-native/issues/2354
2016-01-19 16:06:36 +02:00
Minh Nguyễn
143f8a7817 [core] Added padding option to CameraOptions
Moved EdgeInsets to geo.hpp so CameraOptions and Transform can refer to it. Added a padding option to CameraOptions that alters the frame of reference for the center option. Added optional padding parameters to LatLng getters and setters.

Working towards #2600.
2016-01-18 16:54:57 -08:00
Konstantin Käfer
a88e58ef3a [core] use stale glyphs
Updating glyphs is still unsupported, and there's no good use case for doing so. When we're using a stale glyph PBF, and the fresh answer contains changed to that glyph, we will continue to use the old glyph.
2016-01-15 17:04:08 +01:00
Konstantin Käfer
bd1f71cdbd [core] use stale sprite data
This is a naïve implementation that essentially merges updated data into existing data. It will *not* remove icons from the stale sprite if they aren't present in the fresh sprite (we aren't tracking the source of a sprite, and the user could have changed it as well). Similarly, it will not update icons that have changed in dimension. This is a rare edge case and probably not worth implementing.
2016-01-15 17:04:07 +01:00
Konstantin Käfer
5fe586633c [test] ensure static rendering finishes when a tile can't be loaded 2016-01-15 12:48:23 +01:00
Konstantin Käfer
8a964fb931 [core] use stale and refreshing TileJSON/GeoJSON data
We're now supporting using stale TileJSON and GeoJSON data. When we receive a new answer with an updated TileJSON file, we're replacing the Source's metadata with the new one and trigger updates to make sure we're loading the correct tiles. Similarly, GeoJSON data will be reparsed.
2016-01-15 12:48:23 +01:00
Konstantin Käfer
21e4029acf [core] use stale styles
This adds support for using cached styles that are stale. They're treated like changing styles; when the refreshed style changed compared to the one we've already had, we're swapping out the entire style, which might cause a slight flicker.
2016-01-15 11:59:26 +01:00
Konstantin Käfer
957415823a [core] Support multiple paths in SQLiteCache::getShared()
If you use many different caches, expired weak_ptrs will pile up in the unordered_map, but that is an edge case, and you probably shouldn't do that anyway.
2016-01-15 10:44:16 +01:00
John Firebaugh
f62d41ae05 [core] Restore existing response body
Until #2721 lands we still need this.
2016-01-14 18:38:56 -08:00
Jason Wray
75ed155f4f [ios] remove testCompassTap test
Fails on CI because KIF is unstable. Refs
61615a44fd, #2769, #2734
2016-01-14 17:58:09 -05:00
John Firebaugh
0066637e58 [core] Let SQLiteCache decide when store or refresh responses 2016-01-14 13:46:03 -08:00
John Firebaugh
2aafdbc1b8 [core] Add an explicit "not modified" indicator to Response 2016-01-14 13:46:03 -08:00
John Firebaugh
2ee1fe4178 [core] std::shared_ptr<const Response> ⇢ const Response& 2016-01-14 13:46:03 -08:00
John Firebaugh
7fb5e973ed [core] Eliminate FileCache interface
There is only one implementation and we're unlikely to add more.
2016-01-14 13:46:03 -08:00
Minh Nguyễn
8bad15bf87 [core] Consolidated zoom and angle anchor logic
Made anchor a CameraOption for easeTo().
2016-01-14 00:40:03 -08:00
Ansis Brammanis
e577354567 [core] remove bilinear, nearest scaling, fix #3164 2016-01-13 15:02:41 -08:00
John Firebaugh
618902e06c [core] Remove request coalescing in OnlineFileSource 2016-01-13 13:43:05 -08:00
John Firebaugh
5a7d2fd60e [core] Eliminate platform::assetRoot()
I regenerated assets.zip so that all file paths have an `assets/` prefix, as the Android AssetFileSource implementation asserts, and removed `TEST_DATA` from the paths.
2016-01-13 13:40:31 -08:00
John Firebaugh
86c8446d3a [core] Simplify asset:// implementation
* Move asset:// URL handling to DefaultFileSource.
* AssetFileSource implements FileSource interface and follows familiar implementation patterns.
* Move default implementation to platform/default, zip implementation to platform/android.
* Don't bother with modified / expires / etag -- assets are not cached so it doesn't matter.
* Don't bother with interleaving individual IO calls on the implementation thread. That adds a lot of complexity for very little benefit.
2016-01-13 13:40:31 -08:00
Minh Nguyễn
61615a44fd [ios] Removed -testCenterSet
This test is causing frequent failures on Bitrise; the failure doesn’t appear to reflect a real-world problem.
2016-01-13 13:17:43 -08:00
Konstantin Käfer
e8705d535d [core] move SourceInfo parsing to StyleParser 2016-01-13 13:04:59 -08:00
Konstantin Käfer
cef05b9017 [core] move invariant Source ID from SourceInfo to Source 2016-01-13 13:04:59 -08:00
Konstantin Käfer
62973f9e5a [core] move raster tile URL normalization to source parsing 2016-01-13 13:04:59 -08:00
Thiago Marcos P. Santos
259fe1c81d [tests] Fix how we launch the test server
`execl` uses varargs thus must be NULL terminated.
2016-01-11 15:40:10 +02:00
Konstantin Käfer
13fbf8b39b [test] Fix test case comments
Follow up to a06f28ddb7
2016-01-11 11:14:29 +01:00
Thiago Marcos P. Santos
d7fdcc73bf [core] Get rid of ::unref() for Timer and AsyncTask
Not need, legacy from libuv. The RunLoop keep the main
loop running until is explicitly no longer needed.
2016-01-09 01:26:29 +02:00
John Firebaugh
4b7db28157 [tests] Test that Timer::stop on a stopped timer is a no-op 2016-01-08 12:23:48 -08:00
Konstantin Käfer
a06f28ddb7 [core] only cache successful or NotFound responses
We don't want other types of error end up in our cache, since it'll likely evict perfectly good content.
2016-01-08 16:25:54 +01:00
Konstantin Käfer
7e815aed2e [test] allow aborting rendering after a timeout 2016-01-08 13:23:01 +01:00
Konstantin Käfer
4479f5db6c [core] don't consult cache for asset resources 2016-01-08 13:05:51 +01:00
Thiago Marcos P. Santos
c8a39e1587 [tests] Sleep more than 1s before refreshing accessed time
The cache `accessed` field resolution is 1s, so we
need to sleep a little bit more in order to make
sure that the cache entries we are refreshing will have
a different `accessed` time than the other entries.
2016-01-07 20:54:01 +02:00
Minh Nguyễn
1a501d4ec4 Happy new year! 2016-01-05 14:01:58 -08:00
Thiago Marcos P. Santos
6af69e4e56 [tests] Added utests for cache versioning 2016-01-05 17:32:46 +02:00
Konstantin Käfer
0377e23c20 [test] terminate test server when stdin closes 2016-01-05 14:14:23 +01:00
John Firebaugh
79368a0ecf [test] Remove terminate-when-inactive behavior from the test server
It caused #3163.

Attempts at having the child exit automatically when the parent exits were stymied
by the fact that unix sucks: http://stackoverflow.com/q/284325/52207.
2016-01-04 17:27:01 -08:00
Thiago Marcos P. Santos
e6dc4fe49d [tests] Add unit tests for SQLiteCache size limit 2015-12-28 14:48:02 +02:00
John Firebaugh
845699e698 [tests] Simplify MockFileSource 2015-12-24 08:17:42 -08:00
John Firebaugh
338f94e7ed [tests] Rewrite {Sprite,Glyph}Store tests in the style of ResourceLoading 2015-12-24 08:17:42 -08:00
John Firebaugh
7a6076ea9d [tests] Test with OnlineFileSource
When we introduce OfflineFileSource, the behavior of existing tests should
not change.
2015-12-23 14:55:12 -08:00
John Firebaugh
16de579d7c [core] Rationalize error handling for resource loading
* Standardize on std::exception_ptr as the error representation
  (fixes #2854).
* Don't format textual strings at the error source; pass on the
  constituent data via observer method parameters instead.
* Use the null object pattern to simplify observer notification code.
* Further refactoring for ResourceLoading tests.
2015-12-23 12:50:42 -08:00
Bruno de Oliveira Abinader
2e69d95c6b [tests] Moved lazy source loading tests to ResourceLoading 2015-12-23 10:54:05 -04:00
John Firebaugh
7c22792bdf [tests] Rewrite resource loading test
Make it more readable and easier to debug.
2015-12-22 18:00:30 -08:00
John Firebaugh
b60b6c47c0 [core] Merge SQLiteCache into the platform library
OfflineFileSource will depend on SQLite too.
2015-12-22 12:09:14 -08:00
Thiago Marcos P. Santos
373916420a [tests] Create less threads on the AsyncTask tests
So we open less fds as new versions of OSX have
a smaller limit (256).
2015-12-21 22:22:11 +02:00
Bruno de Oliveira Abinader
3e00ab1582 [core] Add more tests to on-demand source load 2015-12-17 18:15:06 -08:00