use CoreImage for decoding/encoding images on osx/ios
This commit is contained in:
@@ -92,13 +92,25 @@ TEST_P(HeadlessTest, render) {
|
||||
map.setLonLatZoom(longitude, latitude, zoom);
|
||||
map.setBearing(bearing);
|
||||
|
||||
|
||||
// Run the loop. It will terminate when we don't have any further listeners.
|
||||
map.run();
|
||||
|
||||
const unsigned int w = width * pixelRatio;
|
||||
const unsigned int h = height * pixelRatio;
|
||||
|
||||
const std::string image = util::compress_png(w, h, view.readPixels().get(), true);
|
||||
auto pixels = view.readPixels();
|
||||
|
||||
const int stride = w * 4;
|
||||
auto tmp = std::unique_ptr<char[]>(new char[stride]());
|
||||
char *rgba = reinterpret_cast<char *>(pixels.get());
|
||||
for (int i = 0, j = height - 2; i < j; i++, j--) {
|
||||
memcpy(tmp.get(), rgba + i * stride, stride);
|
||||
memcpy(rgba + i * stride, rgba + j * stride, stride);
|
||||
memcpy(rgba + j * stride, tmp.get(), stride);
|
||||
}
|
||||
|
||||
const std::string image = util::compress_png(w, h, pixels.get());
|
||||
util::write_file(actual_image, image);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user