Commit Graph

2256 Commits

Author SHA1 Message Date
Thiago Marcos P. Santos
f222efb939 Keep a pointer to GlyphStore on ResourceLoader
For now, keep a pointer so we can subscribe/unsubscribe to events. In
the future, we should move this object completely to ResourceLoader, but
we can't do it now because we delete the ResourceLoader when changing
the style.
2015-05-18 10:42:05 +03:00
John Firebaugh
83a5aae6c5 Render translucent background layers (fixes #1514) 2015-05-15 12:17:32 -07:00
Konstantin Käfer
8dd32e7d22 make sure bit shifts happen with unsigned integers
fixes #1407 and #1408
2015-05-15 14:42:43 +02:00
Mike Morris
f3c2093502 emplace into threadSet
Map thread and Main thread should be separated in Mode::Static now
2015-05-15 12:58:22 +03:00
Thiago Marcos P. Santos
397bbfe495 Always request the SymbolBucket dependencies at the first pass
When processing a layer, we request the dependencies of all the
SymbolBuckets even if we are not processing it completely.
By doing that we are now requesting glyphs in parallel instead of
sequentially as we were doing before.

This patch is also simplifying the SymbolBucket creation code by getting
rid of the ugly "needsResources" return value passed by reference as
argument.
2015-05-15 10:22:57 +03:00
John Firebaugh
c1d004b8fb Restore sprite load check
This is necessary to ensure that background and fill images are ready
to render.

Fixes #1563
2015-05-14 18:15:54 -07:00
John Firebaugh
7d4f12434e Ensure call-once semantics inside InitializeExtensions 2015-05-13 19:01:58 -07:00
John Firebaugh
a2344c36c3 Extensible GL extension support 2015-05-13 19:01:58 -07:00
John Firebaugh
0f7c6b0b52 Remove unused GL feature flags
These were used only for prerendered textures, which were removed.
2015-05-13 19:01:57 -07:00
John Firebaugh
b334b7ee4e Remove unnecessary use of shared_from_this()
If the request is cancelled, the response callback won't be called, and
~Source ensures that the request is cancelled. So it's safe to bind
`this` in the lambda.
2015-05-13 13:57:32 -07:00
John Firebaugh
e6eb6c7fe4 Use uv::async 2015-05-13 13:54:16 -07:00
John Firebaugh
386be7c0fa Remove unused
There are no longer any requests made that don't have a run loop to
dispatch back to.
2015-05-13 13:54:16 -07:00
Konstantin Käfer
e274959753 abort rendering early when we don't need to
when rendering still images, we don't need to render until everything is completely loaded
2015-05-13 10:39:22 +02:00
Thiago Marcos P. Santos
3b92725de1 Stop processing SymbolBuckets at the first incomplete bucket
In order to calculate the collision correctly, the layer ordering
matters. Because of that, when we find the first incomplete symbol
bucket, we stop processing any furter SymbolBucket.

The side effect of this change is, if the first SymbolBucket is the
last to receive its resources, we won't see any label at all on
the screen until the last moment, when everything will be draw at
once.
2015-05-13 09:58:29 +02:00
Thiago Marcos P. Santos
af63b4980d Move the Collision object from TileParser to VectorTileData
We keep the Collision object alive longer because we need it
for the SymbolBuckets yet to be created in case more data
resources arrive. When the tile is no longer needed or if it
is completely parsed or obsolete (i.e. in a immutable state)
we throw the Collision object away.
2015-05-13 09:58:29 +02:00
Thiago Marcos P. Santos
41d619771e Make the state attribute private
Also add a virtual setState() method to give subclasses a chance
to intercept the change of state. This will be used by VectorTileData
to release resources when the TileData becomes immutable.
2015-05-13 09:58:19 +02:00
Konstantin Käfer
40b604448f add BinPack test 2015-05-12 20:46:56 -07:00
Konstantin Käfer
8dd6da5b5e don't implicitly cast to bool since this will make comparisons fails 2015-05-12 20:46:56 -07:00
Konstantin Käfer
fc74f8dcd5 Merge pull request #1484 from mapbox/fix-line-atlas-overflow
Fix potential integer overflow in line_atlas
2015-05-12 15:21:00 +02:00
John Firebaugh
76b922453a Set correct strata for background render
Fixes #1478
2015-05-12 10:50:36 +02:00
Brad Leege
d4fcb5bb98 Merge pull request #1469 from mapbox/1435-android-gl-crash
Android GL Crash
2015-05-11 11:42:21 -05:00
Thiago Marcos P. Santos
642024af6d Merge pull request #1499 from mapbox/clang-3.7-libcpp-atomic_flag-initialized
Initialize the atomic_flag in the class definition
2015-05-11 16:10:54 +03:00
Thiago Marcos P. Santos
b7c63630a4 Initialize the atomic_flag in the class definition
ATOMIC_FLAG_INIT is often defined to { 0 } or { false } and some
compilers might complain about initializing as flag(ATOMIC_FLAG_INIT).
2015-05-11 15:43:55 +03:00
Konstantin Käfer
b7b532ce28 manage atlas textures with unique_ptrs 2015-05-11 11:28:11 +02:00
Leith Bade
703e0bc2ee Ignore deactivate when no valid EGL display. Fixes #1435
Initialise NativeMapView's EGL variables before Map

Fix hang

Add check for double pause

Add test for double pause
2015-05-09 12:02:39 +10:00
Dane Springmeyer
768c259495 fix division by zero conditions 2015-05-08 15:19:41 -07:00
Dane Springmeyer
04c73e5ae1 fix integer overflow in line_atlas 2015-05-08 14:52:33 -07:00
Konstantin Käfer
24ea920810 ignore Transform changes with NaN parameters 2015-05-08 20:25:47 +02:00
Konstantin Käfer
9014890d44 initialize TransformState helper variables correctly 2015-05-08 20:25:38 +02:00
John Firebaugh
1cf5af9c31 Merge remote-tracking branch 'origin/1369-alternate-fix' 2015-05-08 11:20:10 -07:00
Konstantin Käfer
8ee40a544e make WorkRequests cancelable 2015-05-08 16:43:18 +02:00
Konstantin Käfer
bd8d10bab6 make DefaultFileRequest movable only 2015-05-08 11:34:46 +02:00
Konstantin Käfer
fb984a22d1 don't trigger a HTTP request twice 2015-05-08 11:30:26 +02:00
Minh Nguyễn
dcbf4940da Merge pull request #1464 from mapbox/1ec5-type-in
Parse feature types in set filters
2015-05-07 11:35:48 -07:00
Minh Nguyễn
6292e95f80 Parse feature types in set filters
A filter key of `$type` should work in an `in` filter, just like in an `==` filter.
2015-05-07 08:35:41 -07:00
Thiago Marcos P. Santos
8ad81a6676 Removed unused method from MapContext 2015-05-07 16:21:01 +03:00
Minh Nguyễn
d876274ad1 Prevent full-circle spin during animated rotation
#1295 made #1199 a lot less common, but it was still possible for the map to do a full 180° when drift-rotating past due-south. With this change, the map is atomically rotated to a bearing in the same cycle as the final bearing.

/cc @friedbunny
2015-05-06 16:38:59 -07:00
John Firebaugh
5b4015ccba Reference safety for Worker after callbacks
Joining a WorkRequest now ensures that either the after callback has
already been executed, or will never be executed.

Fixes #1438
2015-05-06 14:30:02 -07:00
John Firebaugh
a7df0781f8 Don't crash if ResourceLoader::_sprite is null 2015-05-05 13:34:46 -07:00
Thiago Marcos P. Santos
19881f8b24 Cancel all pending requests before leaving
This still has the unwanted side effect off blocking the Map thread
waiting for the workers to return (because they hold a reference
to the Map thread main loop).

Maybe the only way to solve this would be having a I/O thread for
dispatching messages.

The Request is not bound anymore to the invoker thread because the workers
will request for glyphs, but the reply will arrive at the Map thread.
2015-05-05 18:35:40 +03:00
Thiago Marcos P. Santos
071e2e1731 Do not process buckets depending on Glyphs that were not loaded
For now, the buckets depending on Glyphs that are not yet available
are simply not created (or created and discarded). In the future
we could refactor the code to not create the bucket at all or put
the bucket in a suspended state until the glyph range is available.
2015-05-05 18:35:40 +03:00
Thiago Marcos P. Santos
f10839bac2 Make GlyphStore observable
GlyphStore will notify observers when a glyph range is loaded. By now
the notification is generic, but could be fine grained, causing the
processing of buckets depending on this particular range.
2015-05-05 18:35:40 +03:00
Thiago Marcos P. Santos
1455e5e53c Add partial tile parsing
This change will add a new state to the tile called "partial" which
is a state where the tile can be rendered but some information might
be missing.

For now we skip the SymbolBucket if the Sprites are not loaded (will
also do the same for the glyphs in the future). When the Sprites are
finally loaded, we trigger another update, this time the Tile will
get completely re-rendered and change the state to "parsed".
2015-05-05 18:35:40 +03:00
Thiago Marcos P. Santos
c487c521b4 Move the Sprite handling to ResourceLoader
This is the first concrete step to remove promises from the parsing
pipeline. Buckets depending on the Sprite (i.e. SymbolBucket) won't
be created if the Sprite is not loaded yet. When the Sprite finally gets
loaded, it will fire a signal that will ultimately trigger a reparse.

We still have to expose the Sprite to the Map object as it is needed
for getting offset pixels for annotation symbols, but we can probably
improve that.
2015-05-05 18:10:21 +03:00
Thiago Marcos P. Santos
d726613f6f Update the tiles via ResourceLoader 2015-05-05 18:10:21 +03:00
Thiago Marcos P. Santos
f4baa0ba3e Notify data changes using Observer pattern
This pattern, in contrast with callbacks, allows us to clearly see
the dependency and hierarchy between the objects. It will also help
on writing unit tests as we can count how many times a notification
was triggered.
2015-05-05 18:10:20 +03:00
Thiago Marcos P. Santos
4956da61b9 Introduce the ResourceLoader
ResourceLoader will handle all the tile changes and notifications
through the Source object owned by the Style. This object lives
entirely on the Map thread and should be only accessed by it.

The observer will receive notifications every time the tile data changes
and this will probably trigger a new rendering operation.

This first patch will delegate Source loading to the ResourceLoader.
2015-05-05 18:04:54 +03:00
Konstantin Käfer
5aa0caf5c5 don't trigger cleanups when we're not rendering 2015-05-05 11:53:23 +02:00
Konstantin Käfer
691c305467 add Map::isFullyLoaded()
returns whether the Map is still loading/parsing any assets or whether everything is there and a render will likely be complete
2015-05-05 11:47:23 +02:00
Konstantin Käfer
4cf3d4ef9f show failed glyph URL 2015-05-05 11:47:22 +02:00