remove void* parameter from platform::restart()

This commit is contained in:
Konstantin Käfer
2014-02-21 12:18:11 +01:00
parent 1fb4451192
commit 0306e77ff0
6 changed files with 13 additions and 26 deletions

View File

@@ -15,7 +15,7 @@ class Tile;
namespace platform {
// Restarts painting. This could for example trigger the event loop of the controlling application.
void restart(void *obj);
void restart();
struct Response {
int16_t code = -1;

View File

@@ -397,7 +397,7 @@ namespace llmr
{
namespace platform
{
void restart(void *)
void restart()
{
[[NSNotificationCenter defaultCenter] postNotificationName:MBXNeedsRenderNotification object:nil];
}

View File

@@ -9,8 +9,6 @@
#include <thread>
NSString *const MBXNeedsRenderNotification = @"MBXNeedsRenderNotification";
class MapView {
public:
MapView() :
@@ -63,15 +61,9 @@ public:
glfwSetScrollCallback(window, scroll);
glfwSetCharCallback(window, character);
glfwSetKeyCallback(window, key);
renderObserver = [[NSNotificationCenter defaultCenter] addObserverForName:MBXNeedsRenderNotification
object:nil
queue:[NSOperationQueue mainQueue]
usingBlock: ^ (NSNotification * notification) {
dirty = true;
}];
}
static void character(GLFWwindow *window, unsigned int codepoint) {
}
@@ -216,7 +208,6 @@ public:
}
~MapView() {
[[NSNotificationCenter defaultCenter] removeObserver:renderObserver];
glfwTerminate();
}
@@ -233,8 +224,6 @@ public:
GLFWwindow *window;
llmr::Settings_MacOSX settings;
llmr::Map map;
id renderObserver;
};
MapView *mapView;
@@ -243,7 +232,7 @@ NSOperationQueue *queue;
namespace llmr {
namespace platform {
void restart(void *) {
void restart() {
mapView->dirty = true;
CGEventRef event = CGEventCreate(NULL);
CGEventSetType(event, kCGEventMouseMoved);
@@ -274,7 +263,6 @@ void request_http(std::string url, std::function<void(Response&)> background_fun
dispatch_async(dispatch_get_main_queue(), ^(void) {
foreground_callback();
});
[[NSNotificationCenter defaultCenter] postNotificationName:MBXNeedsRenderNotification object:nil];
}];
}

View File

@@ -69,12 +69,12 @@ void Map::moveBy(double dx, double dy, double duration) {
void Map::startPanning() {
transform.startPanning();
platform::restart(this);
platform::restart();
}
void Map::stopPanning() {
transform.stopPanning();
platform::restart(this);
platform::restart();
}
void Map::scaleBy(double ds, double cx, double cy, double duration) {
@@ -89,12 +89,12 @@ void Map::scaleBy(double ds, double cx, double cy, double duration) {
void Map::startScaling() {
transform.startScaling();
platform::restart(this);
platform::restart();
}
void Map::stopScaling() {
transform.stopScaling();
platform::restart(this);
platform::restart();
}
void Map::rotateBy(double cx, double cy, double sx, double sy, double ex, double ey, double duration) {
@@ -107,12 +107,12 @@ void Map::rotateBy(double cx, double cy, double sx, double sy, double ex, double
void Map::startRotating() {
transform.startRotating();
platform::restart(this);
platform::restart();
}
void Map::stopRotating() {
transform.stopRotating();
platform::restart(this);
platform::restart();
}
void Map::setLonLat(double lon, double lat, double duration) {
@@ -233,7 +233,7 @@ void Map::cancelAnimations() {
void Map::update() {
updateTiles();
platform::restart(this);
platform::restart();
}

View File

@@ -83,8 +83,7 @@ void Tile::request() {
fprintf(stderr, "tile loading failed\n");
}
}, []() {
// TODO: Make sure this gets passed the correct map ID/pointer.
platform::restart(nullptr);
platform::restart();
});
}

View File

@@ -36,7 +36,7 @@ void Sprite::load(const std::string& base_url, float pixelRatio) {
std::lock_guard<std::mutex> lock(sprite->mtx);
if (sprite->img.size() && sprite->pos.size()) {
sprite->loaded = true;
platform::restart(NULL);
platform::restart();
fprintf(stderr, "sprite loaded\n");
}
};