Commit Graph

1981 Commits

Author SHA1 Message Date
Bruno de Oliveira Abinader
92856f394c [core] Collision debug is now MapDebugOptions::Collision 2015-11-27 17:47:02 +02:00
Bruno de Oliveira Abinader
d55aa7929c [core] Source should receive a ref to MapData just once 2015-11-27 17:47:02 +02:00
Bruno de Oliveira Abinader
1f0820c8e8 [core] Added MapDebugOptions
Map debug options are now cycled up to all debug options enabled, then
back to none.
2015-11-27 17:47:02 +02:00
Bruno de Oliveira Abinader
044e92f5e8 [core] Display modify, expires debug information 2015-11-27 17:47:02 +02:00
Bruno de Oliveira Abinader
591e0dde2f [core] Added modified, expires information to TileData 2015-11-27 17:47:02 +02:00
Bruno de Oliveira Abinader
31fd2822f5 [core] Replace time_t with std::chrono::seconds
Added aliases for std::chrono typedefs (eg. 'Seconds' for
std::chrono::seconds). These aliases are used together with templated
helper functions to replace time_t with std::chrono::seconds for most
cases, in particular for 'modified' and 'expires' values in Response.
2015-11-27 17:47:02 +02:00
John Firebaugh
1d33790dc0 [core] Fix image type of Map::renderStill
It's a premultiplied image. This implies that we were misusing encodePNG
in most cases, as we were passing premultiplied pixels which were then
interpreted as unmultiplied. I changed encodePNG to accept premultipled
pixels, and unpremultiply in the implementations.
2015-11-25 15:57:37 -08:00
John Firebaugh
f3d6f68106 [core] Always manually premultiply libpng output
It appears to be the only way to get the results we want in all cases.
2015-11-25 15:57:36 -08:00
John Firebaugh
0c1e378bc9 [core] Rewrite image handling
* Consolidate Image and StillImage
* Typecheck unassociated vs premultiplied images
* Rewrite default platform image decoding implementation
2015-11-25 15:57:36 -08:00
Minh Nguyễn
2de0a351a0 [core] [iOS] Completion handlers for animated methods
Added transition frame and finish functions to CameraOptions. Added Objective-C equivalents to the three main entry points to easeTo() in MGLMapView.

Fixes #1581.
2015-11-25 15:20:25 -08:00
Thomas Voß
3f786c7171 Fix GCC5 complaining about -Wunused-variable. 2015-11-25 14:23:13 +01:00
Konstantin Käfer
b5f7cafab4 [core] more robust max-age parsing 2015-11-20 14:39:44 +01:00
John Firebaugh
d08861daf4 [core] Force style-sourced annotations to be visible 2015-11-19 19:50:29 -08:00
John Firebaugh
afa04de152 [core] Followup fix to #3037
The previous fix resulted in annotations sometimes never being added.
This would happen if, during the execution of MapContext::update where
Update::Annotations was set, the style itself was loaded but some of
its subresources (sprite or sources) were not.

#3082 is a follow up issue to make MapContext::update less error-prone.
2015-11-19 18:01:42 -08:00
John Firebaugh
db1c4f2cc2 [core] Avoid calling AnnotationManager::updateStyle until the style is loaded
Fixes #3037
2015-11-18 16:05:13 -08:00
Bruno de Oliveira Abinader
adfac6f061 [core] Added ConstrainMode::{HeightOnly,WidthAndHeight}
ConstrainMode gives flexibility to our engine to choose between
constraining both vertically and horizontally, or just vertically
(default behavior).

Constrain in both axis means we can no longer pan the map beyond the map
boundaries. This fixes an issue where e.g. annotations disappear upon
crossing the map boundaries.
2015-11-18 09:37:27 +02:00
Bruno de Oliveira Abinader
cb9b397985 [core] Fix LatLngBounds default coordinates
LatLngBounds southwest and northeast coordinate points were inverted, so
they could be extended via LatLngBounds::extend(). However, this looks
confusing and error-prone.

