Merge pull request #622 from mapbox/private-headers

make most headers private
This commit is contained in:
Konstantin Käfer
2014-12-04 20:24:29 +01:00
269 changed files with 137 additions and 122 deletions

1
.gitignore vendored
View File

@@ -6,7 +6,6 @@
/mason_packages
/config.gypi
/config-ios.gypi
/config/constants_local.cpp
/build
/include/mbgl/shader/shaders.hpp
/src/shader/shaders_gl.cpp

View File

@@ -21,7 +21,6 @@
},
'sources': [
'<!@(find src -name "*.cpp")',
'<!@(test -f "config/constants_local.cpp" && echo "config/constants_local.cpp" || echo "config/constants.cpp")',
'<!@(find src -name "*.c")',
'<!@(find src -name "*.h")',
'<!@(find include -name "*.hpp")',
@@ -31,6 +30,7 @@
],
'include_dirs': [
'../include',
'../src',
],
'conditions': [
['OS == "mac"', {

View File

@@ -29,7 +29,6 @@
'sources': [
'../platform/default/headless_view.cpp',
'../platform/default/headless_display.cpp',
'../platform/default/caching_http_file_source.cpp',
],
},
],

View File

@@ -36,7 +36,6 @@
'../platform/darwin/string_nsstring.mm',
'../platform/darwin/http_request_baton_cocoa.mm',
'../platform/darwin/image.mm',
'../platform/default/caching_http_file_source.cpp',
],
'include_dirs': [
'../include',

View File

@@ -35,7 +35,6 @@
'../platform/default/image_reader.cpp',
'../platform/default/png_reader.cpp',
'../platform/default/jpeg_reader.cpp',
'../platform/default/caching_http_file_source.cpp',
],
'include_dirs': [
'../include',

View File

@@ -11,7 +11,6 @@
'../platform/darwin/string_nsstring.mm',
'../platform/darwin/http_request_baton_cocoa.mm',
'../platform/darwin/image.mm',
'../platform/default/caching_http_file_source.cpp',
],
'include_dirs': [
'../include',

View File

@@ -1,25 +0,0 @@
** SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
** Copyright (C) [dates of first publication] Silicon Graphics, Inc.
** All Rights Reserved.
**
** Permission is hereby granted, free of charge, to any person obtaining a copy
** of this software and associated documentation files (the "Software"), to deal
** in the Software without restriction, including without limitation the rights
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
** of the Software, and to permit persons to whom the Software is furnished to do so,
** subject to the following conditions:
**
** The above copyright notice including the dates of first publication and either this
** permission notice or a reference to http://oss.sgi.com/projects/FreeB/ shall be
** included in all copies or substantial portions of the Software.
**
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
** INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
** PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL SILICON GRAPHICS, INC.
** BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE
** OR OTHER DEALINGS IN THE SOFTWARE.
**
** Except as contained in this notice, the name of Silicon Graphics, Inc. shall not
** be used in advertising or otherwise to promote the sale, use or other dealings in
** this Software without prior written authorization from Silicon Graphics, Inc.

View File

@@ -2,9 +2,6 @@
#define MBGL_MAP_MAP
#include <mbgl/map/transform.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/geometry/sprite_atlas.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/time.hpp>
#include <mbgl/util/uv.hpp>
@@ -19,6 +16,7 @@
namespace mbgl {
class Painter;
class GlyphStore;
class LayerDescription;
class Sprite;
@@ -29,6 +27,8 @@ class StyleSource;
class TexturePool;
class FileSource;
class View;
class GlyphAtlas;
class SpriteAtlas;
class Map : private util::noncopyable {
typedef void (*stop_callback)(void *);
@@ -182,13 +182,13 @@ private:
FileSource& fileSource;
util::ptr<Style> style;
GlyphAtlas glyphAtlas;
const std::unique_ptr<GlyphAtlas> glyphAtlas;
util::ptr<GlyphStore> glyphStore;
SpriteAtlas spriteAtlas;
const std::unique_ptr<SpriteAtlas> spriteAtlas;
util::ptr<Sprite> sprite;
util::ptr<TexturePool> texturePool;
Painter painter;
const std::unique_ptr<Painter> painter;
std::string styleURL;
std::string styleJSON = "";

View File

@@ -4,7 +4,6 @@
#include <mbgl/map/tile.hpp>
#include <mbgl/util/mat4.hpp>
#include <mbgl/util/vec.hpp>
#include <cstdint>
#include <array>

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_COMMON_HEADLESS_DISPLAY
#define MBGL_COMMON_HEADLESS_DISPLAY
#include "headless_view.hpp"
#include <mbgl/platform/default/headless_view.hpp>
namespace mbgl {

View File

@@ -134,9 +134,9 @@ extern PFNGLISVERTEXARRAYPROC IsVertexArray;
// static int indent = 0;
inline void start_group(const std::string &str) {
if (gl::PushDebugGroup != nullptr) {
gl::PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, str.size(), str.c_str());
gl::PushDebugGroup(GL_DEBUG_SOURCE_APPLICATION, 0, GLsizei(str.size()), str.c_str());
} else if (gl::PushGroupMarkerEXT != nullptr) {
gl::PushGroupMarkerEXT(str.size(), str.c_str());
gl::PushGroupMarkerEXT(GLsizei(str.size()), str.c_str());
}
// fprintf(stderr, "%s%s\n", std::string(indent * 4, ' ').c_str(), str.c_str());
// indent++;

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_PLATFORM_LOG
#define MBGL_PLATFORM_LOG
#include "event.hpp"
#include <mbgl/platform/event.hpp>
#include <mbgl/util/std.hpp>

View File

@@ -16,7 +16,7 @@ class SQLiteStore;
class CachingHTTPFileSource : public FileSource {
public:
CachingHTTPFileSource(const std::string &path_);
~CachingHTTPFileSource();
virtual ~CachingHTTPFileSource();
// Stores and checks the libuv loop for requests
void setLoop(uv_loop_t*);

View File

@@ -10,6 +10,7 @@
typedef struct uv_loop_s uv_loop_t;
namespace mbgl {
class FileSource : public util::noncopyable {

View File

@@ -3,6 +3,7 @@
#include <mbgl/storage/request_callback.hpp>
#include <mbgl/storage/response.hpp>
#include <mbgl/util/ptr.hpp>
#include <thread>

View File

@@ -4,7 +4,7 @@
#include <cmath>
#include <array>
#include "vec.hpp"
#include <mbgl/util/vec.hpp>
namespace mbgl {
namespace util {

View File

@@ -10,7 +10,7 @@
#include <iosfwd>
#include <string>
#include "recursive_wrapper.hpp"
#include <mbgl/util/recursive_wrapper.hpp>
#ifdef _MSC_VER
// http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx

View File

@@ -105,11 +105,6 @@ struct vec4 {
};
struct box {
vec2<double> tl, tr, bl, br;
vec2<double> center;
};
typedef vec2<int16_t> Coordinate;
}

View File

@@ -4,7 +4,7 @@
#include <mbgl/platform/default/settings_json.hpp>
#include <mbgl/platform/default/glfw_view.hpp>
#include <mbgl/platform/default/log_stderr.hpp>
#include <mbgl/platform/default/caching_http_file_source.hpp>
#include <mbgl/storage/caching_http_file_source.hpp>
#include <signal.h>
#include <getopt.h>

View File

@@ -1,8 +1,9 @@
#include <mbgl/platform/platform.hpp>
#include <mbgl/platform/darwin/settings_nsuserdefaults.hpp>
#include <mbgl/platform/darwin/log_nslog.hpp>
#include <mbgl/platform/darwin/Reachability.h>
#include <mbgl/platform/default/glfw_view.hpp>
#include <mbgl/platform/default/caching_http_file_source.hpp>
#include <mbgl/storage/caching_http_file_source.hpp>
#import <Foundation/Foundation.h>

View File

@@ -1,40 +1,30 @@
#include <mbgl/platform/default/settings_json.hpp>
#include <rapidjson/prettywriter.h>
#include <rapidjson/filestream.h>
#include <rapidjson/document.h>
#include <stdio.h>
#include <fstream>
using namespace mbgl;
Settings_JSON::Settings_JSON() { load(); }
void Settings_JSON::load() {
FILE *settingsFile = fopen("/tmp/mbgl-native.json", "r");
if (settingsFile != NULL) {
rapidjson::FileStream is(settingsFile);
rapidjson::Document document;
document.ParseStream<0>(is);
if (document.IsArray()) {
longitude = document[rapidjson::SizeType(0)].GetDouble();
latitude = document[1].GetDouble();
zoom = document[2].GetDouble();
bearing = document[3].GetDouble();
debug = document[4].GetBool();
}
std::ifstream file("/tmp/mbgl-native.cfg");
if (file) {
file >> longitude;
file >> latitude;
file >> zoom;
file >> bearing;
file >> debug;
}
}
void Settings_JSON::save() {
rapidjson::FileStream s(fopen("/tmp/mbgl-native.json", "w"));
rapidjson::PrettyWriter<rapidjson::FileStream> writer(s);
writer.StartArray();
writer.Double(longitude);
writer.Double(latitude);
writer.Double(zoom);
writer.Double(bearing);
writer.Bool(debug);
writer.EndArray();
std::ofstream file("/tmp/mbgl-native.cfg");
if (file) {
file << longitude << std::endl;
file << latitude << std::endl;
file << zoom << std::endl;
file << bearing << std::endl;
file << debug << std::endl;
}
}
void Settings_JSON::clear() {

View File

@@ -38,7 +38,7 @@
* *
*******************************************************************************/
#include <clipper/clipper.hpp>
#include "clipper.hpp"
#include <cmath>
#include <vector>
#include <algorithm>

View File

@@ -22,7 +22,7 @@
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
// IN THE SOFTWARE.
#include <csscolorparser/csscolorparser.hpp>
#include "csscolorparser.hpp"
#include <cstdint>
#include <vector>

View File

@@ -35,7 +35,7 @@ extern "C" {
#include <stdio.h>
#include <stdlib.h>
#include <libtess2/tesselator.h>
#include "tesselator.h"
//#define CHECK_BOUNDS

View File

@@ -36,7 +36,7 @@
extern "C" {
#endif
#include <libtess2/tesselator.h>
#include "tesselator.h"
struct BucketAlloc *createBucketAlloc( TESSalloc* alloc, const char *name,
unsigned int itemSize, unsigned int bucketSize );

View File

@@ -30,7 +30,7 @@
*/
#include <stddef.h>
#include <libtess2/tesselator.h>
#include "tesselator.h"
#include "bucketalloc.h"
#include "dict.h"

View File

@@ -32,7 +32,7 @@
#ifndef MESH_H
#define MESH_H
#include <libtess2/tesselator.h>
#include "tesselator.h"
typedef struct TESSmesh TESSmesh;
typedef struct TESSvertex TESSvertex;

View File

@@ -32,7 +32,7 @@
//#include "tesos.h"
#include <stddef.h>
#include <assert.h>
#include <libtess2/tesselator.h>
#include "tesselator.h"
#include "priorityq.h"

View File

@@ -37,7 +37,7 @@
#include "mesh.h"
#include "dict.h"
#include "priorityq.h"
#include <libtess2/tesselator.h>
#include "tesselator.h"
#ifdef __cplusplus
extern "C" {

View File

@@ -1,10 +1,10 @@
#include <mbgl/geometry/debug_font_buffer.hpp>
#include <mbgl/geometry/debug_font_data.hpp>
#include <mbgl/platform/gl.hpp>
#include <cmath>
#include <cstring>
#include "debug_font_data.hpp"
using namespace mbgl;
void DebugFontBuffer::addText(const char *text, double left, double baseline, double scale) {

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_GEOMETRY_DEBUG_FONT_BUFFER
#define MBGL_GEOMETRY_DEBUG_FONT_BUFFER
#include "buffer.hpp"
#include <mbgl/geometry/buffer.hpp>
namespace mbgl {

View File

@@ -3,6 +3,7 @@
#include <mbgl/geometry/buffer.hpp>
#include <mbgl/geometry/vao.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <array>

View File

@@ -1,4 +1,5 @@
#include <mbgl/geometry/fill_buffer.hpp>
#include <mbgl/platform/gl.hpp>
#include <climits>

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_GEOMETRY_FILL_BUFFER
#define MBGL_GEOMETRY_FILL_BUFFER
#include "buffer.hpp"
#include <mbgl/geometry/buffer.hpp>
#include <vector>
#include <cstdint>

View File

@@ -1,5 +1,6 @@
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/map/vector_tile.hpp>
#include <mbgl/platform/gl.hpp>
#include <mbgl/platform/platform.hpp>

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_GEOMETRY_ICON_BUFFER
#define MBGL_GEOMETRY_ICON_BUFFER
#include "buffer.hpp"
#include <mbgl/geometry/buffer.hpp>
#include <array>

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_GEOMETRY_LINE_BUFFER
#define MBGL_GEOMETRY_LINE_BUFFER
#include "buffer.hpp"
#include <mbgl/geometry/buffer.hpp>
namespace mbgl {

View File

@@ -2,6 +2,7 @@
#define MBGL_GEOMETRY_SPRITE_ATLAS
#include <mbgl/geometry/binpack.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/ptr.hpp>

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_GEOMETRY_TEXT_BUFFER
#define MBGL_GEOMETRY_TEXT_BUFFER
#include "buffer.hpp"
#include <mbgl/geometry/buffer.hpp>
#include <array>
namespace mbgl {

View File

@@ -1,7 +1,8 @@
#include <mbgl/map/map.hpp>
#include <mbgl/map/source.hpp>
#include <mbgl/map/view.hpp>
#include <mbgl/platform/platform.hpp>
#include <mbgl/map/source.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/map/sprite.hpp>
#include <mbgl/util/transition.hpp>
#include <mbgl/util/time.hpp>
@@ -15,6 +16,7 @@
#include <mbgl/style/style.hpp>
#include <mbgl/text/glyph_store.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/style/style_layer.hpp>
#include <mbgl/style/style_layer_group.hpp>
#include <mbgl/style/style_bucket.hpp>
#include <mbgl/util/texture_pool.hpp>
@@ -93,10 +95,10 @@ Map::Map(View& view_, FileSource& fileSource_)
#endif
transform(view_),
fileSource(fileSource_),
glyphAtlas(1024, 1024),
spriteAtlas(512, 512),
glyphAtlas(util::make_unique<GlyphAtlas>(1024, 1024)),
spriteAtlas(util::make_unique<SpriteAtlas>(512, 512)),
texturePool(std::make_shared<TexturePool>()),
painter(spriteAtlas, glyphAtlas)
painter(util::make_unique<Painter>(*spriteAtlas, *glyphAtlas))
{
view.initialize(this);
// Make sure that we're doing an initial drawing in all cases.
@@ -175,7 +177,8 @@ void Map::start() {
});
asyncCleanup = util::make_unique<uv::async>(**loop, [this]() {
painter.cleanup();
assert(painter);
painter->cleanup();
});
thread = std::thread([this]() {
@@ -279,7 +282,8 @@ void Map::cleanup() {
}
void Map::terminate() {
painter.terminate();
assert(painter);
painter->terminate();
}
void Map::setReachability(bool reachable) {
@@ -295,8 +299,9 @@ void Map::setReachability(bool reachable) {
void Map::setup() {
assert(std::this_thread::get_id() == mapThread);
assert(painter);
view.make_active();
painter.setup();
painter->setup();
view.make_inactive();
}
@@ -500,7 +505,8 @@ void Map::stopRotating() {
void Map::setDebug(bool value) {
debug = value;
painter.setDebug(debug);
assert(painter);
painter->setDebug(debug);
update();
}
@@ -583,8 +589,8 @@ void Map::updateSources(const util::ptr<StyleLayerGroup> &group) {
void Map::updateTiles() {
for (const auto& source : activeSources) {
source->source->update(*this, getWorker(),
style, glyphAtlas, *glyphStore,
spriteAtlas, getSprite(),
style, *glyphAtlas, *glyphStore,
*spriteAtlas, getSprite(),
*texturePool, fileSource, [this](){ update(); });
}
}
@@ -627,8 +633,8 @@ void Map::prepare() {
style->updateProperties(state.getNormalizedZoom(), animationTime);
// Allow the sprite atlas to potentially pull new sprite images if needed.
spriteAtlas.resize(state.getPixelRatio());
spriteAtlas.setSprite(getSprite());
spriteAtlas->resize(state.getPixelRatio());
spriteAtlas->setSprite(getSprite());
updateTiles();
}
@@ -636,7 +642,8 @@ void Map::prepare() {
void Map::render() {
view.make_active();
painter.render(*style, activeSources,
assert(painter);
painter->render(*style, activeSources,
state, animationTime);
// Schedule another rerender when we definitely need a next frame.
if (transform.needsTransition() || style->hasTransitions()) {

View File

@@ -10,6 +10,7 @@
#include <mbgl/util/vec.hpp>
#include <mbgl/util/math.hpp>
#include <mbgl/util/std.hpp>
#include <mbgl/util/box.hpp>
#include <mbgl/util/mapbox.hpp>
#include <mbgl/geometry/glyph_atlas.hpp>
#include <mbgl/style/style_layer.hpp>

View File

@@ -1,6 +1,7 @@
#include <mbgl/map/tile.hpp>
#include <mbgl/util/vec.hpp>
#include <mbgl/util/string.hpp>
#include <mbgl/util/box.hpp>
#include <cassert>

View File

@@ -1,5 +1,4 @@
#include <mbgl/map/tile_parser.hpp>
#include <mbgl/map/vector_tile_data.hpp>
#include <mbgl/style/style.hpp>
#include <mbgl/style/style_layer.hpp>

View File

@@ -1,5 +1,6 @@
#include <mbgl/map/transform_state.hpp>
#include <mbgl/util/constants.hpp>
#include <mbgl/util/box.hpp>
using namespace mbgl;

View File

@@ -1,5 +1,4 @@
#include <mbgl/renderer/debug_bucket.hpp>
#include <mbgl/renderer/painter.hpp>
#include <mbgl/platform/gl.hpp>

Some files were not shown because too many files have changed in this diff Show More