Commit Graph

1560 Commits

Author SHA1 Message Date
Thiago Marcos P. Santos
68989e671c Remove references to ResourceLoader
ResourceLoader got merged with Style.
2015-06-02 20:23:03 +03:00
John Firebaugh
925cc91ef2 Remove unused; fix naming style 2015-06-01 13:22:02 -07:00
John Firebaugh
ec06bb7e3c Merge ResourceLoader into Style and move atlas ownership 2015-06-01 13:22:02 -07:00
Thiago Marcos P. Santos
f8cc50683a Notify tile parsing errors
The tile parsing is done in a worker thread and if it fails,
we set the tile state to "obsolete" and set an error message.

When the completion callback is fired, we check for the error
message and if it is set, we emit the error signal.

The trick here is the signal cannot be emitted directly from
the worker thread because that would violate data ownership rules.
2015-05-28 09:33:08 +03:00
Thiago Marcos P. Santos
48875d8d6c Notify glyph parsing errors
Emit a signal when the glyphs are not parsed correctly.
2015-05-28 09:33:08 +03:00
Thiago Marcos P. Santos
4819379020 Notify sprite parsing errors
Emit a signal when the JSON or the sprite image was not
parsed correctly.
2015-05-28 09:33:08 +03:00
Konstantin Käfer
f4707f72e0 Replace mbgl::util::make_unique<> with std::make_unique<> 2015-05-26 17:57:38 +02:00
John Firebaugh
87b1da7611 DefaultFileSource has responsibility for handling mapbox:// URLs 2015-05-26 12:14:10 +02:00
Thiago Marcos P. Santos
eaf1c24cdc Do not call abandon texture if there is no texture
Check if the texture was created before abandoning on SpriteAtlas
destructor. Linux driver was fine with that, but was crashing on Mac.
2015-05-22 15:21:39 +03:00
Konstantin Käfer
3cf76ce907 split up glyph_store.cpp into multiple files 2015-05-22 12:30:18 +02:00
Thiago Marcos P. Santos
ee9b172152 Notify failures when loading glyphs 2015-05-22 10:44:18 +03:00
Thiago Marcos P. Santos
ac64bef87f Notify failures when loading tiles 2015-05-22 10:44:18 +03:00
Thiago Marcos P. Santos
7274d2e195 Notify failures when loading the sprite JSON and image 2015-05-22 10:44:18 +03:00
Thiago Marcos P. Santos
90fd06762c Notify failures when loading the source JSON 2015-05-22 10:44:18 +03:00
Thiago Marcos P. Santos
da81211fea Add callback for error notifications on renderStill()
The callback will be called when any of the resources requested
from the network failed to load.

There is not recovery implemented yet, so the closest thing to
reseting the Map object and reloading all the resources would
be setting a new style.
2015-05-22 10:44:18 +03:00
John Firebaugh
b304b20073 Add Thread tests; get argument transfer working for all cases 2015-05-21 19:57:28 -07:00
Minh Nguyễn
b6765a2eb1 Merge pull request #1453 from mapbox/1ec5-whee-2
Prevent full-circle spin during animated rotation
2015-05-19 16:18:26 -07:00
Ansis Brammanis
03d5e2da80 port sprite atlas pollution fix
fixes #1398

js: 212760981493460b438f1cc117001825773fad91
https://github.com/mapbox/mapbox-gl-js/pull/1195

The sprite atlas already had two empty pixels between each each icon.
But the icon's real boundary isn't used for drawing. Drawing uses an
icon's box rounded up to the nearest multiple of four. Sometimes this
rounded boundary was directly on the edge of another icon. When the icon
was sampled with linear interpolation it's edge would get polluted with
values from the other icon.

This commit shifts all icons and glyphs by 1px so that there is padding
on all sides of the box being drawn. The quads used for drawing are
shifted in the opposite direction by 1px to compensate for this.
2015-05-19 10:04:46 -07:00
Konstantin Käfer
bcf66b7449 only return locked FontStack objects 2015-05-19 16:13:36 +02:00
Konstantin Käfer
b0c89e7f44 extend the FontStack lock to returned values 2015-05-19 16:13:36 +02:00
Konstantin Käfer
ab3105aac9 don't mark the glyphs as parsed until we've actually parsed them 2015-05-19 16:13:36 +02:00
John Firebaugh
63ea3d4bef Don't crash if VAO extensions are not available
Fixes #1585
2015-05-18 16:47:20 -07:00
Thiago Marcos P. Santos
aaaf1e4c14 Only emit tile updated signals when the tile really changes
We only emit signals when the number of buckets increase (i.e. the
new data that arrived added a new bucket to the tile).

Also, if we try to reparse a partial tile but it is not possible, we
keep the flag up for trying to reparse it again on the next update,
because the data might have arrived after the bucket that is waiting
for the data was processed but before the end of the parsing.

Fixes #1458
2015-05-18 10:42:05 +03:00
Thiago Marcos P. Santos
4e7c97466c Allow reparsing partial tiles when we have new tiles
When parsing a tile, we request resources from the network, like
sprites and glyphs.

In the rare case of the resources arriving before the tile is
parsed for the first time, if we don't mark it for being parsed
again, it can end up with a tile eternally stuck in the partial
state.
2015-05-18 10:42:05 +03:00
Thiago Marcos P. Santos
3f445e8578 Do not process partial tiles if no new resources have arrived
Partial tiles are now only processed again when there is a new resource
available. If we don't have new resources - like new glyphs - the end result
of the reparsing is the same, because no new SymbolBuckets would are created.

In my tests debugging with PowerTOP, this patch drops the CPU utilization
during the sampling period from 100ms/s to 40ms/s. The improvements on
slow connections (i.e. more time waiting for resources) are even more
noticeable.
2015-05-18 10:42:05 +03:00
Thiago Marcos P. Santos
41dc5e836a Emit the signal on the MapThread
We were previously emitting the signal on the thread parsing the
glyph, but signals can only be trigger from the MapThread
because the observers are living there.
2015-05-18 10:42:05 +03:00
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