A static LatLngBounds::getExtendable() is added to address cases when we
want to extend LatLngBounds.
2015-11-18 09:37:27 +02:00
Bruno de Oliveira Abinader
711d41f91b [core] Avoid extra copy of TransformState in Painter::render
In MapContext thread, TransformState gets updated from main thread to
MapContext and Painter can safely reference MapContext's TransformState
instead of copying it upon each Painter::render call.
2015-11-18 09:37:27 +02:00
John Firebaugh
7137239cbd [core] Use std::unique_ptr for FileSource request 2015-11-16 12:25:47 -08:00
John Firebaugh
1caf89c32b [core] Pass a value to response callback, not a reference 2015-11-16 12:25:47 -08:00
Thiago Marcos P. Santos
36581f3d30 [core] Do not pass uv_loop_t around
This should be abstracted by util::RunLoop
2015-11-16 12:25:47 -08:00
John Firebaugh
2eb0203bf4 [core] Cancelled flag needs to be atomic; it is read from multiple threads 2015-11-16 12:25:46 -08:00
John Firebaugh
6f881977eb [core] Fix a subtle and currently unexposed bug in RunLoop::invokeWithCallback
The doubly nested lambda that's responsible for executing the callback
needs to check the cancellation flag on *both* threads. See comment for
details.
2015-11-16 12:25:46 -08:00
Thiago Marcos P. Santos
d9f10fbfa7 [core] Use std::mutex on RunLoop
Only the WorkTask mutex needs to be recusive because
the WorkQueue will run a WorkTask that will pop
itself from the WorkQueue causing it to get cancelled.
2015-11-16 22:16:08 +02:00
John Firebaugh
f9ebe54a63 [core] Merge Sprite into SpriteStore 2015-11-12 13:03:14 -08:00
John Firebaugh
1e350b7ea4 [core] Reorganize sprite related files 2015-11-12 13:03:14 -08:00
Bruno de Oliveira Abinader
fc2fa73363 [core] Cleanup Transform::rotateBy
Make use of PrecisionPoint's operator functionalities inherited from
vec2<> and reduced overhead eg. offset_y is always 0 so no need to add
this to calculation inside the if.
2015-11-12 10:46:50 -08:00
Bruno de Oliveira Abinader
8b76f00d8c [core] PrecisionPoint is now a vec2<double>
We could reuse all the operators defined in vec2<>, including operator
bool() that checks if the contained values are !NaN.
2015-11-12 10:46:50 -08:00
Minh Nguyễn
6748b6155e [core] Fixed bit-shifting error in exponential backoff
This change fixes a bug introduced in 4d5c6333be for #2727. 1 << 32 would exceed the size of int64_t. The static analyzer reported undefined behavior here because std::min() might or might not return 32.
2015-11-12 10:46:47 -08:00
Minh Nguyễn
aae7f90e37 [core] Fixed Transform::_setScale()
Corrected Transform::_setScale() after the refactoring in 5a24ac605b for #2994. This change also addresses two dead store warnings from the static analyzer.
2015-11-12 10:46:43 -08:00
John Firebaugh
7621a41158 Fix symbol-placement: line + {icon,text}-rotation-alignment: viewport
Fixes #3004
2015-11-11 17:34:56 -08:00
Bruno de Oliveira Abinader
aa8857643d [core] Added MetersBounds 2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
cd0266f25c [core] Added more NaN checks in Transform 2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
5a24ac605b [core] Use PrecisionPoint in zoom and angle functions 2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
99ac8d8720 [core] Use pass-by-ref in CameraOptions
Pass-by-const-ref is not always possible because CameraOptions gets its
members modified along the way.

Also fixes a case in Map::jumpTo where Update::Zoom should be called if
zoom is affected.
2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
c78e769635 [core] Use PrecisionPoint in coordinate functions 2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
e2052ea3e4 [core] Added PrecisionPoint to represent pixel points 2015-11-11 16:59:49 +02:00
Bruno de Oliveira Abinader
e5c460f2db [core] Added isValid to geo helper structs 2015-11-11 16:59:49 +02:00
John Firebaugh
54e08b1f83 [core] Eliminate use of ClassProperties for paint 2015-11-10 11:33:17 -08:00
John Firebaugh
a562567589 [core] Eliminate use of ClassProperties for layout 2015-11-10 11:33:17 -08:00
John Firebaugh
728a9858ea [core] Push layouts and paints to subclasses 2015-11-10 11:33:17 -08:00
Bruno de Oliveira Abinader
41120774af [core] Expose default fade duration to Map API 2015-11-10 10:28:16 +02:00
Konstantin Käfer
7b8b2b1790 Revert "[core] only update the render order array when there are changes to tiles"
This reverts commit ec1a58d8ef and 177372b836.
2015-11-09 11:18:10 -08:00
Bruno de Oliveira Abinader
ff5d405958 [core] Update::Classes already implies repaint 2015-11-09 15:05:08 +02:00
Minh Nguyễn
17451418cc [core] Update after final frame of transition
The final frame is self-destructing – it destroys the frame and finish functions – so technically we’re no longer inTransition(). Yet there still needs to be an update after that final frame.

Also, avoid a redundant change notification on the last frame. (It would come too late, after the DidChange notification, anyhow.)

Fixes #2946.
2015-11-06 11:06:53 -08:00
John Firebaugh
10858ab382 [core] Remove the ability to change cross-fade durations via transition
We shouldn't overload transition duration to mean the duration of the
cross-fade when moving between stops. If we want to allow styles to
override the default 300ms fade duration, it should be a dedicated
property like raster-fade-duration.

I don't think any styles use this functionality -- if they did, they
were broken for MapMode::Still rendering.
2015-11-06 10:39:06 -08:00
John Firebaugh
9b537fab29 [core] Use frame animation time, not Clock::now(), for fading 2015-11-06 10:38:48 -08:00
John Firebaugh
b81243daa9 [core] Merge PiecewiseConstantFunction into Function 2015-11-06 10:38:48 -08:00
John Firebaugh
7de4ce5bcb [core] Simplify Function 2015-11-06 10:38:47 -08:00
Bruno de Oliveira Abinader
5ef5d08867 [core] Reset GL values when needed 2015-11-06 20:05:01 +02:00