Commit Graph

358 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
John Firebaugh
dbfa932ed1 [core] Eliminate macros in sqlite3.cpp 2016-01-19 13:39:18 -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
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
Thiago Marcos P. Santos
7ad9e47bbe [glfw] Fix panning direction
Follow-up of the transform refactoring
2016-01-19 11:36:26 +02:00
Minh Nguyễn
47b69100f9 [core, ios, osx, android, glfw] Flipped origin of Map::latLngForPixel(), Map::pixelForLatLng()
Map and Transform methods assume an origin at the top-left corner of the view, like iOS, Android, and GLFW but unlike OS X. Transform is responsible for flipping coordinates between the top-left origin of Map and the bottom-left origin of TransformState.

Fixes #3574.
2016-01-18 16:54:58 -08: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
Konstantin Käfer
8939a7b706 [core] move SharedSQLiteCache::get to SQLiteCache::getShared 2016-01-15 10:38:09 +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
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
John Firebaugh
618902e06c [core] Remove request coalescing in OnlineFileSource 2016-01-13 13:43:05 -08:00
John Firebaugh
716a9c92cb [core] Inline a temporary variable which is now used only once 2016-01-13 13:40:31 -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
John Firebaugh
2126e34e52 [core] Further clarify timeout calculations 2016-01-13 13:38:12 -08:00
John Firebaugh
54fc3831f2 [core] Use Seconds::max() rather than -1 for simpler logic 2016-01-13 13:38:12 -08:00
John Firebaugh
96781c0a8d [core] Inline OnlineFileRequestImpl::setResponse
In the cache response case, we don't want the failedRequests logic; cached errors, should they occur, shouldn't affect the scheduling behavior for real requests.
2016-01-13 13:38:12 -08:00
John Firebaugh
601e3d9d45 [core] Refactor down to two methods for scheduling a cache or real request 2016-01-13 13:38:12 -08:00
John Firebaugh
682b2335e5 [core] Inline OnlineFileRequestImpl::getRetryTimeout 2016-01-13 13:38:12 -08:00
John Firebaugh
ea45075e4d [core] Inline OnlineFileRequestImpl::checkResponseFreshness 2016-01-13 13:38:12 -08:00
John Firebaugh
6f9de6ae47 [core] Refactor to instance methods on OnlineFileRequestImpl 2016-01-13 13:38:12 -08:00
John Firebaugh
e9eb29719b [core] Simplify logic for notification with pre-existing response
We already had a condition that checks if a response is immediately available for an incoming request. Call the callback there, rather than in addObserver.
2016-01-13 13:38:12 -08:00
John Firebaugh
dd3ca81589 [core] Inline sole use of OnlineFileSource::Impl::update 2016-01-13 13:38:12 -08:00
John Firebaugh
f8d3cf41ae [core] Simplify OnlineFileSource::Impl::reschedule 2016-01-13 13:38:12 -08:00
Brad Leege
aac6b00dd0 Merge branch 'hotfix/android_x86_64' of git://github.com/Malinskiy/mapbox-gl-native into Malinskiy-hotfix/android_x86_64 2016-01-13 10:06:08 -06: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
e7b0b31d58 [core] Privatize SQLiteCache 2016-01-08 12:31:13 -08:00
John Firebaugh
0a8fef1f51 [core] Merge OnlineFileRequestImpl::notify into OnlineFileRequestImpl::setResponse
In every case where setResponse is called, notify was called soon after. In one case immediately, in another, after intervening functions which are safe to reorder after notifications.

The null-check of response is safe to eliminate because response must not be null inside setResponse.
2016-01-08 12:29:11 -08:00
John Firebaugh
adf3dea4e5 [core] Simplify OnlineFileSource's Timer use
There is no need for the timer to be created only under certain conditions. Stopping a non-started timer is a no-op. Therefore it can simply be a direct member.

While here, rename the variable. It's a timer, not a request.
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
4479f5db6c [core] don't consult cache for asset resources 2016-01-08 13:05:51 +01:00
Konstantin Käfer
bc309d84d7 [core] unify URL prefix detection (asset:// and mapbox://) 2016-01-08 12:14:39 +01:00
Anton Malinskiy
a6a3b8a80a [android] Fixed x86_64 crash on startup: no implementation previously for cache's get/bind by chrono's seconds for x86_64. Explicitly cast to int64_t 2016-01-07 18:32:17 +07:00
Thiago Marcos P. Santos
a5987afeb9 [core] Added versioning to the cache database
Force drop the table when the version doesn't match. Previously
it was assumed (my bad) that CREATE TABLE IF NOT EXISTS would
compare the table schema, which is not true.
2016-01-05 17:32:46 +02:00
Thiago Marcos P. Santos
6d0b01c5fb [core] Make it possible to limit the size of the SQLite cache 2015-12-27 18:15:33 +02: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
c972a251da [core] Remove Resource dependency from low-level classes
These classes should not be coupled to domain-specific resource types.
2015-12-23 14:30:20 -08:00
John Firebaugh
ab0efe5d00 [core] Move OnlineFileSource to platform
Preparation for OfflineFileSource which depends on SQLite
2015-12-22 12:09:14 -08:00
Bruno de Oliveira Abinader
20d2ceef4b [osx] Use framebuffer width/height in GLFW port
Framebuffer width/height takes pixel ration in consideration.

Part of #3294.
2015-12-18 15:31:36 -08:00
Thiago Marcos P. Santos
a903d2eef0 [glfw] Set viewport size from the Map thread
Setting the viewport size from the main thread has no affect
on Linux and thus, the map doesn't scale. We now set the
viewport size on the beforeRender() hook that gets called
from the Map thread.
2015-12-16 17:18:54 -08:00
Konstantin Käfer
4fc8226838 [core] allow changing the orientation
You can now change the orientation of north to be to the right, bottom, left in addition to the default of top
2015-12-15 11:41:58 -08:00
Mike Morris
f4d394d935 [node] code review cleanup 2015-12-15 10:19:56 -08:00
Konstantin Käfer
93c000dd18 [core] viewport is handled by embedding applications 2015-12-10 14:16:11 -08:00
Thiago Marcos P. Santos
0a97145d05 [core] Better C++ usage on RunLoop
Follow-up of #3179.
2015-12-08 10:23:11 -08:00
Konstantin Käfer
c279fb1717 [core] throw values, catch references 2015-12-03 15:38:36 +01:00
Konstantin Käfer
0c351eb523 [core] use default instead of empty function body 2015-12-03 15:38:36 +01:00
Konstantin Käfer
478472e501 [core] add std::move to constructors 2015-12-03 15:38:36 +01:00