Commit Graph

53 Commits

Author SHA1 Message Date
Ryan Hamley
0c6b1629ef [Core] Ensure queryRenderedFeatures accounts for icon-rotate (#13105) 2018-10-18 12:14:52 -07:00
Chris Loer
fc11d2e872 [core, test] Add BiDi unit test
- Port of arabic.test.js from mapbox-gl-rtl-text
- Modify BiDi::getLine to remove trailing nulls in the event UBIDI_REMOVE_BIDI_CONTROLS causes the string to shorten.
- Patch vendored ICU to avoid undefined undefined bit shifting behavior (triggered sanitizer failure)
2018-10-15 13:15:46 -07:00
Chris Loer
6cbf150a33 [test] Add unit test for TaggedString::trim() 2018-10-15 13:15:46 -07:00
Chris Loer
ce76bde13d [core] Initial implementation of 'format' expression 2018-10-15 13:15:46 -07:00
Chris Loer
d734f670e8 [core] Fix sort order for queryRenderedFeatures when features are filtered.
Fixes issue #12104.
2018-07-03 15:28:00 -07:00
Chris Loer
b9d3ecc990 [core] Introduce LanguageTag for parsing BCP 47 tags 2018-07-03 10:03:05 -07:00
Chris Loer
27b21363e6 [core] Only run placement for first layer per SymbolBucket
Native version of mapbox/mapbox-gl-js#6548.
Port of mapbox/mapbox-gl-js#6550.
Prevents symbols that share the same layout properties from colliding against each other.

Bump GL JS pin to get regression test.
Rename "bucketName" -> "bucketLeaderID" to make it clearer what it represents.
2018-05-03 14:17:25 -07:00
Chris Loer
b3d3ab0e31 [core] Prevent symbols at the same zoom from sharing a crossTileID.
Port of GL JS PR #5994.
Fixes issue #10844, which would allow multiple symbols in a tile to share the same crossTileID as one of their duplicate parent-tile symbols. Once the symbols shared a crossTileID, they would permanently remain "duplicates" of each other, even after increasing zoom level allowed the CrossTileSymbolIndex to distinguish between them.
2018-01-17 12:49:30 -08:00
Ansis Brammanis
feab36a9fb [core] port minor collision changes from -js (#10764) 2018-01-08 12:57:03 -05:00
Chris Loer
56aa7dad4f [macos,ios,android] Unit test fixups
- Add explanatory comment
 - Remove dead/unused Android test
 - Increase image diff threshold to .05 to accommodate slightly different versions of "PingFang" between different test platforms
2017-12-11 10:43:00 -08:00
Chris Loer
b4c781aef7 [core, macos, ios] Unit tests for LocalGlyphRasterizer
Core test uses stubbed "glyph.pbf" without Chinese glyphs
Darwin test relies on locally available "PingFang" font.
Android test relies on locally available "Droid" font. 'expected.png' is NOT correct b/c I haven't figured out how to run unit tests on Android yet.
2017-12-11 10:43:00 -08:00
Chris Loer
1661af1cb4 [core] Enable local glyph generation using TinySDF.
- Platform-specific LocalGlyphRasterizer is responsible for deciding which glyphs to rasterize locally and for implementing the rasterization.
 - Default platform implementation doesn't locally generate any glyphs -> no behavior change
 - Unit test uses StubLocalGlyphRasterizer, which returns a single fixed bitmap for all CJK glyphs
 - Rename glyph_loader.test to glyph_manager.test
2017-12-11 10:43:00 -08:00
Ansis Brammanis
d69c1c4806 [core] Add unit test for CrossTileSymbolIndex 2017-11-17 10:05:15 -08:00
Bruno de Oliveira Abinader
c9e9cd2aff [test] Added GlyphManager.ImmediateFileSource 2017-10-09 13:33:30 +03:00
Lauren Budorick
2de89a99bc Implement icon-anchor property 2017-08-28 13:32:56 -07:00
Chris Loer
fd2b525c4d [core] Correct x-offset introduced by vertical glyph rotation
Fixes issue#9768.
Port of GL JS PR #5100.
2017-08-18 10:53:26 -07:00
Chris Loer
3b26177e9d [test] Fix undefined behavior warning:
quads.test.cpp used a bin with unsupported x/y coordinates.
Issue #9499.
2017-07-14 09:45:06 +02:00
Ansis Brammanis
e514138b69 [core] improve legibility of labels that follow lines
port https://github.com/mapbox/mapbox-gl-js/pull/4781

This improves legibility of labels that follow lines in pitched views.
The previous approach used the limited information in the shader to
calculate put the glyph in approximatelyright place. The new approach
does this more accurately by doing it on the cpu where we have access to
the entire line geometry.
2017-07-11 09:10:24 -07:00
John Firebaugh
0b68731207 [core] Per-bucket icon atlases 2017-06-13 10:18:43 -07:00
John Firebaugh
92252849c1 [core] Per-bucket glyph atlases 2017-06-13 10:18:43 -07:00
John Firebaugh
d766af44c8 [core] Auto-growable SpriteAtlas using shelf-pack 2017-05-26 11:21:56 -07:00
John Firebaugh
1759603e12 [core] Simplify and fix sprite atlas coordinate calculations
* Always return image metrics exclusive of padding
* Work with integer coordinates whenever possible
* Eliminate redundant SpriteAtlasElement members
* Fix asymmetric re-padding in getIconQuad when pixelRatio != 1
* Add explanatory comments
2017-05-23 12:59:27 -07:00
John Firebaugh
72b13cef6a [core] Remove unnecessary optionals in PositionedIcon
Lack of icon is already checked at the call site of shapeIcon; no need to check hasArea() here.
2017-05-23 12:59:27 -07:00
John Firebaugh
cc1ea759a6 [core, node, darwin, android, qt] Make image ID part of Image
More like Source and Layer.
2017-05-16 12:26:35 -07:00
John Firebaugh
8fb1a81c46 [core] Immutable<Impl> for Image 2017-05-15 08:20:18 -07:00
John Firebaugh
b3ec985568 [core] Trim StyleObserver interface
It doesn't need to inherit from SpriteLoaderObserver and GlyphAtlasObserver.
2017-05-13 09:28:53 -07:00
John Firebaugh
5dd98df50b [all] Rationalize style::Image
A style has a collection of images, just as it has collections of sources and layers.

* Name things appropriately
* Use std::unique_ptr
2017-04-24 15:52:28 -07:00
John Firebaugh
a50d7a331b [core] Replace GlyphRangeSet in onGlyphsAvailable with optionals in the map
GlyphRangeSet isn't keyed by FontStack, so using it to indicate that a particular range was loaded could have produced false positives.
2017-04-14 15:39:31 -07:00
Bruno de Oliveira Abinader
98e2e59e5e [core] Safeguard PositionedIcon usage via optional 2017-04-14 12:33:13 -07:00
John Firebaugh
a2670336d4 [tests] Rewrite GlyphAtlas tests to use public API 2017-04-13 10:10:56 -07:00
John Firebaugh
0810192163 [core] Inline GlyphSet into GlyphAtlas 2017-04-12 16:57:52 -07:00
John Firebaugh
5621a08f89 [core] Test glyph PBF parsing independently of GlyphAtlas 2017-04-06 12:46:06 -07:00
Anand Thakker
693c9f3641 [core] Add DDS support for {text,icon}-size (#8593)
* Update gl-js and generate style code

* Factor out packUint8Pair() helper function

* Draft implementation of DDS for {text,icon}-size

Ports https://github.com/mapbox/mapbox-gl-js/pull/4455

* Fix text-size/composite-function-line-placement test

* Refactor to PaintPropertyBinders-like strategy

* Dedupe gl::Program construction

* Use exponential function base for interpolation

* Dedupe coveringZoomStops method

* Fixup tests

* Fix CI errors (hidden within #if block)
2017-04-06 15:29:59 -04:00
Chris Loer
5cdf838a38 [core] De-mutex GlyphAtlas and SpriteAtlas
- Expose glyph and icon information to workers via message interface.
 - Glyph/SpriteAtlas track which tiles have outstanding requests
    and send messages to them when glyphs/icons become available.
 - Remove obsolete "updateSymbolDependentTiles" pathway
 - Symbol preparation for a tile now depends on all glyphs becoming
    available before it can start.
 - Start tracking individual icons needed for a tile, although we don't
    do anything with the information yet.
 - Introduce typedef for GlyphID
2017-04-04 11:33:12 -07:00
John Firebaugh
c4f9582bfa [core] Pass fully-evaluated layout properties to SymbolInstance and quad methods 2017-03-31 13:26:27 -07:00
John Firebaugh
d7a55a4be1 [core] Introduce a fully-evaluated tuple type for layout properties 2017-03-31 13:26:27 -07:00
John Firebaugh
e18f60229e [core] There's only ever one icon quad 2017-02-28 13:59:14 -08:00
John Firebaugh
e3500c1f79 [core] Replace three maps/mutexes in GlyphAtlas with a single map and mutex 2017-02-27 16:19:35 -08:00
John Firebaugh
d819ece74c [core] Combine SpriteAtlas::getPosition with SpriteAtlas::getImage 2017-02-14 16:28:12 -06:00
John Firebaugh
94f011895c [core] Make Image safer
Provide Image::copy, which handles copying rectangles from a source to a destination, with thorough bounds checking.

Also fixes an indexing error in SpriteAtlas, where the top row of pixels in a wrapped image was copied from the wrong source row.
2017-02-14 12:29:01 -06:00
Minh Nguyễn
e6c15d0f6f Upright CJK characters in vertically-oriented labels (#7114)
CJK characters and adjacent punctuation now remain upright in vertically oriented labels that have line placement.

Fixes #1682.
2017-02-10 18:57:48 -06:00
John Firebaugh
141e995806 [core] Add support for data-driven styling 2017-02-02 09:44:42 -08:00
Konstantin Käfer
6658268115 [core] abort early when placing a glyph in GlyphAtlas if the bitmap is invalid 2017-01-17 19:23:20 +01:00
Konstantin Käfer
b6c1119172 [core] harden Glyph PBF parsing 2017-01-17 19:23:20 +01:00
Konstantin Käfer
e76de05402 [build] move logging to util 2016-11-22 20:58:51 +01:00
John Firebaugh
38fcbe21d4 [core] Convert style properties to a tuple-based approach
This converts the style property classes (CirclePaintProperties and so on) to the same tuple-based approach as gl::Attribute and gl::Uniform. The approach is outlined in https://github.com/mapbox/cpp/blob/master/C%2B%2B%20Structural%20Metaprogramming.md.

The main advantage of this approach is it allows writing algorithms that work on sets of style properties, without resorting to code generation or manually repetitive code. This lets us iterate on approaches to data-driven properties more easily.

Another advantage is that the cascading, unevaluated, and evaluated states of a set of properties exist as independent structures, instead of individual properties holding their own state. This is a more functional approach that makes data flow clearer and reduces state.
2016-11-17 15:13:38 -08:00
Konstantin Käfer
7b50cac49f [core] convert GlyphAtlas to use managed texture handling 2016-11-01 18:41:52 +01:00
Konstantin Käfer
3f3fc7b772 [test] add .test.cpp suffix to test case files 2016-09-28 16:34:22 +02:00
Lucas Wojciechowski
37cb2bd756 [core] Convert uses of std::set to std::unordered_set (#6325)
* src/mbgl/annotation/annotation_manager.hpp

* src/mbgl/algorithm/update_renderables.hpp

* src/mbgl/geometry/glyph_atlas.hpp

* src/mbgl/renderer/painter.cpp and src/mbgl/renderer/render_item.hpp

* src/mbgl/renderer/symbol_bucket.hpp and src/mbgl/text/glyph_store.hpp

* src/mbgl/sprite/sprite_atlas.hpp

* include/mbgl/storage/network_status.hpp

* src/mbgl/text/collision_tile.cpp

* src/mbgl/style/update_batch.hpp

* platform/default/mbgl/storage/offline_download.hpp

* Add GlyphRangeSet typedef

* Fix whitespace & unused imports
2016-09-19 17:26:25 -07:00
John Firebaugh
dc1861f6d5 [core] Merge GlyphStore and GlyphAtlas 2016-09-19 09:40:43 -07:00