Merge remote-tracking branch 'origin/fix-linux-install' into mesa
This commit is contained in:
@@ -28,6 +28,7 @@
|
||||
{ 'target_name': 'mbgl-ios',
|
||||
'product_name': 'mbgl-ios',
|
||||
'type': 'static_library',
|
||||
'standalone_static_library': 1,
|
||||
'hard_dependency': 1,
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
{ 'target_name': 'mbgl-linux',
|
||||
'product_name': 'mbgl-linux',
|
||||
'type': 'static_library',
|
||||
'standalone_static_library': 1,
|
||||
'hard_dependency': 1,
|
||||
'include_dirs': [
|
||||
'../include'
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
{ 'target_name': 'mbgl-osx',
|
||||
'product_name': 'mbgl-osx',
|
||||
'type': 'static_library',
|
||||
'standalone_static_library': 1,
|
||||
'hard_dependency': 1,
|
||||
'include_dirs': [
|
||||
'../include',
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
{ 'target_name': 'mbgl',
|
||||
'product_name': 'mbgl',
|
||||
'type': 'static_library',
|
||||
'standalone_static_library': 1,
|
||||
'hard_dependency': 1,
|
||||
'dependencies': [
|
||||
'shaders',
|
||||
|
||||
@@ -24,6 +24,8 @@ private:
|
||||
std::set<uint64_t> ids;
|
||||
};
|
||||
|
||||
Rect<uint16_t> addGlyph_impl(uint64_t tile_id, const std::string& face_name,
|
||||
const SDFGlyph& glyph);
|
||||
public:
|
||||
GlyphAtlas(uint16_t width, uint16_t height);
|
||||
~GlyphAtlas();
|
||||
@@ -31,6 +33,8 @@ public:
|
||||
|
||||
Rect<uint16_t> addGlyph(uint64_t tile_id, const std::string& face_name,
|
||||
const SDFGlyph& glyph);
|
||||
void addGlyphs(uint64_t tileid, std::u32string const& text, std::string const& stackname,
|
||||
FontStack const& fontStack, GlyphPositions & face);
|
||||
void removeGlyphs(uint64_t tile_id);
|
||||
void bind();
|
||||
|
||||
|
||||
@@ -86,8 +86,8 @@ private:
|
||||
void addSymbols(Buffer &buffer, const PlacedGlyphs &symbols, float scale, PlacementRange placementRange);
|
||||
|
||||
// Adds glyphs to the glyph atlas so that they have a left/top/width/height coordinates associated to them that we can use for writing to a buffer.
|
||||
void addGlyphsToAtlas(uint64_t tileid, const std::string stackname, const std::u32string &string,
|
||||
const FontStack &fontStack, GlyphAtlas &glyphAtlas, GlyphPositions &face);
|
||||
static void addGlyphsToAtlas(uint64_t tileid, const std::string stackname, const std::u32string &string,
|
||||
const FontStack &fontStack, GlyphAtlas &glyphAtlas, GlyphPositions &face);
|
||||
|
||||
public:
|
||||
const StyleBucketSymbol &properties;
|
||||
|
||||
@@ -22,9 +22,15 @@ GlyphAtlas::~GlyphAtlas() {
|
||||
}
|
||||
|
||||
Rect<uint16_t> GlyphAtlas::addGlyph(uint64_t tile_id, const std::string& face_name,
|
||||
const SDFGlyph& glyph) {
|
||||
const SDFGlyph& glyph)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mtx);
|
||||
return addGlyph_impl(tile_id, face_name, glyph);
|
||||
}
|
||||
|
||||
Rect<uint16_t> GlyphAtlas::addGlyph_impl(uint64_t tile_id, const std::string& face_name,
|
||||
const SDFGlyph& glyph)
|
||||
{
|
||||
// Use constant value for now.
|
||||
const uint8_t buffer = 3;
|
||||
|
||||
@@ -83,6 +89,23 @@ Rect<uint16_t> GlyphAtlas::addGlyph(uint64_t tile_id, const std::string& face_na
|
||||
return rect;
|
||||
}
|
||||
|
||||
void GlyphAtlas::addGlyphs(uint64_t tileid, std::u32string const& text, std::string const& stackname, FontStack const& fontStack, GlyphPositions & face)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mtx);
|
||||
|
||||
std::map<uint32_t, SDFGlyph> const& sdfs = fontStack.getSDFs();
|
||||
for (uint32_t chr : text)
|
||||
{
|
||||
auto sdf_it = sdfs.find(chr);
|
||||
if (sdf_it != sdfs.end())
|
||||
{
|
||||
SDFGlyph const& sdf = sdf_it->second;
|
||||
Rect<uint16_t> rect = addGlyph_impl(tileid, stackname, sdf);
|
||||
face.emplace(chr, Glyph{rect, sdf.metrics});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GlyphAtlas::removeGlyphs(uint64_t tile_id) {
|
||||
std::lock_guard<std::mutex> lock(mtx);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ bool SpriteAtlas::resize(const float newRatio) {
|
||||
}
|
||||
}
|
||||
|
||||
free(old_data);
|
||||
::operator delete(old_data);
|
||||
dirty = true;
|
||||
|
||||
// Mark all sprite images as in need of update
|
||||
@@ -154,7 +154,8 @@ void SpriteAtlas::allocate() {
|
||||
if (!data) {
|
||||
dimension w = static_cast<dimension>(width * pixelRatio);
|
||||
dimension h = static_cast<dimension>(height * pixelRatio);
|
||||
data = (uint32_t *)calloc(w * h, sizeof(uint32_t));
|
||||
data = static_cast<uint32_t*>(::operator new(w * h * sizeof(uint32_t)));
|
||||
std::fill(data, data + w * h, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,9 +269,5 @@ SpriteAtlas::~SpriteAtlas() {
|
||||
|
||||
glDeleteTextures(1, &texture);
|
||||
texture = 0;
|
||||
|
||||
if (data) {
|
||||
free(data);
|
||||
data = nullptr;
|
||||
}
|
||||
::operator delete(data), data = nullptr;
|
||||
}
|
||||
|
||||
@@ -34,18 +34,9 @@ bool SymbolBucket::hasTextData() const { return !text.groups.empty(); }
|
||||
bool SymbolBucket::hasIconData() const { return !icon.groups.empty(); }
|
||||
|
||||
void SymbolBucket::addGlyphsToAtlas(uint64_t tileid, const std::string stackname,
|
||||
const std::u32string &string, const FontStack &fontStack,
|
||||
const std::u32string &text, const FontStack &fontStack,
|
||||
GlyphAtlas &glyphAtlas, GlyphPositions &face) {
|
||||
const std::map<uint32_t, SDFGlyph> &sdfs = fontStack.getSDFs();
|
||||
// Loop through all characters and add glyph to atlas, positions.
|
||||
for (uint32_t chr : string) {
|
||||
auto sdf_it = sdfs.find(chr);
|
||||
if (sdf_it != sdfs.end()) {
|
||||
const SDFGlyph &sdf = sdf_it->second;
|
||||
const Rect<uint16_t> rect = glyphAtlas.addGlyph(tileid, stackname, sdf);
|
||||
face.emplace(chr, Glyph{rect, sdf.metrics});
|
||||
}
|
||||
}
|
||||
glyphAtlas.addGlyphs(tileid, text, stackname, fontStack,face);
|
||||
}
|
||||
|
||||
std::vector<SymbolFeature> SymbolBucket::processFeatures(const VectorTileLayer &layer,
|
||||
@@ -150,8 +141,8 @@ void SymbolBucket::addFeatures(const VectorTileLayer &layer, const FilterExpress
|
||||
|
||||
// Add the glyphs we need for this label to the glyph atlas.
|
||||
if (shaping.size()) {
|
||||
addGlyphsToAtlas(id.to_uint64(), properties.text.font, feature.label, fontStack,
|
||||
glyphAtlas, face);
|
||||
SymbolBucket::addGlyphsToAtlas(id.to_uint64(), properties.text.font, feature.label, fontStack,
|
||||
glyphAtlas, face);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ void StyleLayer::setClasses(const std::vector<std::string> &class_names, const t
|
||||
std::set<PropertyKey> already_applied;
|
||||
|
||||
// Reverse iterate through all class names and apply them last to first.
|
||||
for (auto it = class_names.rbegin(); it != class_names.rend(); it++) {
|
||||
for (auto it = class_names.rbegin(); it != class_names.rend(); ++it) {
|
||||
const std::string &class_name = *it;
|
||||
// From here on, we're only dealing with IDs to avoid comparing strings all the time.
|
||||
const ClassID class_id = ClassDictionary::Get().lookup(class_name);
|
||||
|
||||
@@ -139,7 +139,8 @@ Image::Image(const std::string &data, bool flip) {
|
||||
png_size_t rowbytes = png_get_rowbytes(png, info);
|
||||
assert(width * 4 == rowbytes);
|
||||
|
||||
img = (char *)std::malloc(width * height * 4);
|
||||
img = static_cast<char*>(::operator new(width * height * 4));
|
||||
|
||||
char *surface = img;
|
||||
assert(surface);
|
||||
|
||||
@@ -162,7 +163,7 @@ Image::Image(const std::string &data, bool flip) {
|
||||
fprintf(stderr, "loading PNG failed: %s\n", e.what());
|
||||
png_destroy_read_struct(&png, &info, nullptr);
|
||||
if (img) {
|
||||
std::free(img);
|
||||
::operator delete(img);
|
||||
img = nullptr;
|
||||
}
|
||||
width = 0;
|
||||
@@ -171,8 +172,5 @@ Image::Image(const std::string &data, bool flip) {
|
||||
}
|
||||
|
||||
Image::~Image() {
|
||||
if (img) {
|
||||
std::free(img);
|
||||
img = nullptr;
|
||||
}
|
||||
::operator delete(img),img = nullptr;
|
||||
}
|
||||
|
||||
@@ -31,4 +31,4 @@ std::string read_file(const std::string &filename) {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,9 +15,8 @@ Database::Database(const std::string &filename, int flags) {
|
||||
}
|
||||
}
|
||||
|
||||
Database::Database(Database &&other) {
|
||||
*this = std::move(other);
|
||||
}
|
||||
Database::Database(Database &&other)
|
||||
: db(std::move(other.db)) {}
|
||||
|
||||
Database &Database::operator=(Database &&other) {
|
||||
std::swap(db, other.db);
|
||||
|
||||
Reference in New Issue
Block a user